Skip to content

Commit 15fc1a7

Browse files
committed
Merge branch 'main' of github.com:firebase/firebase-js-sdk into markduckworth/ppl-node-backport
2 parents 9695fa4 + ccbf7ba commit 15fc1a7

37 files changed

+967
-103
lines changed

.changeset/lazy-donuts-agree.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'firebase': minor
3+
'@firebase/ai': minor
4+
---
5+
6+
Added a `sendFunctionResponses` method to `LiveSession`, allowing function responses to be sent during realtime sessions.
7+
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).
8+
- **Breaking Change**: Changed the `functionCallingHandler` property in `StartAudioConversationOptions` so that it now must return a `Promise<FunctionResponse>`.
9+
This breaking change is allowed in a minor release since the Live API is in Public Preview.

.changeset/poor-cobras-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/ai': patch
3+
---
4+
5+
Updated SDK to handle empty parts when streaming.

.changeset/poor-rings-admire.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'firebase': minor
3+
'@firebase/ai': minor
4+
---
5+
6+
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.

.changeset/tender-meals-clap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/ai': patch
3+
---
4+
5+
Tag code execution with beta tag (public preview).

common/api-review/ai.api.md

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ export interface CitationMetadata {
175175
citations: Citation[];
176176
}
177177

178-
// @public
178+
// @beta
179179
export interface CodeExecutionResult {
180180
outcome?: Outcome;
181181
output?: string;
182182
}
183183

