Skip to content

Commit b25f5fb

Browse files
committed
Merge branch 'main' into telemetry
2 parents 9edc6f4 + 4d834de commit b25f5fb

File tree

88 files changed

+4320
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4320
-119
lines changed

.changeset/brave-llamas-impress.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/calm-guests-pump.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/good-cooks-deliver.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/nasty-rings-drop.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/spotty-bananas-fry.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/three-balloons-collect.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/unlucky-goats-teach.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

common/api-review/ai.api.md

Lines changed: 125 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,10 @@
44
55
```ts
66

7-
import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
87
import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
9-
import { ComponentContainer } from '@firebase/component';
108
import { 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';
149
import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
1510
import { 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
2113
export 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
9896
export 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
248241
export interface FileData {
249242
// (undocumented)
@@ -290,6 +283,7 @@ export type FinishReason = (typeof FinishReason)[keyof typeof FinishReason];
290283
export 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
344338
export 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
481476
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
482477

478+
// @beta
479+
export function getLiveGenerativeModel(ai: AI, modelParams: LiveModelParams): LiveGenerativeModel;
480+
483481
// @public
484482
export 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
817905
export const Modality: {
818906
readonly MODALITY_UNSPECIFIED: "MODALITY_UNSPECIFIED";
@@ -885,6 +973,11 @@ export type Part = TextPart | InlineDataPart | FunctionCallPart | FunctionRespon
885973
// @public
886974
export const POSSIBLE_ROLES: readonly ["user", "model", "function", "system"];
887975

976+
// @beta
977+
export interface PrebuiltVoiceConfig {
978+
voiceName?: string;
979+
}
980+
888981
// @public
889982
export interface PromptFeedback {
890983
// (undocumented)
@@ -904,6 +997,7 @@ export interface RequestOptions {
904997
export 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
10521159
export 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)
11341246
export interface WebAttribution {
11351247
// (undocumented)

docs-devsite/_toc.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ toc:
1616
path: /docs/reference/js/ai.anyofschema.md
1717
- title: ArraySchema
1818
path: /docs/reference/js/ai.arrayschema.md
19+
- title: AudioConversationController
20+
path: /docs/reference/js/ai.audioconversationcontroller.md
1921
- title: Backend
2022
path: /docs/reference/js/ai.backend.md
2123
- title: BaseParams
@@ -124,6 +126,20 @@ toc:
124126
path: /docs/reference/js/ai.languagemodelmessagecontent.md
125127
- title: LanguageModelPromptOptions
126128
path: /docs/reference/js/ai.languagemodelpromptoptions.md
129+
- title: LiveGenerationConfig
130+
path: /docs/reference/js/ai.livegenerationconfig.md
131+
- title: LiveGenerativeModel
132+
path: /docs/reference/js/ai.livegenerativemodel.md
133+
- title: LiveModelParams
134+
path: /docs/reference/js/ai.livemodelparams.md
135+
- title: LiveServerContent
136+
path: /docs/reference/js/ai.liveservercontent.md
137+
- title: LiveServerToolCall
138+
path: /docs/reference/js/ai.liveservertoolcall.md
139+
- title: LiveServerToolCallCancellation
140+
path: /docs/reference/js/ai.liveservertoolcallcancellation.md
141+
- title: LiveSession
142+
path: /docs/reference/js/ai.livesession.md
127143
- title: ModalityTokenCount
128144
path: /docs/reference/js/ai.modalitytokencount.md
129145
- title: ModelParams
@@ -136,6 +152,8 @@ toc:
136152
path: /docs/reference/js/ai.objectschemarequest.md
137153
- title: OnDeviceParams
138154
path: /docs/reference/js/ai.ondeviceparams.md
155+
- title: PrebuiltVoiceConfig
156+
path: /docs/reference/js/ai.prebuiltvoiceconfig.md
139157
- title: PromptFeedback
140158
path: /docs/reference/js/ai.promptfeedback.md
141159
- title: RequestOptions
@@ -160,6 +178,10 @@ toc:
160178
path: /docs/reference/js/ai.searchentrypoint.md
161179
- title: Segment
162180
path: /docs/reference/js/ai.segment.md
181+
- title: SpeechConfig
182+
path: /docs/reference/js/ai.speechconfig.md
183+
- title: StartAudioConversationOptions
184+
path: /docs/reference/js/ai.startaudioconversationoptions.md
163185
- title: StartChatParams
164186
path: /docs/reference/js/ai.startchatparams.md
165187
- title: StringSchema
@@ -176,6 +198,8 @@ toc:
176198
path: /docs/reference/js/ai.vertexaibackend.md
177199
- title: VideoMetadata
178200
path: /docs/reference/js/ai.videometadata.md
201+
- title: VoiceConfig
202+
path: /docs/reference/js/ai.voiceconfig.md
179203
- title: WebAttribution
180204
path: /docs/reference/js/ai.webattribution.md
181205
- title: WebGroundingChunk
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Project: /docs/reference/js/_project.yaml
2+
Book: /docs/reference/_book.yaml
3+
page_type: reference
4+
5+
{% comment %}
6+
DO NOT EDIT THIS FILE!
7+
This is generated by the JS SDK team, and any local changes will be
8+
overwritten. Changes should be made in the source code at
9+
https://github.com/firebase/firebase-js-sdk
10+
{% endcomment %}
11+
12+
# AudioConversationController interface
13+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
14+
>
15+
16+
A controller for managing an active audio conversation.
17+
18+
<b>Signature:</b>
19+
20+
```typescript
21+
export interface AudioConversationController
22+
```
23+
24+
## Properties
25+
26+
| Property | Type | Description |
27+
| --- | --- | --- |
28+
| [stop](./ai.audioconversationcontroller.md#audioconversationcontrollerstop) | () =&gt; Promise&lt;void&gt; | <b><i>(Public Preview)</i></b> Stops the audio conversation, closes the microphone connection, and cleans up resources. Returns a promise that resolves when cleanup is complete. |
29+
30+
## AudioConversationController.stop
31+
32+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
33+
>
34+
35+
Stops the audio conversation, closes the microphone connection, and cleans up resources. Returns a promise that resolves when cleanup is complete.
36+
37+
<b>Signature:</b>
38+
39+
```typescript
40+
stop: () => Promise<void>;
41+
```

0 commit comments

Comments
 (0)