News for hackers. Stuff that matters.
Re:Chrome is adding `window.ai` – a Gemini Nano AI model rig... by luke-stanley on Sunday June 30, 2024 @03:47AM (#40835717)
Presumably something like model.includes("gemini-nano:0.4") could work?
Re:Chrome is adding `window.ai` – a Gemini Nano AI model rig... by damacaner on Sunday June 30, 2024 @05:57AM (#40836178)
can we make everything constant like C# does please

Models.GeminiNano04

boom

Re:Chrome is adding `window.ai` – a Gemini Nano AI model rig... by jitl on Sunday June 30, 2024 @09:40AM (#40837121)
What’s the point in JavaScript? At the end of the day that’s still equivalent to Models[“GeminiNano04”]

In C# you can’t compile a reference to Models.Potato04 unless Potato04 exists. In JS it’s perfectly legal to have code that references non-existant properties, so there’s no real developer ergonomics benefit here.

On the contrary, code like `ai.createTextSession(“Potato:4”)` can throw an error like “Model Potato:4 doesn’t exist, try Potato:1”, whereas `ai.createTextSession(ai.Models.Potato04)` can only throw an error like “undefined is not a Model. Pass a string here”.

Or you can make ai.Models a special object that throws when undefined properties are accessed, but then it’s annoying to write code that sniffs out which models are available.

Re:Chrome is adding `window.ai` – a Gemini Nano AI model rig... by langcss on Monday July 01, 2024 @04:01AM (#40843547)
That would be like making a constant for every nuget package/version tuple: unworkable because new versions and packages come out all the time.

Or making constants for every device manufacturer you can connect to via web Bluetooth.