@@ -32,6 +32,7 @@ export const AIErrorCode: {
32
32
readonly REQUEST_ERROR: " request-error" ;
33
33
readonly RESPONSE_ERROR: " response-error" ;
34
34
readonly FETCH_ERROR: " fetch-error" ;
35
+ readonly SESSION_CLOSED: " session-closed" ;
35
36
readonly INVALID_CONTENT: " invalid-content" ;
36
37
readonly API_NOT_ENABLED: " api-not-enabled" ;
37
38
readonly INVALID_SCHEMA: " invalid-schema" ;
@@ -262,6 +263,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
262
263
export interface FunctionCall {
263
264
// (undocumented)
264
265
args: object ;
266
+ id? : string ;
265
267
// (undocumented)
266
268
name: string ;
267
269
}
@@ -310,6 +312,7 @@ export interface FunctionDeclarationsTool {
310
312
311
313
// @public
312
314
export interface FunctionResponse {
315
+ id? : string ;
313
316
// (undocumented)
314
317
name: string ;
315
318
// (undocumented)
@@ -444,6 +447,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOpti
444
447
// @beta
445
448
export function getImagenModel(ai : AI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
446
449
450
+ // @beta
451
+ export function getLiveGenerativeModel(ai : AI , modelParams : LiveModelParams ): LiveGenerativeModel ;
452
+
447
453
// @public
448
454
export class GoogleAIBackend extends Backend {
449
455
constructor ();
@@ -699,6 +705,95 @@ export class IntegerSchema extends Schema {
699
705
constructor (schemaParams ? : SchemaParams );
700
706
}
701
707
708
+ // @beta
709
+ export interface LiveGenerationConfig {
710
+ frequencyPenalty? : number ;
711
+ maxOutputTokens? : number ;
712
+ presencePenalty? : number ;
713
+ responseModalities? : [ResponseModality ];
714
+ speechConfig? : SpeechConfig ;
715
+ temperature? : number ;
716
+ topK? : number ;
717
+ topP? : number ;
718
+ }
719
+
720
+ // @beta
721
+ export class LiveGenerativeModel extends AIModel {
722
+ // Warning: (ae-forgotten-export) The symbol "WebSocketHandler" needs to be exported by the entry point index.d.ts
723
+ //
724
+ // @internal
725
+ constructor (ai : AI , modelParams : LiveModelParams ,
726
+ _webSocketHandler : WebSocketHandler );
727
+ connect(): Promise <LiveSession >;
728
+ // (undocumented)
729
+ generationConfig: LiveGenerationConfig ;
730
+ // (undocumented)
731
+ systemInstruction? : Content ;
732
+ // (undocumented)
733
+ toolConfig? : ToolConfig ;
734
+ // (undocumented)
735
+ tools? : Tool [];
736
+ }
737
+
738
+ // @beta
739
+ export interface LiveModelParams {
740
+ // (undocumented)
741
+ generationConfig? : LiveGenerationConfig ;
742
+ // (undocumented)
743
+ model: string ;
744
+ // (undocumented)
745
+ systemInstruction? : string | Part | Content ;
746
+ // (undocumented)
747
+ toolConfig? : ToolConfig ;
748
+ // (undocumented)
749
+ tools? : Tool [];
750
+ }
751
+
752
+ // @beta
753
+ export const LiveResponseType: {
754
+ SERVER_CONTENT: string ;
755
+ TOOL_CALL: string ;
756
+ TOOL_CALL_CANCELLATION: string ;
757
+ };
758
+
759
+ // @beta
760
+ export type LiveResponseType = (typeof LiveResponseType )[keyof typeof LiveResponseType ];
761
+
762
+ // @beta
763
+ export interface LiveServerContent {
764
+ interrupted? : boolean ;
765
+ modelTurn? : Content ;
766
+ turnComplete? : boolean ;
767
+ // (undocumented)
768
+ type: ' serverContent' ;
769
+ }
770
+
771
+ // @beta
772
+ export interface LiveServerToolCall {
773
+ functionCalls: FunctionCall [];
774
+ // (undocumented)
775
+ type: ' toolCall' ;
776
+ }
777
+
778
+ // @beta
779
+ export interface LiveServerToolCallCancellation {
780
+ functionIds: string [];
781
+ // (undocumented)
782
+ type: ' toolCallCancellation' ;
783
+ }
784
+
785
+ // @beta
786
+ export class LiveSession {
787
+ // @internal
788
+ constructor (webSocketHandler : WebSocketHandler , serverMessages : AsyncGenerator <unknown >);
789
+ close(): Promise <void >;
790
+ isClosed: boolean ;
791
+ receive(): AsyncGenerator <LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation >;
792
+ send(request : string | Array <string | Part >, turnComplete ? : boolean ): Promise <void >;
793
+ sendMediaChunks(mediaChunks : GenerativeContentBlob []): Promise <void >;
794
+ sendMediaStream(mediaChunkStream : ReadableStream <GenerativeContentBlob >): Promise <void >;
795
+ }
796
+
702
797
// @public
703
798
export const Modality: {
704
799
readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -763,6 +858,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
763
858
// @public
764
859
export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
765
860
861
+ // @beta
862
+ export interface PrebuiltVoiceConfig {
863
+ voiceConfig? : string ;
864
+ }
865
+
766
866
// @public
767
867
export interface PromptFeedback {
768
868
// (undocumented)
@@ -926,6 +1026,11 @@ export interface Segment {
926
1026
text: string ;
927
1027
}
928
1028
1029
+ // @beta
1030
+ export interface SpeechConfig {
1031
+ voiceConfig? : VoiceConfig ;
1032
+ }
1033
+
929
1034
// @public
930
1035
export interface StartChatParams extends BaseParams {
931
1036
// (undocumented)
@@ -1003,6 +1108,11 @@ export interface VideoMetadata {
1003
1108
startOffset: string ;
1004
1109
}
1005
1110
1111
+ // @beta
1112
+ export interface VoiceConfig {
1113
+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1114
+ }
1115
+
1006
1116
// @public (undocumented)
1007
1117
export interface WebAttribution {
1008
1118
// (undocumented)
0 commit comments