docs-devsite/ai.chromeadapter.md
Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Defines an inference "backend" that uses Chrome's on-device model, and encapsulates logic for detecting when on-device inference is possible.
These methods should not be called directly by the user.
<b>Signature:</b>
export interface ChromeAdapter
| Method | Description |
|---|---|
| generateContent(request) | <b><i>(Public Preview)</i></b> Generates content using on-device inference. |
| generateContentStream(request) | <b><i>(Public Preview)</i></b> Generates a content stream using on-device inference. |
| isAvailable(request) | <b><i>(Public Preview)</i></b> Checks if the on-device model is capable of handling a given request. |
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Generates content using on-device inference.
This is comparable to GenerativeModel.generateContent() for generating content using in-cloud inference.
<b>Signature:</b>
generateContent(request: GenerateContentRequest): Promise<Response>;
| Parameter | Type | Description |
|---|---|---|
| request | GenerateContentRequest | a standard Firebase AI GenerateContentRequest |
<b>Returns:</b>
Promise<Response>
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Generates a content stream using on-device inference.
This is comparable to GenerativeModel.generateContentStream() for generating a content stream using in-cloud inference.
<b>Signature:</b>
generateContentStream(request: GenerateContentRequest): Promise<Response>;
| Parameter | Type | Description |
|---|---|---|
| request | GenerateContentRequest | a standard Firebase AI GenerateContentRequest |
<b>Returns:</b>
Promise<Response>
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Checks if the on-device model is capable of handling a given request.
<b>Signature:</b>
isAvailable(request: GenerateContentRequest): Promise<boolean>;
| Parameter | Type | Description |
|---|---|---|
| request | GenerateContentRequest | A potential request to be passed to the model. |
<b>Returns:</b>
Promise<boolean>