4
4
5
5
``` ts
6
6
7
+ import { AppCheckInternalComponentName } from ' @firebase/app-check-interop-types' ;
7
8
import { AppCheckTokenResult } from ' @firebase/app-check-interop-types' ;
9
+ import { ComponentContainer } from ' @firebase/component' ;
8
10
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' ;
9
14
import { FirebaseAuthTokenData } from ' @firebase/auth-interop-types' ;
10
15
import { FirebaseError } from ' @firebase/util' ;
16
+ import { _FirebaseService } from ' @firebase/app' ;
17
+ import { InstanceFactoryOptions } from ' @firebase/component' ;
18
+ import { Provider } from ' @firebase/component' ;
11
19
12
20
// @public
13
21
export interface AI {
14
22
app: FirebaseApp ;
15
23
backend: Backend ;
16
24
// @deprecated (undocumented)
17
25
location: string ;
26
+ options? : AIOptions ;
18
27
}
19
28
20
29
// @public
@@ -32,6 +41,7 @@ export const AIErrorCode: {
32
41
readonly REQUEST_ERROR: " request-error" ;
33
42
readonly RESPONSE_ERROR: " response-error" ;
34
43
readonly FETCH_ERROR: " fetch-error" ;
44
+ readonly SESSION_CLOSED: " session-closed" ;
35
45
readonly INVALID_CONTENT: " invalid-content" ;
36
46
readonly API_NOT_ENABLED: " api-not-enabled" ;
37
47
readonly INVALID_SCHEMA: " invalid-schema" ;
@@ -53,15 +63,16 @@ export abstract class AIModel {
53
63
// Warning: (ae-forgotten-export) The symbol "ApiSettings" needs to be exported by the entry point index.d.ts
54
64
//
55
65
// @internal (undocumented)
56
- protected _apiSettings: ApiSettings ;
66
+ _apiSettings: ApiSettings ;
57
67
readonly model: string ;
58
68
// @internal
59
69
static normalizeModelName(modelName : string , backendType : BackendType ): string ;
60
70
}
61
71
62
72
// @public
63
73
export interface AIOptions {
64
- backend: Backend ;
74
+ backend? : Backend ;
75
+ useLimitedUseAppCheckTokens? : boolean ;
65
76
}
66
77
67
78
// @public
@@ -84,6 +95,11 @@ export class ArraySchema extends Schema {
84
95
toJSON(): SchemaRequest ;
85
96
}
86
97
98
+ // @beta
99
+ export interface AudioConversationController {
100
+ stop: () => Promise <void >;
101
+ }
102
+
87
103
// @public
88
104
export abstract class Backend {
89
105
protected constructor (type : BackendType );
@@ -213,10 +229,10 @@ export { Date_2 as Date }
213
229
214
230
// @public
215
231
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
216
- // (undocumented)
217
232
functionCalls: () => FunctionCall [] | undefined ;
218
233
inlineDataParts: () => InlineDataPart [] | undefined ;
219
234
text: () => string ;
235
+ thoughtSummary: () => string | undefined ;
220
236
}
221
237
222
238
// @public
@@ -229,6 +245,11 @@ export interface ErrorDetails {
229
245
reason? : string ;
230
246
}
231
247
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
+
232
253
// @public
233
254
export interface FileData {
234
255
// (undocumented)
@@ -249,6 +270,10 @@ export interface FileDataPart {
249
270
inlineData? : never ;
250
271
// (undocumented)
251
272
text? : never ;
273
+ // (undocumented)
274
+ thought? : boolean ;
275
+ // @internal (undocumented)
276
+ thoughtSignature? : never ;
252
277
}
253
278
254
279
// @public
@@ -271,6 +296,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
271
296
export interface FunctionCall {
272
297
// (undocumented)
273
298
args: object ;
299
+ id? : string ;
274
300
// (undocumented)
275
301
name: string ;
276
302
}
@@ -303,6 +329,10 @@ export interface FunctionCallPart {
303
329
inlineData? : never ;
304
330
// (undocumented)
305
331
text? : never ;
332
+ // (undocumented)
333
+ thought? : boolean ;
334
+ // @internal (undocumented)
335
+ thoughtSignature? : never ;
306
336
}
307
337
308
338
// @public
@@ -319,6 +349,7 @@ export interface FunctionDeclarationsTool {
319
349
320
350
// @public
321
351
export interface FunctionResponse {
352
+ id? : string ;
322
353
// (undocumented)
323
354
name: string ;
324
355
// (undocumented)
@@ -335,6 +366,10 @@ export interface FunctionResponsePart {
335
366
inlineData? : never ;
336
367
// (undocumented)
337
368
text? : never ;
369
+ // (undocumented)
370
+ thought? : boolean ;
371
+ // @internal (undocumented)
372
+ thoughtSignature? : never ;
338
373
}
339
374
340
375
// @public
@@ -453,6 +488,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridPara
453
488
// @beta
454
489
export function getImagenModel(ai : AI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
455
490
491
+ // @beta
492
+ export function getLiveGenerativeModel(ai : AI , modelParams : LiveModelParams ): LiveGenerativeModel ;
493
+
456
494
// @public
457
495
export class GoogleAIBackend extends Backend {
458
496
constructor ();
@@ -717,6 +755,10 @@ export interface InlineDataPart {
717
755
inlineData: GenerativeContentBlob ;
718
756
// (undocumented)
719
757
text? : never ;
758
+ // (undocumented)
759
+ thought? : boolean ;
760
+ // @internal (undocumented)
761
+ thoughtSignature? : never ;
720
762
videoMetadata? : VideoMetadata ;
721
763
}
722
764
@@ -782,6 +824,96 @@ export interface LanguageModelPromptOptions {
782
824
responseConstraint? : object ;
783
825
}
784
826
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
+
785
917
// @public
786
918
export const Modality: {
787
919
readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -854,6 +986,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
854
986
// @public
855
987
export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
856
988
989
+ // @beta
990
+ export interface PrebuiltVoiceConfig {
991
+ voiceName? : string ;
992
+ }
993
+
857
994
// @public
858
995
export interface PromptFeedback {
859
996
// (undocumented)
@@ -873,6 +1010,7 @@ export interface RequestOptions {
873
1010
export const ResponseModality: {
874
1011
readonly TEXT: " TEXT" ;
875
1012
readonly IMAGE: " IMAGE" ;
1013
+ readonly AUDIO: " AUDIO" ;
876
1014
};
877
1015
878
1016
// @beta
@@ -1017,6 +1155,19 @@ export interface Segment {
1017
1155
text: string ;
1018
1156
}
1019
1157
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
+
1020
1171
// @public
1021
1172
export interface StartChatParams extends BaseParams {
1022
1173
// (undocumented)
@@ -1048,10 +1199,15 @@ export interface TextPart {
1048
1199
inlineData? : never ;
1049
1200
// (undocumented)
1050
1201
text: string ;
1202
+ // (undocumented)
1203
+ thought? : boolean ;
1204
+ // @internal (undocumented)
1205
+ thoughtSignature? : string ;
1051
1206
}
1052
1207
1053
1208
// @public
1054
1209
export interface ThinkingConfig {
1210
+ includeThoughts? : boolean ;
1055
1211
thinkingBudget? : number ;
1056
1212
}
1057
1213
@@ -1094,6 +1250,11 @@ export interface VideoMetadata {
1094
1250
startOffset: string ;
1095
1251
}
1096
1252
1253
+ // @beta
1254
+ export interface VoiceConfig {
1255
+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1256
+ }
1257
+
1097
1258
// @public (undocumented)
1098
1259
export interface WebAttribution {
1099
1260
// (undocumented)
0 commit comments