←back to thread

229 points modinfo | 2 comments | | HN request time: 0.444s | source
Show context
oefrha ◴[] No.40834836[source]
See

https://developer.chrome.com/docs/ai/built-in

https://github.com/jeasonstudio/chrome-ai

I can’t seem to find public documentation for the API with a cursory search, so https://github.com/jeasonstudio/chrome-ai/blob/ec9e334253713... might be the best documentation (other than directly inspecting the window.ai object in console) at the moment.

It’s not really clear if the Gemini Nano here is Nano-1 (1.8B) or Nano-2 (3.25B) or selected based on device.

replies(2): >>40834950 #>>40835017 #
mikeqq2024 ◴[] No.40835017[source]
1.8B/3.25B is still too much for edge devices. Ideally tens or hundreds mega would be ok. Is there an option to change the builtin Gemini Nano to other smaller models?

By the way, haven't touch the lastest JS code for a while, what does this new syntax mean: "import { chromeai } "

Also not get the textStream code: for await (const textPart of textStream) { result = textPart; } does result get override for each loop step?

replies(3): >>40835066 #>>40835093 #>>40835188 #
1. dchest ◴[] No.40835066[source]
That's just some supplemental code. The actual API is:

    const session = await window.ai.createTextSession()
    const outputText = await session.prompt(inputText)
That's all there is for now (createGenericSession does the same at this time, and there are canCreateTextSession/canCreateGenericSession).
replies(1): >>40865237 #
2. dchest ◴[] No.40865237[source]
Update: there's actually quite a lot more: https://github.com/explainers-by-googlers/prompt-api