Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/selfish-elephants-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/ai': patch
---

Change documentation tags for hybrid inference from "EXPERIMENTAL" to "public preview".
32 changes: 18 additions & 14 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class BooleanSchema extends Schema {

// @public
export class ChatSession {
// Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "ChromeAdapter" which is marked as @beta
constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
getHistory(): Promise<Content[]>;
// (undocumented)
Expand All @@ -145,7 +146,7 @@ export class ChatSession {
sendMessageStream(request: string | Array<string | Part>): Promise<GenerateContentStreamResult>;
}

// @public
// @beta
export interface ChromeAdapter {
// @internal (undocumented)
countTokens(request: CountTokensRequest): Promise<Response>;
Expand Down Expand Up @@ -520,6 +521,7 @@ export interface GenerativeContentBlob {

// @public
export class GenerativeModel extends AIModel {
// Warning: (ae-incompatible-release-tags) The symbol "__constructor" is marked as @public, but its signature references "ChromeAdapter" which is marked as @beta
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions, chromeAdapter?: ChromeAdapter | undefined);
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
Expand All @@ -542,6 +544,8 @@ export class GenerativeModel extends AIModel {
// @public
export function getAI(app?: FirebaseApp, options?: AIOptions): AI;

// Warning: (ae-incompatible-release-tags) The symbol "getGenerativeModel" is marked as @public, but its signature references "HybridParams" which is marked as @beta
//
// @public
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;

Expand Down Expand Up @@ -695,7 +699,7 @@ export const HarmSeverity: {
// @public
export type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];

// @public
// @beta
export interface HybridParams {
inCloudParams?: ModelParams;
mode: InferenceMode;
Expand Down Expand Up @@ -795,15 +799,15 @@ export interface ImagenSafetySettings {
safetyFilterLevel?: ImagenSafetyFilterLevel;
}

// @public
// @beta
export const InferenceMode: {
readonly PREFER_ON_DEVICE: "prefer_on_device";
readonly ONLY_ON_DEVICE: "only_on_device";
readonly ONLY_IN_CLOUD: "only_in_cloud";
readonly PREFER_IN_CLOUD: "prefer_in_cloud";
};

// @public
// @beta
export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];

// @public
Expand Down Expand Up @@ -841,7 +845,7 @@ export const Language: {
// @public
export type Language = (typeof Language)[keyof typeof Language];

// @public
// @beta
export interface LanguageModelCreateCoreOptions {
// (undocumented)
expectedInputs?: LanguageModelExpected[];
Expand All @@ -851,48 +855,48 @@ export interface LanguageModelCreateCoreOptions {
topK?: number;
}

// @public
// @beta
export interface LanguageModelCreateOptions extends LanguageModelCreateCoreOptions {
// (undocumented)
initialPrompts?: LanguageModelMessage[];
// (undocumented)
signal?: AbortSignal;
}

// @public
// @beta
export interface LanguageModelExpected {
// (undocumented)
languages?: string[];
// (undocumented)
type: LanguageModelMessageType;
}

// @public
// @beta
export interface LanguageModelMessage {
// (undocumented)
content: LanguageModelMessageContent[];
// (undocumented)
role: LanguageModelMessageRole;
}

// @public
// @beta
export interface LanguageModelMessageContent {
// (undocumented)
type: LanguageModelMessageType;
// (undocumented)
value: LanguageModelMessageContentValue;
}

// @public
// @beta
export type LanguageModelMessageContentValue = ImageBitmapSource | AudioBuffer | BufferSource | string;

// @public
// @beta
export type LanguageModelMessageRole = 'system' | 'user' | 'assistant';

// @public
// @beta
export type LanguageModelMessageType = 'text' | 'image' | 'audio';

// @public
// @beta
export interface LanguageModelPromptOptions {
// (undocumented)
responseConstraint?: object;
Expand Down Expand Up @@ -1046,7 +1050,7 @@ export interface ObjectSchemaRequest extends SchemaRequest {
type: 'object';
}

// @public
// @beta
export interface OnDeviceParams {
// (undocumented)
createOptions?: LanguageModelCreateOptions;
Expand Down
20 changes: 16 additions & 4 deletions docs-devsite/ai.chromeadapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# ChromeAdapter interface
<b>(EXPERIMENTAL)</b> Defines an inference "backend" that uses Chrome's on-device model, and encapsulates logic for detecting when on-device inference is possible.
> 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.

Expand All @@ -24,12 +27,15 @@ export interface ChromeAdapter

| Method | Description |
| --- | --- |
| [generateContent(request)](./ai.chromeadapter.md#chromeadaptergeneratecontent) | Generates content using on-device inference. |
| [generateContentStream(request)](./ai.chromeadapter.md#chromeadaptergeneratecontentstream) | Generates a content stream using on-device inference. |
| [isAvailable(request)](./ai.chromeadapter.md#chromeadapterisavailable) | Checks if the on-device model is capable of handling a given request. |
| [generateContent(request)](./ai.chromeadapter.md#chromeadaptergeneratecontent) | <b><i>(Public Preview)</i></b> Generates content using on-device inference. |
| [generateContentStream(request)](./ai.chromeadapter.md#chromeadaptergeneratecontentstream) | <b><i>(Public Preview)</i></b> Generates a content stream using on-device inference. |
| [isAvailable(request)](./ai.chromeadapter.md#chromeadapterisavailable) | <b><i>(Public Preview)</i></b> Checks if the on-device model is capable of handling a given request. |

## ChromeAdapter.generateContent()

> 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()](./ai.generativemodel.md#generativemodelgeneratecontent) for generating content using in-cloud inference.
Expand All @@ -52,6 +58,9 @@ Promise&lt;Response&gt;

## ChromeAdapter.generateContentStream()

> 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()](./ai.generativemodel.md#generativemodelgeneratecontentstream) for generating a content stream using in-cloud inference.
Expand All @@ -74,6 +83,9 @@ Promise&lt;Response&gt;

## ChromeAdapter.isAvailable()

> 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>
Expand Down
20 changes: 16 additions & 4 deletions docs-devsite/ai.hybridparams.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# HybridParams interface
<b>(EXPERIMENTAL)</b> Configures hybrid inference.
> 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.
>

Configures hybrid inference.

<b>Signature:</b>

Expand All @@ -22,12 +25,15 @@ export interface HybridParams

| Property | Type | Description |
| --- | --- | --- |
| [inCloudParams](./ai.hybridparams.md#hybridparamsincloudparams) | [ModelParams](./ai.modelparams.md#modelparams_interface) | Optional. Specifies advanced params for in-cloud inference. |
| [mode](./ai.hybridparams.md#hybridparamsmode) | [InferenceMode](./ai.md#inferencemode) | Specifies on-device or in-cloud inference. Defaults to prefer on-device. |
| [onDeviceParams](./ai.hybridparams.md#hybridparamsondeviceparams) | [OnDeviceParams](./ai.ondeviceparams.md#ondeviceparams_interface) | Optional. Specifies advanced params for on-device inference. |
| [inCloudParams](./ai.hybridparams.md#hybridparamsincloudparams) | [ModelParams](./ai.modelparams.md#modelparams_interface) | <b><i>(Public Preview)</i></b> Optional. Specifies advanced params for in-cloud inference. |
| [mode](./ai.hybridparams.md#hybridparamsmode) | [InferenceMode](./ai.md#inferencemode) | <b><i>(Public Preview)</i></b> Specifies on-device or in-cloud inference. Defaults to prefer on-device. |
| [onDeviceParams](./ai.hybridparams.md#hybridparamsondeviceparams) | [OnDeviceParams](./ai.ondeviceparams.md#ondeviceparams_interface) | <b><i>(Public Preview)</i></b> Optional. Specifies advanced params for on-device inference. |

## HybridParams.inCloudParams

> 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.
>

Optional. Specifies advanced params for in-cloud inference.

<b>Signature:</b>
Expand All @@ -38,6 +44,9 @@ inCloudParams?: ModelParams;

## HybridParams.mode

> 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.
>

Specifies on-device or in-cloud inference. Defaults to prefer on-device.

<b>Signature:</b>
Expand All @@ -48,6 +57,9 @@ mode: InferenceMode;

## HybridParams.onDeviceParams

> 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.
>

Optional. Specifies advanced params for on-device inference.

<b>Signature:</b>
Expand Down
20 changes: 16 additions & 4 deletions docs-devsite/ai.languagemodelcreatecoreoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# LanguageModelCreateCoreOptions interface
<b>(EXPERIMENTAL)</b> Configures the creation of an on-device language model session.
> 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.
>

Configures the creation of an on-device language model session.

<b>Signature:</b>

Expand All @@ -22,12 +25,15 @@ export interface LanguageModelCreateCoreOptions

| Property | Type | Description |
| --- | --- | --- |
| [expectedInputs](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionsexpectedinputs) | [LanguageModelExpected](./ai.languagemodelexpected.md#languagemodelexpected_interface)<!-- -->\[\] | |
| [temperature](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionstemperature) | number | |
| [topK](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionstopk) | number | |
| [expectedInputs](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionsexpectedinputs) | [LanguageModelExpected](./ai.languagemodelexpected.md#languagemodelexpected_interface)<!-- -->\[\] | <b><i>(Public Preview)</i></b> |
| [temperature](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionstemperature) | number | <b><i>(Public Preview)</i></b> |
| [topK](./ai.languagemodelcreatecoreoptions.md#languagemodelcreatecoreoptionstopk) | number | <b><i>(Public Preview)</i></b> |

## LanguageModelCreateCoreOptions.expectedInputs

> 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.
>

<b>Signature:</b>

```typescript
Expand All @@ -36,6 +42,9 @@ expectedInputs?: LanguageModelExpected[];

## LanguageModelCreateCoreOptions.temperature

> 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.
>

<b>Signature:</b>

```typescript
Expand All @@ -44,6 +53,9 @@ temperature?: number;

## LanguageModelCreateCoreOptions.topK

> 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.
>

<b>Signature:</b>

```typescript
Expand Down
15 changes: 12 additions & 3 deletions docs-devsite/ai.languagemodelcreateoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# LanguageModelCreateOptions interface
<b>(EXPERIMENTAL)</b> Configures the creation of an on-device language model session.
> 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.
>

Configures the creation of an on-device language model session.

<b>Signature:</b>

Expand All @@ -23,11 +26,14 @@ export interface LanguageModelCreateOptions extends LanguageModelCreateCoreOptio

| Property | Type | Description |
| --- | --- | --- |
| [initialPrompts](./ai.languagemodelcreateoptions.md#languagemodelcreateoptionsinitialprompts) | [LanguageModelMessage](./ai.languagemodelmessage.md#languagemodelmessage_interface)<!-- -->\[\] | |
| [signal](./ai.languagemodelcreateoptions.md#languagemodelcreateoptionssignal) | AbortSignal | |
| [initialPrompts](./ai.languagemodelcreateoptions.md#languagemodelcreateoptionsinitialprompts) | [LanguageModelMessage](./ai.languagemodelmessage.md#languagemodelmessage_interface)<!-- -->\[\] | <b><i>(Public Preview)</i></b> |
| [signal](./ai.languagemodelcreateoptions.md#languagemodelcreateoptionssignal) | AbortSignal | <b><i>(Public Preview)</i></b> |

## LanguageModelCreateOptions.initialPrompts

> 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.
>

<b>Signature:</b>

```typescript
Expand All @@ -36,6 +42,9 @@ initialPrompts?: LanguageModelMessage[];

## LanguageModelCreateOptions.signal

> 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.
>

<b>Signature:</b>

```typescript
Expand Down
15 changes: 12 additions & 3 deletions docs-devsite/ai.languagemodelexpected.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# LanguageModelExpected interface
<b>(EXPERIMENTAL)</b> Options for the expected inputs for an on-device language model.
> 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.
>
Options for the expected inputs for an on-device language model.

<b>Signature:</b>

Expand All @@ -22,11 +25,14 @@ export interface LanguageModelExpected

| Property | Type | Description |
| --- | --- | --- |
| [languages](./ai.languagemodelexpected.md#languagemodelexpectedlanguages) | string\[\] | |
| [type](./ai.languagemodelexpected.md#languagemodelexpectedtype) | [LanguageModelMessageType](./ai.md#languagemodelmessagetype) | |
| [languages](./ai.languagemodelexpected.md#languagemodelexpectedlanguages) | string\[\] | <b><i>(Public Preview)</i></b> |
| [type](./ai.languagemodelexpected.md#languagemodelexpectedtype) | [LanguageModelMessageType](./ai.md#languagemodelmessagetype) | <b><i>(Public Preview)</i></b> |

## LanguageModelExpected.languages

> 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.
>

<b>Signature:</b>

```typescript
Expand All @@ -35,6 +41,9 @@ languages?: string[];

## LanguageModelExpected.type

> 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.
>

<b>Signature:</b>

```typescript
Expand Down
Loading
Loading