←back to thread

229 points modinfo | 1 comments | | HN request time: 0.208s | 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 #
1. Rauchg ◴[] No.40835027[source]
Someone in our community created a provider and I wanted to showcase it.

It’s nice insofar with very little abstraction, runtime, and bundle size overhead, you can easily switch between models without having to learn a new API.