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
6 changes: 0 additions & 6 deletions .changeset/feat-prefer-in-cloud.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/heavy-teachers-enjoy.md

This file was deleted.

9 changes: 9 additions & 0 deletions .changeset/lazy-donuts-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'firebase': minor
'@firebase/ai': minor
---

Added a `sendFunctionResponses` method to `LiveSession`, allowing function responses to be sent during realtime sessions.
Fixed an issue where function responses during audio conversations caused the WebSocket connection to close. See [GitHub Issue #9264](https://github.com/firebase/firebase-js-sdk/issues/9264).
- **Breaking Change**: Changed the `functionCallingHandler` property in `StartAudioConversationOptions` so that it now must return a `Promise<FunctionResponse>`.
This breaking change is allowed in a minor release since the Live API is in Public Preview.
7 changes: 0 additions & 7 deletions .changeset/lemon-baboons-lick.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/lucky-socks-roll.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/poor-cobras-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/ai': patch
---

Updated SDK to handle empty parts when streaming.
6 changes: 6 additions & 0 deletions .changeset/poor-rings-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'firebase': minor
'@firebase/ai': minor
---

Added support for the URL context tool, which allows the model to access content from provided public web URLs to inform and enhance its responses.
5 changes: 0 additions & 5 deletions .changeset/selfish-elephants-sniff.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/tender-meals-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/ai': patch
---

Tag code execution with beta tag (public preview).
5 changes: 0 additions & 5 deletions .changeset/tiny-doors-talk.md

This file was deleted.

6 changes: 6 additions & 0 deletions .changeset/young-timers-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@firebase/analytics-interop-types': patch
'@firebase/analytics': patch
---

Expose `setUserProperties` on internal Analytics instance.
69 changes: 58 additions & 11 deletions common/api-review/ai.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ export interface CitationMetadata {
citations: Citation[];
}

// @public
// @beta
export interface CodeExecutionResult {
outcome?: Outcome;
output?: string;
}

// @public
// @beta
export interface CodeExecutionResultPart {
// (undocumented)
codeExecutionResult?: CodeExecutionResult;
Expand All @@ -203,7 +203,7 @@ export interface CodeExecutionResultPart {
thoughtSignature?: never;
}

// @public
// @beta
export interface CodeExecutionTool {
codeExecution: {};
}
Expand Down Expand Up @@ -271,13 +271,13 @@ export interface ErrorDetails {
reason?: string;
}

// @public
// @beta
export interface ExecutableCode {
code?: string;
language?: Language;
}

// @public
// @beta
export interface ExecutableCodePart {
// (undocumented)
codeExecutionResult?: never;
Expand Down Expand Up @@ -449,6 +449,10 @@ export interface GenerateContentCandidate {
index: number;
// (undocumented)
safetyRatings?: SafetyRating[];
// Warning: (ae-incompatible-release-tags) The symbol "urlContextMetadata" is marked as @public, but its signature references "URLContextMetadata" which is marked as @beta
//
// (undocumented)
urlContextMetadata?: URLContextMetadata;
}

// @public
Expand Down Expand Up @@ -600,6 +604,8 @@ export interface GoogleAIGenerateContentCandidate {
index: number;
// (undocumented)
safetyRatings?: SafetyRating[];
// (undocumented)
urlContextMetadata?: URLContextMetadata;
}

// Warning: (ae-internal-missing-underscore) The name "GoogleAIGenerateContentResponse" should be prefixed with an underscore because the declaration is marked as @internal
Expand Down Expand Up @@ -836,13 +842,13 @@ export class IntegerSchema extends Schema {
constructor(schemaParams?: SchemaParams);
}

// @public
// @beta
export const Language: {
UNSPECIFIED: string;
PYTHON: string;
};

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

// @beta
Expand Down Expand Up @@ -988,6 +994,7 @@ export class LiveSession {
isClosed: boolean;
receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
}
Expand Down Expand Up @@ -1058,17 +1065,20 @@ export interface OnDeviceParams {
promptOptions?: LanguageModelPromptOptions;
}

// @public
// @beta
export const Outcome: {
UNSPECIFIED: string;
OK: string;
FAILED: string;
DEADLINE_EXCEEDED: string;
};

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

// Warning: (ae-incompatible-release-tags) The symbol "Part" is marked as @public, but its signature references "ExecutableCodePart" which is marked as @beta
// Warning: (ae-incompatible-release-tags) The symbol "Part" is marked as @public, but its signature references "CodeExecutionResultPart" which is marked as @beta
//
// @public
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;

Expand Down Expand Up @@ -1254,7 +1264,7 @@ export function startAudioConversation(liveSession: LiveSession, options?: Start

// @beta
export interface StartAudioConversationOptions {
functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
}

// @public
Expand Down Expand Up @@ -1304,8 +1314,11 @@ export interface ThinkingConfig {
thinkingBudget?: number;
}

// Warning: (ae-incompatible-release-tags) The symbol "Tool" is marked as @public, but its signature references "CodeExecutionTool" which is marked as @beta
// Warning: (ae-incompatible-release-tags) The symbol "Tool" is marked as @public, but its signature references "URLContextTool" which is marked as @beta
//
// @public
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;

// @public
export interface ToolConfig {
Expand All @@ -1316,6 +1329,38 @@ export interface ToolConfig {
// @public
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;

// @beta
export interface URLContext {
}

// @beta
export interface URLContextMetadata {
urlMetadata: URLMetadata[];
}

// @beta
export interface URLContextTool {
urlContext: URLContext;
}

// @beta
export interface URLMetadata {
retrievedUrl?: string;
urlRetrievalStatus?: URLRetrievalStatus;
}

// @beta
export const URLRetrievalStatus: {
URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
URL_RETRIEVAL_STATUS_SUCCESS: string;
URL_RETRIEVAL_STATUS_ERROR: string;
URL_RETRIEVAL_STATUS_PAYWALL: string;
URL_RETRIEVAL_STATUS_UNSAFE: string;
};

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

// @public
export interface UsageMetadata {
// (undocumented)
Expand All @@ -1327,6 +1372,8 @@ export interface UsageMetadata {
// (undocumented)
promptTokensDetails?: ModalityTokenCount[];
thoughtsTokenCount?: number;
toolUsePromptTokenCount?: number;
toolUsePromptTokensDetails?: ModalityTokenCount[];
// (undocumented)
totalTokenCount: number;
}
Expand Down
8 changes: 8 additions & 0 deletions docs-devsite/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ toc:
path: /docs/reference/js/ai.thinkingconfig.md
- title: ToolConfig
path: /docs/reference/js/ai.toolconfig.md
- title: URLContext
path: /docs/reference/js/ai.urlcontext.md
- title: URLContextMetadata
path: /docs/reference/js/ai.urlcontextmetadata.md
- title: URLContextTool
path: /docs/reference/js/ai.urlcontexttool.md
- title: URLMetadata
path: /docs/reference/js/ai.urlmetadata.md
- title: UsageMetadata
path: /docs/reference/js/ai.usagemetadata.md
- title: VertexAIBackend
Expand Down
13 changes: 11 additions & 2 deletions docs-devsite/ai.codeexecutionresult.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk
{% endcomment %}

# CodeExecutionResult interface
> 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.
>

The results of code execution run by the model.

<b>Signature:</b>
Expand All @@ -22,11 +25,14 @@ export interface CodeExecutionResult

| Property | Type | Description |
| --- | --- | --- |
| [outcome](./ai.codeexecutionresult.md#codeexecutionresultoutcome) | [Outcome](./ai.md#outcome) | The result of the code execution. |
| [output](./ai.codeexecutionresult.md#codeexecutionresultoutput) | string | The output from the code execution, or an error message if it failed. |
| [outcome](./ai.codeexecutionresult.md#codeexecutionresultoutcome) | [Outcome](./ai.md#outcome) | <b><i>(Public Preview)</i></b> The result of the code execution. |
| [output](./ai.codeexecutionresult.md#codeexecutionresultoutput) | string | <b><i>(Public Preview)</i></b> The output from the code execution, or an error message if it failed. |

## CodeExecutionResult.outcome

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

The result of the code execution.

<b>Signature:</b>
Expand All @@ -37,6 +43,9 @@ outcome?: Outcome;

## CodeExecutionResult.output

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

The output from the code execution, or an error message if it failed.

<b>Signature:</b>
Expand Down
Loading
Loading