@@ -41,6 +41,7 @@ export const AIErrorCode: {
41
41
readonly REQUEST_ERROR: " request-error" ;
42
42
readonly RESPONSE_ERROR: " response-error" ;
43
43
readonly FETCH_ERROR: " fetch-error" ;
44
+ readonly SESSION_CLOSED: " session-closed" ;
44
45
readonly INVALID_CONTENT: " invalid-content" ;
45
46
readonly API_NOT_ENABLED: " api-not-enabled" ;
46
47
readonly INVALID_SCHEMA: " invalid-schema" ;
@@ -94,6 +95,11 @@ export class ArraySchema extends Schema {
94
95
toJSON(): SchemaRequest ;
95
96
}
96
97
98
+ // @beta
99
+ export interface AudioConversationController {
100
+ stop: () => Promise <void >;
101
+ }
102
+
97
103
// @public
98
104
export abstract class Backend {
99
105
protected constructor (type : BackendType );
@@ -290,6 +296,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
290
296
export interface FunctionCall {
291
297
// (undocumented)
292
298
args: object ;
299
+ id? : string ;
293
300
// (undocumented)
294
301
name: string ;
295
302
}
@@ -342,6 +349,7 @@ export interface FunctionDeclarationsTool {
342
349
343
350
// @public
344
351
export interface FunctionResponse {
352
+ id? : string ;
345
353
// (undocumented)
346
354
name: string ;
347
355
// (undocumented)
@@ -480,6 +488,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridPara
480
488
// @beta
481
489
export function getImagenModel(ai : AI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
482
490
491
+ // @beta
492
+ export function getLiveGenerativeModel(ai : AI , modelParams : LiveModelParams ): LiveGenerativeModel ;
493
+
483
494
// @public
484
495
export class GoogleAIBackend extends Backend {
485
496
constructor ();
@@ -813,6 +824,96 @@ export interface LanguageModelPromptOptions {
813
824
responseConstraint? : object ;
814
825
}
815
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
+
816
917
// @public
817
918
export const Modality: {
818
919
readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -885,6 +986,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
885
986
// @public
886
987
export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
887
988
989
+ // @beta
990
+ export interface PrebuiltVoiceConfig {
991
+ voiceName? : string ;
992
+ }
993
+
888
994
// @public
889
995
export interface PromptFeedback {
890
996
// (undocumented)
@@ -904,6 +1010,7 @@ export interface RequestOptions {
904
1010
export const ResponseModality: {
905
1011
readonly TEXT: " TEXT" ;
906
1012
readonly IMAGE: " IMAGE" ;
1013
+ readonly AUDIO: " AUDIO" ;
907
1014
};
908
1015
909
1016
// @beta
@@ -1048,6 +1155,19 @@ export interface Segment {
1048
1155
text: string ;
1049
1156
}
1050
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
+
1051
1171
// @public
1052
1172
export interface StartChatParams extends BaseParams {
1053
1173
// (undocumented)
@@ -1130,6 +1250,11 @@ export interface VideoMetadata {
1130
1250
startOffset: string ;
1131
1251
}
1132
1252
1253
+ // @beta
1254
+ export interface VoiceConfig {
1255
+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1256
+ }
1257
+
1133
1258
// @public (undocumented)
1134
1259
export interface WebAttribution {
1135
1260
// (undocumented)
0 commit comments