Skip to content

Commit 582ca6b

Browse files
committed
Merge branch 'main' into dl/googleai-ga
2 parents 310f849 + ccbf7ba commit 582ca6b

File tree

102 files changed

+1361
-291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1361
-291
lines changed

.changeset/feat-prefer-in-cloud.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/heavy-teachers-enjoy.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.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/lemon-baboons-lick.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/lucky-socks-roll.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

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

.changeset/young-timers-jump.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/analytics-interop-types': patch
3+
'@firebase/analytics': patch
4+
---
5+
6+
Expose `setUserProperties` on internal Analytics instance.

common/api-review/ai.api.md

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export class BooleanSchema extends Schema {
133133

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

148-
// @public
149+
// @beta
149150
export interface ChromeAdapter {
150151
// @internal (undocumented)
151152
countTokens(request: CountTokensRequest): Promise<Response>;
@@ -174,13 +175,13 @@ export interface CitationMetadata {
174175
citations: Citation[];
175176
}
176177

177-
// @public
178+
// @beta
178179
export interface CodeExecutionResult {
179180
outcome?: Outcome;
180181
output?: string;
181182
}
182183

183-
// @public
184+
// @beta
184185
export interface CodeExecutionResultPart {
185186
// (undocumented)
186187
codeExecutionResult?: CodeExecutionResult;
@@ -202,7 +203,7 @@ export interface CodeExecutionResultPart {
202203
thoughtSignature?: never;
203204
}
204205

205-
// @public
206+
// @beta
206207
export interface CodeExecutionTool {
207208
codeExecution: {};
208209
}
@@ -270,13 +271,13 @@ export interface ErrorDetails {
270271
reason?: string;
271272
}
272273

273-
// @public
274+
// @beta
274275
export interface ExecutableCode {
275276
code?: string;
276277
language?: Language;
277278
}
278279

279-
// @public
280+
// @beta
280281
export interface ExecutableCodePart {
281282
// (undocumented)
282283
codeExecutionResult?: never;
@@ -448,6 +449,10 @@ export interface GenerateContentCandidate {
448449
index: number;
449450
// (undocumented)
450451
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;
451456
}
452457

453458
// @public
@@ -520,6 +525,7 @@ export interface GenerativeContentBlob {
520525

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

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

@@ -596,6 +604,8 @@ export interface GoogleAIGenerateContentCandidate {
596604
index: number;
597605
// (undocumented)
598606
safetyRatings?: SafetyRating[];
607+
// (undocumented)
608+
urlContextMetadata?: URLContextMetadata;
599609
}
600610

601611
// Warning: (ae-internal-missing-underscore) The name "GoogleAIGenerateContentResponse" should be prefixed with an underscore because the declaration is marked as @internal
@@ -695,7 +705,7 @@ export const HarmSeverity: {
695705
// @public
696706
export type HarmSeverity = (typeof HarmSeverity)[keyof typeof HarmSeverity];
697707

698-
// @public
708+
// @beta
699709
export interface HybridParams {
700710
inCloudParams?: ModelParams;
701711
mode: InferenceMode;
@@ -795,15 +805,15 @@ export interface ImagenSafetySettings {
795805
safetyFilterLevel?: ImagenSafetyFilterLevel;
796806
}
797807

798-
// @public
808+
// @beta
799809
export const InferenceMode: {
800810
readonly PREFER_ON_DEVICE: "prefer_on_device";
801811
readonly ONLY_ON_DEVICE: "only_on_device";
802812
readonly ONLY_IN_CLOUD: "only_in_cloud";
803813
readonly PREFER_IN_CLOUD: "prefer_in_cloud";
804814
};
805815

806-
// @public
816+
// @beta
807817
export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
808818

809819
// @public
@@ -832,16 +842,16 @@ export class IntegerSchema extends Schema {
832842
constructor(schemaParams?: SchemaParams);
833843
}
834844

835-
// @public
845+
// @beta
836846
export const Language: {
837847
UNSPECIFIED: string;
838848
PYTHON: string;
839849
};
840850

841-
// @public
851+
// @beta
842852
export type Language = (typeof Language)[keyof typeof Language];
843853

844-
// @public
854+
// @beta
845855
export interface LanguageModelCreateCoreOptions {
846856
// (undocumented)
847857
expectedInputs?: LanguageModelExpected[];
@@ -851,48 +861,48 @@ export interface LanguageModelCreateCoreOptions {
851861
topK?: number;
852862
}
853863

854-
// @public
864+
// @beta
855865
export interface LanguageModelCreateOptions extends LanguageModelCreateCoreOptions {
856866
// (undocumented)
857867
initialPrompts?: LanguageModelMessage[];
858868
// (undocumented)
859869
signal?: AbortSignal;
860870
}
861871

862-
// @public
872+
// @beta
863873
export interface LanguageModelExpected {
864874
// (undocumented)
865875
languages?: string[];
866876
// (undocumented)
867877
type: LanguageModelMessageType;
868878
}
869879

870-
// @public
880+
// @beta
871881
export interface LanguageModelMessage {
872882
// (undocumented)
873883
content: LanguageModelMessageContent[];
874884
// (undocumented)
875885
role: LanguageModelMessageRole;
876886
}
877887

878-
// @public
888+
// @beta
879889
export interface LanguageModelMessageContent {
880890
// (undocumented)
881891
type: LanguageModelMessageType;
882892
// (undocumented)
883893
value: LanguageModelMessageContentValue;
884894
}
885895

886-
// @public
896+
// @beta
887897
export type LanguageModelMessageContentValue = ImageBitmapSource | AudioBuffer | BufferSource | string;
888898

889-
// @public
899+
// @beta
890900
export type LanguageModelMessageRole = 'system' | 'user' | 'assistant';
891901

892-
// @public
902+
// @beta
893903
export type LanguageModelMessageType = 'text' | 'image' | 'audio';
894904

895-
// @public
905+
// @beta
896906
export interface LanguageModelPromptOptions {
897907
// (undocumented)
898908
responseConstraint?: object;
@@ -984,6 +994,7 @@ export class LiveSession {
984994
isClosed: boolean;
985995
receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
986996
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
997+
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
987998
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
988999
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
9891000
}
@@ -1046,25 +1057,28 @@ export interface ObjectSchemaRequest extends SchemaRequest {
10461057
type: 'object';
10471058
}
10481059

1049-
// @public
1060+
// @beta
10501061
export interface OnDeviceParams {
10511062
// (undocumented)
10521063
createOptions?: LanguageModelCreateOptions;
10531064
// (undocumented)
10541065
promptOptions?: LanguageModelPromptOptions;
10551066
}
10561067

1057-
// @public
1068+
// @beta
10581069
export const Outcome: {
10591070
UNSPECIFIED: string;
10601071
OK: string;
10611072
FAILED: string;
10621073
DEADLINE_EXCEEDED: string;
10631074
};
10641075

1065-
// @public
1076+
// @beta
10661077
export type Outcome = (typeof Outcome)[keyof typeof Outcome];
10671078

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+
//
10681082
// @public
10691083
export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionResponsePart | FileDataPart | ExecutableCodePart | CodeExecutionResultPart;
10701084

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

12511265
// @beta
12521266
export interface StartAudioConversationOptions {
1253-
functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
1267+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
12541268
}
12551269

12561270
// @public
@@ -1300,8 +1314,11 @@ export interface ThinkingConfig {
13001314
thinkingBudget?: number;
13011315
}
13021316

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+
//
13031320
// @public
1304-
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
1321+
export type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;
13051322

13061323
// @public
13071324
export interface ToolConfig {
@@ -1312,6 +1329,38 @@ export interface ToolConfig {
13121329
// @public
13131330
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
13141331

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+
13151364
// @public
13161365
export interface UsageMetadata {
13171366
// (undocumented)
@@ -1323,6 +1372,8 @@ export interface UsageMetadata {
13231372
// (undocumented)
13241373
promptTokensDetails?: ModalityTokenCount[];
13251374
thoughtsTokenCount?: number;
1375+
toolUsePromptTokenCount?: number;
1376+
toolUsePromptTokensDetails?: ModalityTokenCount[];
13261377
// (undocumented)
13271378
totalTokenCount: number;
13281379
}

0 commit comments

Comments
 (0)