@@ -41,6 +41,7 @@ export const AIErrorCode: {
4141 readonly REQUEST_ERROR: " request-error" ;
4242 readonly RESPONSE_ERROR: " response-error" ;
4343 readonly FETCH_ERROR: " fetch-error" ;
44+ readonly SESSION_CLOSED: " session-closed" ;
4445 readonly INVALID_CONTENT: " invalid-content" ;
4546 readonly API_NOT_ENABLED: " api-not-enabled" ;
4647 readonly INVALID_SCHEMA: " invalid-schema" ;
@@ -94,6 +95,11 @@ export class ArraySchema extends Schema {
9495 toJSON(): SchemaRequest ;
9596}
9697
98+ // @beta
99+ export interface AudioConversationController {
100+ stop: () => Promise <void >;
101+ }
102+
97103// @public
98104export abstract class Backend {
99105 protected constructor (type : BackendType );
@@ -290,6 +296,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
290296export interface FunctionCall {
291297 // (undocumented)
292298 args: object ;
299+ id? : string ;
293300 // (undocumented)
294301 name: string ;
295302}
@@ -342,6 +349,7 @@ export interface FunctionDeclarationsTool {
342349
343350// @public
344351export interface FunctionResponse {
352+ id? : string ;
345353 // (undocumented)
346354 name: string ;
347355 // (undocumented)
@@ -480,6 +488,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridPara
480488// @beta
481489export function getImagenModel(ai : AI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
482490
491+ // @beta
492+ export function getLiveGenerativeModel(ai : AI , modelParams : LiveModelParams ): LiveGenerativeModel ;
493+
483494// @public
484495export class GoogleAIBackend extends Backend {
485496 constructor ();
@@ -813,6 +824,96 @@ export interface LanguageModelPromptOptions {
813824 responseConstraint? : object ;
814825}
815826
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+
816917// @public
817918export const Modality: {
818919 readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -885,6 +986,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
885986// @public
886987export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
887988
989+ // @beta
990+ export interface PrebuiltVoiceConfig {
991+ voiceName? : string ;
992+ }
993+
888994// @public
889995export interface PromptFeedback {
890996 // (undocumented)
@@ -904,6 +1010,7 @@ export interface RequestOptions {
9041010export const ResponseModality: {
9051011 readonly TEXT: " TEXT" ;
9061012 readonly IMAGE: " IMAGE" ;
1013+ readonly AUDIO: " AUDIO" ;
9071014};
9081015
9091016// @beta
@@ -1048,6 +1155,19 @@ export interface Segment {
10481155 text: string ;
10491156}
10501157
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+
10511171// @public
10521172export interface StartChatParams extends BaseParams {
10531173 // (undocumented)
@@ -1130,6 +1250,11 @@ export interface VideoMetadata {
11301250 startOffset: string ;
11311251}
11321252
1253+ // @beta
1254+ export interface VoiceConfig {
1255+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1256+ }
1257+
11331258// @public (undocumented)
11341259export interface WebAttribution {
11351260 // (undocumented)
0 commit comments