184-
// @public
184+
// @beta
185185
export interface CodeExecutionResultPart {
186186
// (undocumented)
187187
codeExecutionResult?: CodeExecutionResult;
@@ -203,7 +203,7 @@ export interface CodeExecutionResultPart {
203203
thoughtSignature?: never;
204204
}
205205

206-
// @public
206+
// @beta
207207
export interface CodeExecutionTool {
208208
codeExecution: {};
209209
}
@@ -271,13 +271,13 @@ export interface ErrorDetails {
271271
reason?: string;
272272
}
273273

274-
// @public
274+
// @beta
275275
export interface ExecutableCode {
276276
code?: string;
277277
language?: Language;
278278
}
279279

280-
// @public
280+
// @beta
281281
export interface ExecutableCodePart {
282282
// (undocumented)
283283
codeExecutionResult?: never;
@@ -449,6 +449,10 @@ export interface GenerateContentCandidate {
449449
index: number;
450450
// (undocumented)
451451
safetyRatings?: SafetyRating[];
452+
// Warning: (ae-incompatible-release-tags) The symbol "urlContextMetadata" is marked as @public, but its signature references "URLContextMetadata" which is marked as @beta
453+
//
454+
// (undocumented)
455+
urlContextMetadata?: URLContextMetadata;
452456
}
453457

454458
// @public
@@ -600,6 +604,8 @@ export interface GoogleAIGenerateContentCandidate {
600604
index: number;
601605
// (undocumented)
602606
safetyRatings?: SafetyRating[];
607+
// (undocumented)
608+
urlContextMetadata?: URLContextMetadata;
603609
}
604610

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

839-
// @public
845+
// @beta
840846
export const Language: {
841847
UNSPECIFIED: string;
842848
PYTHON: string;
843849
};
844850

845-
// @public
851+
// @beta
846852
export type Language = (typeof Language)[keyof typeof Language];
847853

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

1061-
// @public
1068+
// @beta
10621069
export const Outcome: {
10631070
UNSPECIFIED: string;
10641071
OK: string;
10651072
FAILED: string;
10661073
DEADLINE_EXCEEDED: string;
10671074
};
10681075

1069-
// @public
1076+
// @beta
10701077
export type Outcome = (typeof Outcome)[keyof typeof Outcome];
10711078

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

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

12551265
// @beta
12561266
export interface StartAudioConversationOptions {
1257-
functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
1267+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
12581268
}
12591269

12601270
// @public
@@ -1304,8 +1314,11 @@ export interface ThinkingConfig {
13041314
thinkingBudget?: number;
13051315
}
13061316

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

13101323
// @public
13111324
export interface ToolConfig {
@@ -1316,6 +1329,38 @@ export interface ToolConfig {
13161329
// @public
13171330
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
13181331

1332+
// @beta
1333+
export interface URLContext {
1334+
}
1335+
1336+
// @beta
1337+
export interface URLContextMetadata {
1338+
urlMetadata: URLMetadata[];
1339+
}
1340+
1341+
// @beta
1342+
export interface URLContextTool {
1343+
urlContext: URLContext;
1344+
}
1345+
1346+
// @beta
1347+
export interface URLMetadata {
1348+
retrievedUrl?: string;
1349+
urlRetrievalStatus?: URLRetrievalStatus;
1350+
}
1351+
1352+
// @beta
1353+
export const URLRetrievalStatus: {
1354+
URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
1355+
URL_RETRIEVAL_STATUS_SUCCESS: string;
1356+
URL_RETRIEVAL_STATUS_ERROR: string;
1357+
URL_RETRIEVAL_STATUS_PAYWALL: string;
1358+
URL_RETRIEVAL_STATUS_UNSAFE: string;
1359+
};
1360+
1361+
// @beta
1362+
export type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
1363+
13191364
// @public
13201365
export interface UsageMetadata {
13211366
// (undocumented)
@@ -1327,6 +1372,8 @@ export interface UsageMetadata {
13271372
// (undocumented)
13281373
promptTokensDetails?: ModalityTokenCount[];
13291374
thoughtsTokenCount?: number;
1375+
toolUsePromptTokenCount?: number;
1376+
toolUsePromptTokensDetails?: ModalityTokenCount[];
13301377
// (undocumented)
13311378
totalTokenCount: number;
13321379
}

docs-devsite/_toc.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ toc:
202202
path: /docs/reference/js/ai.thinkingconfig.md
203203
- title: ToolConfig
204204
path: /docs/reference/js/ai.toolconfig.md
205+
- title: URLContext
206+
path: /docs/reference/js/ai.urlcontext.md
207+
- title: URLContextMetadata
208+
path: /docs/reference/js/ai.urlcontextmetadata.md
209+
- title: URLContextTool
210+
path: /docs/reference/js/ai.urlcontexttool.md
211+
- title: URLMetadata
212+
path: /docs/reference/js/ai.urlmetadata.md
205213
- title: UsageMetadata
206214
path: /docs/reference/js/ai.usagemetadata.md
207215
- title: VertexAIBackend

docs-devsite/ai.codeexecutionresult.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# CodeExecutionResult interface
13+
> 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.
14+
>
15+
1316
The results of code execution run by the model.
1417

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

2326
| Property | Type | Description |
2427
| --- | --- | --- |
25-
| [outcome](./ai.codeexecutionresult.md#codeexecutionresultoutcome) | [Outcome](./ai.md#outcome) | The result of the code execution. |
26-
| [output](./ai.codeexecutionresult.md#codeexecutionresultoutput) | string | The output from the code execution, or an error message if it failed. |
28+
| [outcome](./ai.codeexecutionresult.md#codeexecutionresultoutcome) | [Outcome](./ai.md#outcome) | <b><i>(Public Preview)</i></b> The result of the code execution. |
29+
| [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. |
2730

2831
## CodeExecutionResult.outcome
2932

33+
> 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.
34+
>
35+
3036
The result of the code execution.
3137

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

3844
## CodeExecutionResult.output
3945

46+
> 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.
47+
>
48+
4049
The output from the code execution, or an error message if it failed.
4150

4251
<b>Signature:</b>

docs-devsite/ai.codeexecutionresultpart.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# CodeExecutionResultPart interface
13+
> 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.
14+
>
15+
1316
Represents the code execution result from the model.
1417

1518
<b>Signature:</b>
@@ -22,17 +25,20 @@ export interface CodeExecutionResultPart
2225

2326
| Property | Type | Description |
2427
| --- | --- | --- |
25-
| [codeExecutionResult](./ai.codeexecutionresultpart.md#codeexecutionresultpartcodeexecutionresult) | [CodeExecutionResult](./ai.codeexecutionresult.md#codeexecutionresult_interface) | |
26-
| [executableCode](./ai.codeexecutionresultpart.md#codeexecutionresultpartexecutablecode) | never | |
27-
| [fileData](./ai.codeexecutionresultpart.md#codeexecutionresultpartfiledata) | never | |
28-
| [functionCall](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctioncall) | never | |
29-
| [functionResponse](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctionresponse) | never | |
30-
| [inlineData](./ai.codeexecutionresultpart.md#codeexecutionresultpartinlinedata) | never | |
31-
| [text](./ai.codeexecutionresultpart.md#codeexecutionresultparttext) | never | |
32-
| [thought](./ai.codeexecutionresultpart.md#codeexecutionresultpartthought) | never | |
28+
| [codeExecutionResult](./ai.codeexecutionresultpart.md#codeexecutionresultpartcodeexecutionresult) | [CodeExecutionResult](./ai.codeexecutionresult.md#codeexecutionresult_interface) | <b><i>(Public Preview)</i></b> |
29+
| [executableCode](./ai.codeexecutionresultpart.md#codeexecutionresultpartexecutablecode) | never | <b><i>(Public Preview)</i></b> |
30+
| [fileData](./ai.codeexecutionresultpart.md#codeexecutionresultpartfiledata) | never | <b><i>(Public Preview)</i></b> |
31+
| [functionCall](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctioncall) | never | <b><i>(Public Preview)</i></b> |
32+
| [functionResponse](./ai.codeexecutionresultpart.md#codeexecutionresultpartfunctionresponse) | never | <b><i>(Public Preview)</i></b> |
33+
| [inlineData](./ai.codeexecutionresultpart.md#codeexecutionresultpartinlinedata) | never | <b><i>(Public Preview)</i></b> |
34+
| [text](./ai.codeexecutionresultpart.md#codeexecutionresultparttext) | never | <b><i>(Public Preview)</i></b> |
35+
| [thought](./ai.codeexecutionresultpart.md#codeexecutionresultpartthought) | never | <b><i>(Public Preview)</i></b> |
3336

3437
## CodeExecutionResultPart.codeExecutionResult
3538

39+
> 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.
40+
>
41+
3642
<b>Signature:</b>
3743

3844
```typescript
@@ -41,6 +47,9 @@ codeExecutionResult?: CodeExecutionResult;
4147

4248
## CodeExecutionResultPart.executableCode
4349

50+
> 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.
51+
>
52+
4453
<b>Signature:</b>
4554

4655
```typescript
@@ -49,6 +58,9 @@ executableCode?: never;
4958

5059
## CodeExecutionResultPart.fileData
5160

61+
> 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.
62+
>
63+
5264
<b>Signature:</b>
5365

5466
```typescript
@@ -57,6 +69,9 @@ fileData: never;
5769

5870
## CodeExecutionResultPart.functionCall
5971

72+
> 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.
73+
>
74+
6075
<b>Signature:</b>
6176

6277
```typescript
@@ -65,6 +80,9 @@ functionCall?: never;
6580

6681
## CodeExecutionResultPart.functionResponse
6782

83+
> 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.
84+
>
85+
6886
<b>Signature:</b>
6987

7088
```typescript
@@ -73,6 +91,9 @@ functionResponse?: never;
7391

7492
## CodeExecutionResultPart.inlineData
7593

94+
> 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.
95+
>
96+
7697
<b>Signature:</b>
7798

7899
```typescript
@@ -81,6 +102,9 @@ inlineData?: never;
81102

82103
## CodeExecutionResultPart.text
83104

105+
> 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.
106+
>
107+
84108
<b>Signature:</b>
85109

86110
```typescript
@@ -89,6 +113,9 @@ text?: never;
89113

90114
## CodeExecutionResultPart.thought
91115

116+
> 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.
117+
>
118+
92119
<b>Signature:</b>
93120

94121
```typescript

docs-devsite/ai.codeexecutiontool.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# CodeExecutionTool interface
13+
> 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.
14+
>
15+
1316
A tool that enables the model to use code execution.
1417

1518
<b>Signature:</b>
@@ -22,10 +25,13 @@ export interface CodeExecutionTool
2225

2326
| Property | Type | Description |
2427
| --- | --- | --- |
25-
| [codeExecution](./ai.codeexecutiontool.md#codeexecutiontoolcodeexecution) | {} | Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. |
28+
| [codeExecution](./ai.codeexecutiontool.md#codeexecutiontoolcodeexecution) | {} | <b><i>(Public Preview)</i></b> Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options. |
2629

2730
## CodeExecutionTool.codeExecution
2831

32+
> 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.
33+
>
34+
2935
Specifies the Google Search configuration. Currently, this is an empty object, but it's reserved for future configuration options.
3036

3137
<b>Signature:</b>

0 commit comments

Comments
 (0)