44
55``` ts
66
7- import { AppCheckInternalComponentName } from ' @firebase/app-check-interop-types' ;
87import { AppCheckTokenResult } from ' @firebase/app-check-interop-types' ;
9- import { ComponentContainer } from ' @firebase/component' ;
108import { 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' ;
149import { FirebaseAuthTokenData } from ' @firebase/auth-interop-types' ;
1510import { FirebaseError } from ' @firebase/util' ;
16- import { _FirebaseService } from ' @firebase/app' ;
17- import { InstanceFactoryOptions } from ' @firebase/component' ;
18- import { Provider } from ' @firebase/component' ;
1911
2012// @public
2113export interface AI {
@@ -41,6 +33,7 @@ export const AIErrorCode: {
4133 readonly REQUEST_ERROR: " request-error" ;
4234 readonly RESPONSE_ERROR: " response-error" ;
4335 readonly FETCH_ERROR: " fetch-error" ;
36+ readonly SESSION_CLOSED: " session-closed" ;
4437 readonly INVALID_CONTENT: " invalid-content" ;
4538 readonly API_NOT_ENABLED: " api-not-enabled" ;
4639 readonly INVALID_SCHEMA: " invalid-schema" ;
@@ -94,6 +87,11 @@ export class ArraySchema extends Schema {
9487 toJSON(): SchemaRequest ;
9588}
9689
90+ // @beta
91+ export interface AudioConversationController {
92+ stop: () => Promise <void >;
93+ }
94+
9795// @public
9896export abstract class Backend {
9997 protected constructor (type : BackendType );
@@ -239,11 +237,6 @@ export interface ErrorDetails {
239237 reason? : string ;
240238}
241239
242- // Warning: (ae-forgotten-export) The symbol "AIService" needs to be exported by the entry point index.d.ts
243- //
244- // @public (undocumented)
245- export function factory(container : ComponentContainer , { instanceIdentifier }: InstanceFactoryOptions ): AIService ;
246-
247240// @public
248241export interface FileData {
249242 // (undocumented)
@@ -290,6 +283,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
290283export interface FunctionCall {
291284 // (undocumented)
292285 args: object ;
286+ id? : string ;
293287 // (undocumented)
294288 name: string ;
295289}
@@ -342,6 +336,7 @@ export interface FunctionDeclarationsTool {
342336
343337// @public
344338export interface FunctionResponse {
339+ id? : string ;
345340 // (undocumented)
346341 name: string ;
347342 // (undocumented)
@@ -480,6 +475,9 @@ export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridPara
480475// @beta
481476export function getImagenModel(ai : AI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
482477
478+ // @beta
479+ export function getLiveGenerativeModel(ai : AI , modelParams : LiveModelParams ): LiveGenerativeModel ;
480+
483481// @public
484482export class GoogleAIBackend extends Backend {
485483 constructor ();
@@ -813,6 +811,96 @@ export interface LanguageModelPromptOptions {
813811 responseConstraint? : object ;
814812}
815813
814+ // @beta
815+ export interface LiveGenerationConfig {
816+ frequencyPenalty? : number ;
817+ maxOutputTokens? : number ;
818+ presencePenalty? : number ;
819+ responseModalities? : ResponseModality [];
820+ speechConfig? : SpeechConfig ;
821+ temperature? : number ;
822+ topK? : number ;
823+ topP? : number ;
824+ }
825+
826+ // @beta
827+ export class LiveGenerativeModel extends AIModel {
828+ // Warning: (ae-forgotten-export) The symbol "WebSocketHandler" needs to be exported by the entry point index.d.ts
829+ //
830+ // @internal
831+ constructor (ai : AI , modelParams : LiveModelParams ,
832+ _webSocketHandler : WebSocketHandler );
833+ connect(): Promise <LiveSession >;
834+ // (undocumented)
835+ generationConfig: LiveGenerationConfig ;
836+ // (undocumented)
837+ systemInstruction? : Content ;
838+ // (undocumented)
839+ toolConfig? : ToolConfig ;
840+ // (undocumented)
841+ tools? : Tool [];
842+ }
843+
844+ // @beta
845+ export interface LiveModelParams {
846+ // (undocumented)
847+ generationConfig? : LiveGenerationConfig ;
848+ // (undocumented)
849+ model: string ;
850+ // (undocumented)
851+ systemInstruction? : string | Part | Content ;
852+ // (undocumented)
853+ toolConfig? : ToolConfig ;
854+ // (undocumented)
855+ tools? : Tool [];
856+ }
857+
858+ // @beta
859+ export const LiveResponseType: {
860+ SERVER_CONTENT: string ;
861+ TOOL_CALL: string ;
862+ TOOL_CALL_CANCELLATION: string ;
863+ };
864+
865+ // @beta
866+ export type LiveResponseType = (typeof LiveResponseType )[keyof typeof LiveResponseType ];
867+
868+ // @beta
869+ export interface LiveServerContent {
870+ interrupted? : boolean ;
871+ modelTurn? : Content ;
872+ turnComplete? : boolean ;
873+ // (undocumented)
874+ type: ' serverContent' ;
875+ }
876+
877+ // @beta
878+ export interface LiveServerToolCall {
879+ functionCalls: FunctionCall [];
880+ // (undocumented)
881+ type: ' toolCall' ;
882+ }
883+
884+ // @beta
885+ export interface LiveServerToolCallCancellation {
886+ functionIds: string [];
887+ // (undocumented)
888+ type: ' toolCallCancellation' ;
889+ }
890+
891+ // @beta
892+ export class LiveSession {
893+ // @internal
894+ constructor (webSocketHandler : WebSocketHandler , serverMessages : AsyncGenerator <unknown >);
895+ close(): Promise <void >;
896+ inConversation: boolean ;
897+ isClosed: boolean ;
898+ receive(): AsyncGenerator <LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation >;
899+ send(request : string | Array <string | Part >, turnComplete ? : boolean ): Promise <void >;
900+ sendMediaChunks(mediaChunks : GenerativeContentBlob []): Promise <void >;
901+ sendMediaStream(mediaChunkStream : ReadableStream <GenerativeContentBlob >): Promise <void >;
902+ }
903+
816904// @public
817905export const Modality: {
818906 readonly MODALITY_UNSPECIFIED: " MODALITY_UNSPECIFIED" ;
@@ -885,6 +973,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
885973// @public
886974export const POSSIBLE_ROLES: readonly [" user" , " model" , " function" , " system" ];
887975
976+ // @beta
977+ export interface PrebuiltVoiceConfig {
978+ voiceName? : string ;
979+ }
980+
888981// @public
889982export interface PromptFeedback {
890983 // (undocumented)
@@ -904,6 +997,7 @@ export interface RequestOptions {
904997export const ResponseModality: {
905998 readonly TEXT: " TEXT" ;
906999 readonly IMAGE: " IMAGE" ;
1000+ readonly AUDIO: " AUDIO" ;
9071001};
9081002
9091003// @beta
@@ -1048,6 +1142,19 @@ export interface Segment {
10481142 text: string ;
10491143}
10501144
1145+ // @beta
1146+ export interface SpeechConfig {
1147+ voiceConfig? : VoiceConfig ;
1148+ }
1149+
1150+ // @beta
1151+ export function startAudioConversation(liveSession : LiveSession , options ? : StartAudioConversationOptions ): Promise <AudioConversationController >;
1152+
1153+ // @beta
1154+ export interface StartAudioConversationOptions {
1155+ functionCallingHandler? : (functionCalls : LiveServerToolCall [' functionCalls' ]) => Promise <Part >;
1156+ }
1157+
10511158// @public
10521159export interface StartChatParams extends BaseParams {
10531160 // (undocumented)
@@ -1130,6 +1237,11 @@ export interface VideoMetadata {
11301237 startOffset: string ;
11311238}
11321239
1240+ // @beta
1241+ export interface VoiceConfig {
1242+ prebuiltVoiceConfig? : PrebuiltVoiceConfig ;
1243+ }
1244+
11331245// @public (undocumented)
11341246export interface WebAttribution {
11351247 // (undocumented)
0 commit comments