Chrome Built-in AI: Empowering Developers with Local AI Capabilities

Published On Fri Oct 18 2024
Chrome Built-in AI: Empowering Developers with Local AI Capabilities

Get Started with Chrome Built-in AI : Access Gemini Nano Model Locally

An AI model within your browser. Yes, that’s exactly what Chrome Built-AI is all about. The team has been at work to infuse AI APIs and models inside of Chrome via Chrome’s built-in AI APIs and models, including Gemini Nano. This would mean that you can invoke a Gemini model locally in the browser. Thinking of giving that Chrome extension of yours, some AI superpowers and yet running it locally? You should give Chrome Built-in AI a try.

Early Preview Program

An exciting development for developers is the introduction of the Prompt API, which enables sending natural language queries to the local Gemini Nano model in the browser.

It’s an Early Preview program and this means that you will face breaking changes across releases, APIs that could change and more. Be ready for that. At the time of writing, the following built-in APIs are available in the preview program along with the links to their specifications. Each of these links describes the feature, how you can configure/enable it in the browser, sample code to see the feature in action and a playground.

You can refer to the APIs page to understand the current status of each of these APIs, exposed to Chrome Extensions and more.

Suggestion: Start with the Prompt API, that allows you to send across a natural language query to the local Gemini Nano model in the browser.

Built-in AI | AI on Chrome | Chrome for Developers

The Chrome Built-in AI is currently an Early Preview program and ideally you should go through the Getting Started post on this, that highlights the background, need for these capabilities and more. This will set you up with solid grounding on what these features are all about, why they are important and the possibilities with it.

Getting Started Steps

  1. Install Chrome Canary. At the time of writing, you will need version 128.0.6545.0 or above.
  2. Enable Gemini Nano and the Prompt API: There are a couple of flags to set for this (do this in Chrome Canary).
  3. Confirm availability of Gemini Nano: This step involves opening up the Chrome DevTools.

The first step would be to join the early preview program, so that you get a welcome email and are alerted about updates as they happen.

I am using the steps provided in the Prompt API document to get started. Keep in mind, that there will be specific steps required for the other APIs that are highlighted/mentioned in the previous section and for which links were provided. But for now, this will suffice.

Additional Resources

The entire code for the page is shown below:

The Google Chrome Built-in AI Challenge details are available here. If you have an idea for a web application or Chrome Extension that uses one of the built-in AI APIs, consider participating in it.

I’d like to share a few other videos that I have found useful and ones that could spark some ideas. Take a look.

Happy Building with Chrome Built-in AI. If you’ve come across some blog posts, videos that show interesting ways in which developers are integrating Chrome Built-in AI, do share in the comments.