Skip to content

Commit 72b43d0

Browse files
Merge main into release
2 parents 44d8d74 + 984086b commit 72b43d0

File tree

83 files changed

+5202
-188
lines changed

Some content is hidden

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

83 files changed

+5202
-188
lines changed

.changeset/blue-pets-sin.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+
Add support for the Gemini Live API.

.changeset/brave-llamas-impress.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 `thoughtSummary()` convenience method to `EnhancedGenerateContentResponse`.

.changeset/calm-guests-pump.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+
Fixed an issue where `AIError` messages were too long after including an entire response body.

.changeset/good-cooks-deliver.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+
Add 'includeSafetyAttributes' field to Predict request payloads.

.changeset/nasty-rings-drop.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 App Check limited use token option to `getAI()`.

.changeset/spotty-bananas-fry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Fixed a bug where a rejected promise with an empty message in a transaction would cause a timeout.

.changeset/three-balloons-collect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/functions": patch
3+
---
4+
5+
Fixed issue where Firebase Functions SDK caused CORS errors when connected to emulators in Firebase Studio

.changeset/unlucky-goats-teach.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+
Exclude ChromeAdapterImpl code from Node entry point.

common/api-review/ai.api.md

Lines changed: 164 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,26 @@
44
55
```ts
66

7+
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
78
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
9+
import { ComponentContainer } from '@firebase/component';
810
import { FirebaseApp } from '@firebase/app';
11+
import { FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
12+
import { FirebaseAuthInternal } from '@firebase/auth-interop-types';
13+
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
914
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
1015
import { FirebaseError } from '@firebase/util';
16+
import { _FirebaseService } from '@firebase/app';
17+
import { InstanceFactoryOptions } from '@firebase/component';
18+
import { Provider } from '@firebase/component';
1119

1220
// @public
1321
export interface AI {
1422
app: FirebaseApp;
1523
backend: Backend;
1624
// @deprecated (undocumented)
1725
location: string;
26+
options?: AIOptions;
1827
}
1928

2029
// @public
@@ -32,6 +41,7 @@ export const AIErrorCode: {
3241
readonly REQUEST_ERROR: "request-error";
3342
readonly RESPONSE_ERROR: "response-error";
3443
readonly FETCH_ERROR: "fetch-error";
44+
readonly SESSION_CLOSED: "session-closed";
3545
readonly INVALID_CONTENT: "invalid-content";
3646
readonly API_NOT_ENABLED: "api-not-enabled";
3747
readonly INVALID_SCHEMA: "invalid-schema";
@@ -53,15 +63,16 @@ export abstract class AIModel {
5363
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
5464
//
5565
// @internal (undocumented)
56-
protected _apiSettings: ApiSettings;
66+
_apiSettings: ApiSettings;
5767
readonly model: string;
5868
// @internal
5969
static normalizeModelName(modelName: string, backendType: BackendType): string;
6070
}
6171

6272
// @public
6373
export interface AIOptions {
64-
backend: Backend;
74+
backend?: Backend;
75+
useLimitedUseAppCheckTokens?: boolean;
6576
}
6677

6778
// @public
@@ -84,6 +95,11 @@ export class ArraySchema extends Schema {
8495
toJSON(): SchemaRequest;
8596
}
8697

98+
// @beta
99+
export interface AudioConversationController {
100+
stop: () => Promise<void>;
101+
}
102+
87103
// @public
88104
export abstract class Backend {
89105
protected constructor(type: BackendType);
@@ -213,10 +229,10 @@ export { Date_2 as Date }
213229

214230
// @public
215231
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
216-
// (undocumented)
217232
functionCalls: () => FunctionCall[] | undefined;
218233
inlineDataParts: () => InlineDataPart[] | undefined;
219234
text: () => string;
235+
thoughtSummary: () => string | undefined;
220236
}
221237

222238
// @public
@@ -229,6 +245,11 @@ export interface ErrorDetails {
229245
reason?: string;
230246
}
231247

248+
// Warning: (ae-forgotten-export) The symbol "AIService" needs to be exported by the entry point index.d.ts
249+
//
250+
// @public (undocumented)
251+
export function factory(container: ComponentContainer, { instanceIdentifier }: InstanceFactoryOptions): AIService;
252+
232253
// @public
233254
export interface FileData {
234255
// (undocumented)
@@ -249,6 +270,10 @@ export interface FileDataPart {
249270
inlineData?: never;
250271
// (undocumented)
251272
text?: never;
273+
// (undocumented)
274+
thought?: boolean;
275+
// @internal (undocumented)
276+
thoughtSignature?: never;
252277
}
253278

254279
// @public
@@ -271,6 +296,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
271296
export interface FunctionCall {
272297
// (undocumented)
273298
args: object;
299+
id?: string;
274300
// (undocumented)
275301
name: string;
276302
}
@@ -303,6 +329,10 @@ export interface FunctionCallPart {
303329
inlineData?: never;
304330
// (undocumented)
305331
text?: never;
332+
// (undocumented)
333+
thought?: boolean;
334+
// @internal (undocumented)
335+
thoughtSignature?: never;
306336
}
307337

308338
// @public
@@ -319,6 +349,7 @@ export interface FunctionDeclarationsTool {
319349

320350
// @public
321351
export interface FunctionResponse {
352+
id?: string;
322353
// (undocumented)
323354
name: string;
324355
// (undocumented)
@@ -335,6 +366,10 @@ export interface FunctionResponsePart {
335366
inlineData?: never;
336367
// (undocumented)
337368
text?: never;
369+
// (undocumented)
370+
thought?: boolean;
371+
// @internal (undocumented)
372+
thoughtSignature?: never;
338373
}
339374

340375
// @public
@@ -453,6 +488,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridPara
453488
// @beta
454489
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
455490

491+
// @beta
492+
export function getLiveGenerativeModel(ai: AI, modelParams: LiveModelParams): LiveGenerativeModel;
493+
456494
// @public
457495
export class GoogleAIBackend extends Backend {
458496
constructor();
@@ -717,6 +755,10 @@ export interface InlineDataPart {
717755
inlineData: GenerativeContentBlob;
718756
// (undocumented)
719757
text?: never;
758+
// (undocumented)
759+
thought?: boolean;
760+
// @internal (undocumented)
761+
thoughtSignature?: never;
720762
videoMetadata?: VideoMetadata;
721763
}
722764

@@ -782,6 +824,96 @@ export interface LanguageModelPromptOptions {
782824
responseConstraint?: object;
783825
}
784826

827+
// @beta
828+
export interface LiveGenerationConfig {
829+
frequencyPenalty?: number;
830+
maxOutputTokens?: number;
831+
presencePenalty?: number;
832+
responseModalities?: ResponseModality[];
833+
speechConfig?: SpeechConfig;
834+
temperature?: number;
835+
topK?: number;
836+
topP?: number;
837+
}
838+
839+
// @beta
840+
export class LiveGenerativeModel extends AIModel {
841+
// Warning: (ae-forgotten-export) The symbol "WebSocketHandler" needs to be exported by the entry point index.d.ts
842+
//
843+
// @internal
844+
constructor(ai: AI, modelParams: LiveModelParams,
845+
_webSocketHandler: WebSocketHandler);
846+
connect(): Promise<LiveSession>;
847+
// (undocumented)
848+
generationConfig: LiveGenerationConfig;
849+
// (undocumented)
850+
systemInstruction?: Content;
851+
// (undocumented)
852+
toolConfig?: ToolConfig;
853+
// (undocumented)
854+
tools?: Tool[];
855+
}
856+
857+
// @beta
858+
export interface LiveModelParams {
859+
// (undocumented)
860+
generationConfig?: LiveGenerationConfig;
861+
// (undocumented)
862+
model: string;
863+
// (undocumented)
864+
systemInstruction?: string | Part | Content;
865+
// (undocumented)
866+
toolConfig?: ToolConfig;
867+
// (undocumented)
868+
tools?: Tool[];
869+
}
870+
871+
// @beta
872+
export const LiveResponseType: {
873+
SERVER_CONTENT: string;
874+
TOOL_CALL: string;
875+
TOOL_CALL_CANCELLATION: string;
876+
};
877+
878+
// @beta
879+
export type LiveResponseType = (typeof LiveResponseType)[keyof typeof LiveResponseType];
880+
881+
// @beta
882+
export interface LiveServerContent {
883+
interrupted?: boolean;
884+
modelTurn?: Content;
885+
turnComplete?: boolean;
886+
// (undocumented)
887+
type: 'serverContent';
888+
}
889+
890+
// @beta
891+
export interface LiveServerToolCall {
892+
functionCalls: FunctionCall[];
893+
// (undocumented)
894+
type: 'toolCall';
895+
}
896+
897+
// @beta
898+
export interface LiveServerToolCallCancellation {
899+
functionIds: string[];
900+
// (undocumented)
901+
type: 'toolCallCancellation';
902+
}
903+
904+
// @beta
905+
export class LiveSession {
906+
// @internal
907+
constructor(webSocketHandler: WebSocketHandler, serverMessages: AsyncGenerator<unknown>);
908+
close(): Promise<void>;
909+
inConversation: boolean;
910+
isClosed: boolean;
911+
receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
912+
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
913+
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
914+
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
915+
}
916+
785917
// @public
786918
export const Modality: {
787919
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
@@ -854,6 +986,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
854986
// @public
855987
export const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];
856988

989+
// @beta
990+
export interface PrebuiltVoiceConfig {
991+
voiceName?: string;
992+
}
993+
857994
// @public
858995
export interface PromptFeedback {
859996
// (undocumented)
@@ -873,6 +1010,7 @@ export interface RequestOptions {
8731010
export const ResponseModality: {
8741011
readonly TEXT: "TEXT";
8751012
readonly IMAGE: "IMAGE";
1013+
readonly AUDIO: "AUDIO";
8761014
};
8771015

8781016
// @beta
@@ -1017,6 +1155,19 @@ export interface Segment {
10171155
text: string;
10181156
}
10191157

1158+
// @beta
1159+
export interface SpeechConfig {
1160+
voiceConfig?: VoiceConfig;
1161+
}
1162+
1163+
// @beta
1164+
export function startAudioConversation(liveSession: LiveSession, options?: StartAudioConversationOptions): Promise<AudioConversationController>;
1165+
1166+
// @beta
1167+
export interface StartAudioConversationOptions {
1168+
functionCallingHandler?: (functionCalls: LiveServerToolCall['functionCalls']) => Promise<Part>;
1169+
}
1170+
10201171
// @public
10211172
export interface StartChatParams extends BaseParams {
10221173
// (undocumented)
@@ -1048,10 +1199,15 @@ export interface TextPart {
10481199
inlineData?: never;
10491200
// (undocumented)
10501201
text: string;
1202+
// (undocumented)
1203+
thought?: boolean;
1204+
// @internal (undocumented)
1205+
thoughtSignature?: string;
10511206
}
10521207

10531208
// @public
10541209
export interface ThinkingConfig {
1210+
includeThoughts?: boolean;
10551211
thinkingBudget?: number;
10561212
}
10571213

@@ -1094,6 +1250,11 @@ export interface VideoMetadata {
10941250
startOffset: string;
10951251
}
10961252

1253+
// @beta
1254+
export interface VoiceConfig {
1255+
prebuiltVoiceConfig?: PrebuiltVoiceConfig;
1256+
}
1257+
10971258
// @public (undocumented)
10981259
export interface WebAttribution {
10991260
// (undocumented)

0 commit comments

Comments
 (0)