←back to thread

229 points modinfo | 4 comments | | HN request time: 1.071s | source
Show context
lolinder ◴[] No.40834980[source]
> The code below is all you need to stream text with Chrome AI and the Vercel AI SDK. ... `chromeai` implements a Provider that uses `window.ai` under the hood

Leave it to Vercel to announce `window.ai` on Google's behalf by showing off their own abstraction but not the actual Chrome API.

Here's a blog post from a few days ago that shows how the actual `window.ai` API works [0]. The code is extremely simple and really shouldn't need a wrapper:

    const model = await window.ai.createTextSession();
    const result = await model.prompt("What do you think is the meaning of life?");
[0] https://afficone.com/blog/window-ai-new-chrome-feature-api/
replies(3): >>40835027 #>>40835359 #>>40835578 #
darepublic ◴[] No.40835359[source]
web dev is rife with this stuff. wrappers upon wrappers with a poor trade off between adding api overhead / obscuring the real workings of what's going on and any actual enhanced functionality or convenience. it's done for github stars and rep.
replies(1): >>40835675 #
1. thiht ◴[] No.40835675[source]
Or maybe it’s done because people like to try and experiment new things, see what works and what doesn’t, with sometimes surprising results. I thought the name of this site was Hacker News, let people do weird things
replies(1): >>40835747 #
2. BigJono ◴[] No.40835747[source]
Lmao flogging off wrappers over things other people have built is "hacker spirit" or whatever now is it? This place has gone completely to shit.
replies(1): >>40836711 #
3. thiht ◴[] No.40836711[source]
As an example jQuery literally started as a wrapper lib around JS features, and it became so influential over time that tons of features from jQuery were upstreamed to JS.

Yes, wrapping stuff to give a different developer experience contributes to new ideas, and can evolve into something more.

replies(1): >>40837540 #
4. darepublic ◴[] No.40837540{3}[source]
It's a double edged sword. I suppose when I started my career I would just take the popularity of something as proof positive it was truly helpful. At this point I am a lot more cynical having gone experienced the churn of what is popular in the industry. I would say jQuery was definitely a good thing, because of the state of web at the time and the disparity between browsers.

More recently, and on topic, I am dubious about langchain and the notion of doing away with composing your own natural language prompts from the start. I know of at least some devs whose interactions with llm are restricted solely to using langchain, and have never realized how easy it is to, say, prompt the llm for json adhering to a schema by just, you know, asking it. I suppose eventually frameworks/ wrappers will arise around in-browser ai models. But I see a danger in people being so eager to incuriously adopt the popular even as it bloats their project size unnecessarily. If we forecast ahead, if LLMs become ever better, then the need for wrappers should diminish I would think. It would suck if AI and language models got ever better but we still were saddled with the same bloat, cognitive and code size, just because of human nature.