chrome-extensions-samples/functional-samples/ai.gemini-on-device
Thomas Steiner b939ca2db9
Change on-device example to use the origin trial API (#1337)
* Add scaffolding for Prompt API OT example

* Rewrite existing example to use the OT

* Add trial token and key

* Update error message, add `minimum_chrome_version`

* Fix feature detection

* Some README refinements

* Correct instructions

* OT refinement
2024-10-31 15:46:16 +01:00
..
images Add gemini nano sample (#1234) 2024-07-22 17:44:44 +00:00
sidepanel Change on-device example to use the origin trial API (#1337) 2024-10-31 15:46:16 +01:00
README.md Change on-device example to use the origin trial API (#1337) 2024-10-31 15:46:16 +01:00
background.js Add gemini nano sample (#1234) 2024-07-22 17:44:44 +00:00
manifest.json Change on-device example to use the origin trial API (#1337) 2024-10-31 15:46:16 +01:00

README.md

On-device AI with Gemini Nano

This sample demonstrates how to use the experimental Gemini Nano API available in the context of an origin trial in Chrome with Chrome Extensions. To learn more about the API and how to sign-up for the origin trial, head over to Built-in AI on developer.chrome.com.

Overview

The extension provides a chat interface using the Prompt API with Chrome's built-in Gemini Nano model.

Running this extension

  1. Clone this repository.

  2. Launch Chrome with the following flag, which makes sure the origin trial token in manifest.json is accepted by the browser. This won't be necessary once the origin trial is live.

    --origin-trial-public-key=dRCs+TocuKkocNKa0AtZ4awrt9XKH2SQCI6o4FY6BNA=

  3. Load this directory in Chrome as an unpacked extension.

  4. Click the extension icon.

  5. Interact with the Prompt API in the sidebar.

Creating your own extension

If you use this sample as the foundation for your own extension, be sure to update the "trial_tokens" field with your own origin trial token and to remove the "key" field in manifest.json.