@@ -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,127 @@ export class IntegerSchema extends Schema {
699
705
constructor (schemaParams ? : SchemaParams );
700
706
}
701
707
708
+ // Warning: (ae-internal-missing-underscore) The name "LiveClientContent" should be prefixed with an underscore because the declaration is marked as @internal
709
+ //
710
+ // @internal
711
+ export interface LiveClientContent {
712
+ // (undocumented)
713
+ clientContent: {
714
+ turns: [Content ];
715
+ turnComplete: boolean ;
716
+ };
717
+ }
718
+
719
+ // Warning: (ae-internal-missing-underscore) The name "LiveClientRealtimeInput" should be prefixed with an underscore because the declaration is marked as @internal
720
+ //
721
+ // @internal
722
+ export interface LiveClientRealtimeInput {
723
+ // (undocumented)
724
+ realtimeInput: {
725
+ mediaChunks: GenerativeContentBlob [];
726
+ };
727
+ }
728
+
729
+ // Warning: (ae-internal-missing-underscore) The name "LiveClientSetup" should be prefixed with an underscore because the declaration is marked as @internal
730
+ //
731
+ // @internal
732
+ export interface LiveClientSetup {
733
+ // (undocumented)
734
+ setup: {
735
+ model: string ;
736
+ generationConfig? : LiveGenerationConfig ;
737
+ };
738
+ }
739
+
740
+ // @beta
741
+ export interface LiveGenerationConfig {
742
+ candidateCount? : number ;
743
+ frequencyPenalty? : number ;
744
+ maxOutputTokens? : number ;
745
+ presencePenalty? : number ;
746
+ responseModalities? : [ResponseModality ];
747
+ speechConfig? : SpeechConfig ;
748
+ temperature? : number ;
749
+ topK? : number ;
750
+ topP? : number ;
751
+ }
752
+
753
+ // @beta
754
+ export class LiveGenerativeModel extends AIModel {
755
+ // @internal
756
+ constructor (ai : AI , modelParams : LiveModelParams , _webSocketHandler : WebSocketHandler );
757
+ connect(): Promise <LiveSession >;
758
+ // (undocumented)
759
+ generationConfig: LiveGenerationConfig ;
760
+ // (undocumented)
761
+ systemInstruction? : Content ;
762
+ // (undocumented)
763
+ toolConfig? : ToolConfig ;
764
+ // (undocumented)
765
+ tools? : Tool [];
766
+ // Warning: (ae-forgotten-export) The symbol "WebSocketHandler" needs to be exported by the entry point index.d.ts
767
+ //
768
+ // (undocumented)
769
+ _webSocketHandler: WebSocketHandler ;
770
+ }
771
+
772
+ // @beta
773
+ export interface LiveModelParams {
774
+ generationConfig? : LiveGenerationConfig ;
775
+ model: string ;
776
+ // (undocumented)
777
+ systemInstruction? : string | Part | Content ;
778
+ // (undocumented)
779
+ toolConfig? : ToolConfig ;
780
+ // (undocumented)
781
+ tools? : Tool [];
782
+ }
783
+
784
+ // @beta
785
+ export const LiveResponseType: {
786
+ SERVER_CONTENT: string ;
787
+ TOOL_CALL: string ;
788
+ TOOL_CALL_CANCELLATION: string ;
789
+ };
790
+
791
+ // @beta
792
+ export type LiveResponseType = (typeof LiveResponseType )[keyof typeof LiveResponseType ];
793
+
794
+ // @beta
795
+ export interface LiveServerContent {
796
+ interrupted? : boolean ;
797
+ modelTurn? : Content ;
798
+ turnComplete? : boolean ;
799
+ // (undocumented)
800
+ type: ' serverContent' ;
801
+ }
802
+
803
+ // @beta
804
+ export interface LiveServerToolCall {
805
+ functionCalls: FunctionCall [];
806
+ // (undocumented)
807
+ type: ' toolCall' ;
808
+ }
809
+
810
+ // @beta
811
+ export interface LiveServerToolCallCancellation {
812
+ functionIds: string [];
813
+ // (undocumented)
814
+ type: ' toolCallCancellation' ;
815
+ }
816
+
817
+ // @beta
818
+ export class LiveSession {
819
+ // @internal
820
+ constructor (webSocketHandler : WebSocketHandler , serverMessages : AsyncGenerator <unknown >);
821
+ close(): Promise <void >;
822
+ isClosed: boolean ;
823
+ receive(): AsyncGenerator <LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation >;
824
+ send(request : string | Array <string | Part >, turnComplete ? : boolean ): Promise <void >;
825
+ sendMediaChunks(mediaChunks : GenerativeContentBlob []): Promise <void >;
826
+ sendMediaStream(mediaChunkStream : ReadableStream <GenerativeContentBlob >): Promise <void >;
827
+ }
828
+
702
829
// @public
703
830
export const Modality: {
704
831
readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -763,6 +890,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
763
890
// @public
764
891
export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
765
892
893
+ // @beta
894
+ export interface PrebuiltVoiceConfig {
895
+ voiceConfig? : string ;
896
+ }
897
+
766
898
// @public
767
899
export interface PromptFeedback {
768
900
// (undocumented)
@@ -926,6 +1058,11 @@ export interface Segment {
926
1058
text: string ;
927
1059
}
928
1060
1061
+ // @beta
1062
+ export interface SpeechConfig {
1063
+ voiceConfig? : VoiceConfig ;
1064
+ }
1065
+
929
1066
// @public
930
1067
export interface StartChatParams extends BaseParams {
931
1068
// (undocumented)
@@ -1003,6 +1140,11 @@ export interface VideoMetadata {
1003
1140
startOffset: string ;
1004
1141
}
1005
1142
1143
+ // @beta
1144
+ export interface VoiceConfig {
1145
+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1146
+ }
1147
+
1006
1148
// @public (undocumented)
1007
1149
export interface WebAttribution {
1008
1150
// (undocumented)
0 commit comments