Skip to content

Commit 34c5750

Browse files
author
Athira M
committed
Merge branch 'main' into web-experiment
2 parents dc45a19 + 8209266 commit 34c5750

File tree

105 files changed

+1798
-427
lines changed

Some content is hidden

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

105 files changed

+1798
-427
lines changed

.changeset/angry-apples-think.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/auth': patch
3+
---
4+
5+
Expose `browserCookiePersistence` beta feature in public typings.

.changeset/dull-ligers-bow.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'firebase': minor
3+
'@firebase/ai': minor
4+
---
5+
6+
Deprecate `sendMediaChunks()` and `sendMediaStream()`. Instead, use the new methods added to the `LiveSession` class.
7+
Add `sendTextRealtime()`, `sendAudioReatime()`, and `sendVideoRealtime()` to the `LiveSession` class.

.changeset/metal-lies-compete.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/auth': patch
3+
'firebase': patch
4+
---
5+
6+
Export MISSING_PASSWORD via AuthErrorCodes in @firebase/auth.

.changeset/rare-hats-know.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+
Fix logic for merging default `onDeviceParams` with user-provided `onDeviceParams`.

.changeset/smooth-parrots-speak.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/ai': minor
3+
'firebase': minor
4+
---
5+
6+
Add `inferenceSource` to the response from `generateContent` and `generateContentStream`. This property indicates whether on-device or in-cloud inference was used to generate the result.

.changeset/young-timers-jump.md

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

common/api-review/ai.api.md

Lines changed: 89 additions & 26 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
}
@@ -256,6 +256,8 @@ export { Date_2 as Date }
256256
// @public
257257
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
258258
functionCalls: () => FunctionCall[] | undefined;
259+
// @beta
260+
inferenceSource?: InferenceSource;
259261
inlineDataParts: () => InlineDataPart[] | undefined;
260262
text: () => string;
261263
thoughtSummary: () => string | undefined;
@@ -271,13 +273,13 @@ export interface ErrorDetails {
271273
reason?: string;
272274
}
273275

274-
// @public
276+
// @beta
275277
export interface ExecutableCode {
276278
code?: string;
277279
language?: Language;
278280
}
279281

280-
// @public
282+
// @beta
281283
export interface ExecutableCodePart {
282284
// (undocumented)
283285
codeExecutionResult?: never;
@@ -449,6 +451,10 @@ export interface GenerateContentCandidate {
449451
index: number;
450452
// (undocumented)
451453
safetyRatings?: SafetyRating[];
454+
// Warning: (ae-incompatible-release-tags) The symbol "urlContextMetadata" is marked as @public, but its signature references "URLContextMetadata" which is marked as @beta
455+
//
456+
// (undocumented)
457+
urlContextMetadata?: URLContextMetadata;
452458
}
453459

454460
// @public
@@ -549,7 +555,7 @@ export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
549555
// @public
550556
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;
551557

552-
// @beta
558+
// @public
553559
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
554560

555561
// @beta
@@ -600,6 +606,8 @@ export interface GoogleAIGenerateContentCandidate {
600606
index: number;
601607
// (undocumented)
602608
safetyRatings?: SafetyRating[];
609+
// (undocumented)
610+
urlContextMetadata?: URLContextMetadata;
603611
}
604612

605613
// Warning: (ae-internal-missing-underscore) The name "GoogleAIGenerateContentResponse" should be prefixed with an underscore because the declaration is marked as @internal
@@ -706,7 +714,7 @@ export interface HybridParams {
706714
onDeviceParams?: OnDeviceParams;
707715
}
708716

709-
// @beta
717+
// @public
710718
export const ImagenAspectRatio: {
711719
readonly SQUARE: "1:1";
712720
readonly LANDSCAPE_3x4: "3:4";
@@ -715,16 +723,16 @@ export const ImagenAspectRatio: {
715723
readonly PORTRAIT_9x16: "9:16";
716724
};
717725

718-
// @beta
726+
// @public
719727
export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
720728

721-
// @beta
729+
// @public
722730
export interface ImagenGCSImage {
723731
gcsURI: string;
724732
mimeType: string;
725733
}
726734

727-
// @beta
735+
// @public
728736
export interface ImagenGenerationConfig {
729737
addWatermark?: boolean;
730738
aspectRatio?: ImagenAspectRatio;
@@ -733,27 +741,27 @@ export interface ImagenGenerationConfig {
733741
numberOfImages?: number;
734742
}
735743

736-
// @beta
744+
// @public
737745
export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
738746
filteredReason?: string;
739747
images: T[];
740748
}
741749

742-
// @beta
750+
// @public
743751
export class ImagenImageFormat {
744752
compressionQuality?: number;
745753
static jpeg(compressionQuality?: number): ImagenImageFormat;
746754
mimeType: string;
747755
static png(): ImagenImageFormat;
748756
}
749757

750-
// @beta
758+
// @public
751759
export interface ImagenInlineImage {
752760
bytesBase64Encoded: string;
753761
mimeType: string;
754762
}
755763

756-
// @beta
764+
// @public
757765
export class ImagenModel extends AIModel {
758766
constructor(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions | undefined);
759767
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
@@ -765,35 +773,35 @@ export class ImagenModel extends AIModel {
765773
safetySettings?: ImagenSafetySettings;
766774
}
767775

768-
// @beta
776+
// @public
769777
export interface ImagenModelParams {
770778
generationConfig?: ImagenGenerationConfig;
771779
model: string;
772780
safetySettings?: ImagenSafetySettings;
773781
}
774782

775-
// @beta
783+
// @public
776784
export const ImagenPersonFilterLevel: {
777785
readonly BLOCK_ALL: "dont_allow";
778786
readonly ALLOW_ADULT: "allow_adult";
779787
readonly ALLOW_ALL: "allow_all";
780788
};
781789

782-
// @beta
790+
// @public
783791
export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
784792

785-
// @beta
793+
// @public
786794
export const ImagenSafetyFilterLevel: {
787795
readonly BLOCK_LOW_AND_ABOVE: "block_low_and_above";
788796
readonly BLOCK_MEDIUM_AND_ABOVE: "block_medium_and_above";
789797
readonly BLOCK_ONLY_HIGH: "block_only_high";
790798
readonly BLOCK_NONE: "block_none";
791799
};
792800

793-
// @beta
801+
// @public
794802
export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
795803

796-
// @beta
804+
// @public
797805
export interface ImagenSafetySettings {
798806
personFilterLevel?: ImagenPersonFilterLevel;
799807
safetyFilterLevel?: ImagenSafetyFilterLevel;
@@ -810,6 +818,15 @@ export const InferenceMode: {
810818
// @beta
811819
export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
812820

821+
// @beta
822+
export const InferenceSource: {
823+
readonly ON_DEVICE: "on_device";
824+
readonly IN_CLOUD: "in_cloud";
825+
};
826+
827+
// @beta
828+
export type InferenceSource = (typeof InferenceSource)[keyof typeof InferenceSource];
829+
813830
// @public
814831
export interface InlineDataPart {
815832
// (undocumented)
@@ -836,13 +853,13 @@ export class IntegerSchema extends Schema {
836853
constructor(schemaParams?: SchemaParams);
837854
}
838855

839-
// @public
856+
// @beta
840857
export const Language: {
841858
UNSPECIFIED: string;
842859
PYTHON: string;
843860
};
844861

845-
// @public
862+
// @beta
846863
export type Language = (typeof Language)[keyof typeof Language];
847864

848865
// @beta
@@ -988,8 +1005,14 @@ export class LiveSession {
9881005
isClosed: boolean;
9891006
receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
9901007
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
1008+
sendAudioRealtime(blob: GenerativeContentBlob): Promise<void>;
1009+
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
1010+
// @deprecated
9911011
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
1012+
// @deprecated (undocumented)
9921013
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
1014+
sendTextRealtime(text: string): Promise<void>;
1015+
sendVideoRealtime(blob: GenerativeContentBlob): Promise<void>;
9931016
}
9941017

9951018
// @public
@@ -1058,17 +1081,20 @@ export interface OnDeviceParams {
10581081
promptOptions?: LanguageModelPromptOptions;
10591082
}
10601083

1061-
// @public
1084+
// @beta
10621085
export const Outcome: {
10631086
UNSPECIFIED: string;
10641087
OK: string;
10651088
FAILED: string;
10661089
DEADLINE_EXCEEDED: string;
10671090
};
10681091

1069-
// @public
1092+
// @beta
10701093
export type Outcome = (typeof Outcome)[keyof typeof Outcome];
10711094

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

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

12551281
// @beta
12561282
export interface StartAudioConversationOptions {
1257-
functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
1283+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
12581284
}
12591285

12601286
// @public
@@ -1304,8 +1330,11 @@ export interface ThinkingConfig {
13041330
thinkingBudget?: number;
13051331
}
13061332

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

13101339
// @public
13111340
export interface ToolConfig {
@@ -1316,6 +1345,38 @@ export interface ToolConfig {
13161345
// @public
13171346
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
13181347

1348+
// @beta
1349+
export interface URLContext {
1350+
}
1351+
1352+
// @beta
1353+
export interface URLContextMetadata {
1354+
urlMetadata: URLMetadata[];
1355+
}
1356+
1357+
// @beta
1358+
export interface URLContextTool {
1359+
urlContext: URLContext;
1360+
}
1361+
1362+
// @beta
1363+
export interface URLMetadata {
1364+
retrievedUrl?: string;
1365+
urlRetrievalStatus?: URLRetrievalStatus;
1366+
}
1367+
1368+
// @beta
1369+
export const URLRetrievalStatus: {
1370+
URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
1371+
URL_RETRIEVAL_STATUS_SUCCESS: string;
1372+
URL_RETRIEVAL_STATUS_ERROR: string;
1373+
URL_RETRIEVAL_STATUS_PAYWALL: string;
1374+
URL_RETRIEVAL_STATUS_UNSAFE: string;
1375+
};
1376+
1377+
// @beta
1378+
export type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
1379+
13191380
// @public
13201381
export interface UsageMetadata {
13211382
// (undocumented)
@@ -1327,6 +1388,8 @@ export interface UsageMetadata {
13271388
// (undocumented)
13281389
promptTokensDetails?: ModalityTokenCount[];
13291390
thoughtsTokenCount?: number;
1391+
toolUsePromptTokenCount?: number;
1392+
toolUsePromptTokensDetails?: ModalityTokenCount[];
13301393
// (undocumented)
13311394
totalTokenCount: number;
13321395
}

common/api-review/auth.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export const AuthErrorCodes: {
195195
readonly MISSING_MFA_INFO: "auth/missing-multi-factor-info";
196196
readonly MISSING_MFA_SESSION: "auth/missing-multi-factor-session";
197197
readonly MISSING_PHONE_NUMBER: "auth/missing-phone-number";
198+
readonly MISSING_PASSWORD: "auth/missing-password";
198199
readonly MISSING_SESSION_INFO: "auth/missing-verification-id";
199200
readonly MODULE_DESTROYED: "auth/app-deleted";
200201
readonly NEED_CONFIRMATION: "auth/account-exists-with-different-credential";

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

0 commit comments

Comments
 (0)