Skip to content

Commit f5c50c1

Browse files
committed
Merge remote-tracking branch 'origin/main' into telemetry
2 parents b41346e + c47bd71 commit f5c50c1

File tree

93 files changed

+1345
-271
lines changed

Some content is hidden

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

93 files changed

+1345
-271
lines changed

.changeset/spotty-shirts-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/data-connect": patch
3+
---
4+
5+
Fixed issue where onComplete wasn't triggering when the user calls `unsubscribe` on a subscription.

common/api-review/ai.api.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ export interface AudioConversationController {
9292
stop: () => Promise<void>;
9393
}
9494

95+
// @public
96+
export interface AudioTranscriptionConfig {
97+
}
98+
9599
// @public
96100
export abstract class Backend {
97101
protected constructor(type: BackendType);
@@ -153,6 +157,8 @@ export interface ChromeAdapter {
153157
generateContent(request: GenerateContentRequest): Promise<Response>;
154158
generateContentStream(request: GenerateContentRequest): Promise<Response>;
155159
isAvailable(request: GenerateContentRequest): Promise<boolean>;
160+
// @internal (undocumented)
161+
mode: InferenceMode;
156162
}
157163

158164
// @public
@@ -256,6 +262,8 @@ export { Date_2 as Date }
256262
// @public
257263
export interface EnhancedGenerateContentResponse extends GenerateContentResponse {
258264
functionCalls: () => FunctionCall[] | undefined;
265+
// @beta
266+
inferenceSource?: InferenceSource;
259267
inlineDataParts: () => InlineDataPart[] | undefined;
260268
text: () => string;
261269
thoughtSummary: () => string | undefined;
@@ -816,6 +824,15 @@ export const InferenceMode: {
816824
// @beta
817825
export type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
818826

827+
// @beta
828+
export const InferenceSource: {
829+
readonly ON_DEVICE: "on_device";
830+
readonly IN_CLOUD: "in_cloud";
831+
};
832+
833+
// @beta
834+
export type InferenceSource = (typeof InferenceSource)[keyof typeof InferenceSource];
835+
819836
// @public
820837
export interface InlineDataPart {
821838
// (undocumented)
@@ -911,7 +928,9 @@ export interface LanguageModelPromptOptions {
911928
// @beta
912929
export interface LiveGenerationConfig {
913930
frequencyPenalty?: number;
931+
inputAudioTranscription?: AudioTranscriptionConfig;
914932
maxOutputTokens?: number;
933+
outputAudioTranscription?: AudioTranscriptionConfig;
915934
presencePenalty?: number;
916935
responseModalities?: ResponseModality[];
917936
speechConfig?: SpeechConfig;
@@ -964,8 +983,10 @@ export type LiveResponseType = (typeof LiveResponseType)[keyof typeof LiveRespon
964983

965984
// @beta
966985
export interface LiveServerContent {
986+
inputTranscription?: Transcription;
967987
interrupted?: boolean;
968988
modelTurn?: Content;
989+
outputTranscription?: Transcription;
969990
turnComplete?: boolean;
970991
// (undocumented)
971992
type: 'serverContent';
@@ -994,9 +1015,14 @@ export class LiveSession {
9941015
isClosed: boolean;
9951016
receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
9961017
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
1018+
sendAudioRealtime(blob: GenerativeContentBlob): Promise<void>;
9971019
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
1020+
// @deprecated
9981021
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
1022+
// @deprecated (undocumented)
9991023
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
1024+
sendTextRealtime(text: string): Promise<void>;
1025+
sendVideoRealtime(blob: GenerativeContentBlob): Promise<void>;
10001026
}
10011027

10021028
// @public
@@ -1326,6 +1352,11 @@ export interface ToolConfig {
13261352
functionCallingConfig?: FunctionCallingConfig;
13271353
}
13281354

1355+
// @beta
1356+
export interface Transcription {
1357+
text?: string;
1358+
}
1359+
13291360
// @public
13301361
export type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
13311362

common/api-review/data-connect.api.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,6 @@ export interface DataConnectResult<Data, Variables> extends OpResult<Data> {
109109
ref: OperationRef<Data, Variables>;
110110
}
111111

112-
// @public
113-
export interface DataConnectSubscription<Data, Variables> {
114-
// (undocumented)
115-
errCallback?: (e?: DataConnectError) => void;
116-
// (undocumented)
117-
unsubscribe: () => void;
118-
// (undocumented)
119-
userCallback: OnResultSubscription<Data, Variables>;
120-
}
121-
122112
// @public (undocumented)
123113
export type DataSource = typeof SOURCE_CACHE | typeof SOURCE_SERVER;
124114

docs-devsite/_toc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ toc:
1818
path: /docs/reference/js/ai.arrayschema.md
1919
- title: AudioConversationController
2020
path: /docs/reference/js/ai.audioconversationcontroller.md
21+
- title: AudioTranscriptionConfig
22+
path: /docs/reference/js/ai.audiotranscriptionconfig.md
2123
- title: Backend
2224
path: /docs/reference/js/ai.backend.md
2325
- title: BaseParams
@@ -202,6 +204,8 @@ toc:
202204
path: /docs/reference/js/ai.thinkingconfig.md
203205
- title: ToolConfig
204206
path: /docs/reference/js/ai.toolconfig.md
207+
- title: Transcription
208+
path: /docs/reference/js/ai.transcription.md
205209
- title: URLContext
206210
path: /docs/reference/js/ai.urlcontext.md
207211
- title: URLContextMetadata
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
# AudioTranscriptionConfig interface
13+
The audio transcription configuration.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface AudioTranscriptionConfig
19+
```

docs-devsite/ai.enhancedgeneratecontentresponse.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface EnhancedGenerateContentResponse extends GenerateContentResponse
2424
| Property | Type | Description |
2525
| --- | --- | --- |
2626
| [functionCalls](./ai.enhancedgeneratecontentresponse.md#enhancedgeneratecontentresponsefunctioncalls) | () =&gt; [FunctionCall](./ai.functioncall.md#functioncall_interface)<!-- -->\[\] \| undefined | Aggregates and returns every [FunctionCall](./ai.functioncall.md#functioncall_interface) from the first candidate of [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
27+
| [inferenceSource](./ai.enhancedgeneratecontentresponse.md#enhancedgeneratecontentresponseinferencesource) | [InferenceSource](./ai.md#inferencesource) | <b><i>(Public Preview)</i></b> Indicates whether inference happened on-device or in-cloud. |
2728
| [inlineDataParts](./ai.enhancedgeneratecontentresponse.md#enhancedgeneratecontentresponseinlinedataparts) | () =&gt; [InlineDataPart](./ai.inlinedatapart.md#inlinedatapart_interface)<!-- -->\[\] \| undefined | Aggregates and returns every [InlineDataPart](./ai.inlinedatapart.md#inlinedatapart_interface) from the first candidate of [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
2829
| [text](./ai.enhancedgeneratecontentresponse.md#enhancedgeneratecontentresponsetext) | () =&gt; string | Returns the text string from the response, if available. Throws if the prompt or candidate was blocked. |
2930
| [thoughtSummary](./ai.enhancedgeneratecontentresponse.md#enhancedgeneratecontentresponsethoughtsummary) | () =&gt; string \| undefined | Aggregates and returns every [TextPart](./ai.textpart.md#textpart_interface) with their <code>thought</code> property set to <code>true</code> from the first candidate of [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->. |
@@ -38,6 +39,19 @@ Aggregates and returns every [FunctionCall](./ai.functioncall.md#functioncall_in
3839
functionCalls: () => FunctionCall[] | undefined;
3940
```
4041
42+
## EnhancedGenerateContentResponse.inferenceSource
43+
44+
> 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.
45+
>
46+
47+
Indicates whether inference happened on-device or in-cloud.
48+
49+
<b>Signature:</b>
50+
51+
```typescript
52+
inferenceSource?: InferenceSource;
53+
```
54+
4155
## EnhancedGenerateContentResponse.inlineDataParts
4256
4357
Aggregates and returns every [InlineDataPart](./ai.inlinedatapart.md#inlinedatapart_interface) from the first candidate of [GenerateContentResponse](./ai.generatecontentresponse.md#generatecontentresponse_interface)<!-- -->.

docs-devsite/ai.livegenerationconfig.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export interface LiveGenerationConfig
2626
| Property | Type | Description |
2727
| --- | --- | --- |
2828
| [frequencyPenalty](./ai.livegenerationconfig.md#livegenerationconfigfrequencypenalty) | number | <b><i>(Public Preview)</i></b> Frequency penalties. |
29+
| [inputAudioTranscription](./ai.livegenerationconfig.md#livegenerationconfiginputaudiotranscription) | [AudioTranscriptionConfig](./ai.audiotranscriptionconfig.md#audiotranscriptionconfig_interface) | <b><i>(Public Preview)</i></b> Enables transcription of audio input.<!-- -->When enabled, the model will respond with transcriptions of your audio input in the <code>inputTranscriptions</code> property in [LiveServerContent](./ai.liveservercontent.md#liveservercontent_interface) messages. Note that the transcriptions are broken up across messages, so you may only receive small amounts of text per message. For example, if you ask the model "How are you today?", the model may transcribe that input across three messages, broken up as "How a", "re yo", "u today?". |
2930
| [maxOutputTokens](./ai.livegenerationconfig.md#livegenerationconfigmaxoutputtokens) | number | <b><i>(Public Preview)</i></b> Specifies the maximum number of tokens that can be generated in the response. The number of tokens per word varies depending on the language outputted. Is unbounded by default. |
31+
| [outputAudioTranscription](./ai.livegenerationconfig.md#livegenerationconfigoutputaudiotranscription) | [AudioTranscriptionConfig](./ai.audiotranscriptionconfig.md#audiotranscriptionconfig_interface) | <b><i>(Public Preview)</i></b> Enables transcription of audio input.<!-- -->When enabled, the model will respond with transcriptions of its audio output in the <code>outputTranscription</code> property in [LiveServerContent](./ai.liveservercontent.md#liveservercontent_interface) messages. Note that the transcriptions are broken up across messages, so you may only receive small amounts of text per message. For example, if the model says "How are you today?", the model may transcribe that output across three messages, broken up as "How a", "re yo", "u today?". |
3032
| [presencePenalty](./ai.livegenerationconfig.md#livegenerationconfigpresencepenalty) | number | <b><i>(Public Preview)</i></b> Positive penalties. |
3133
| [responseModalities](./ai.livegenerationconfig.md#livegenerationconfigresponsemodalities) | [ResponseModality](./ai.md#responsemodality)<!-- -->\[\] | <b><i>(Public Preview)</i></b> The modalities of the response. |
3234
| [speechConfig](./ai.livegenerationconfig.md#livegenerationconfigspeechconfig) | [SpeechConfig](./ai.speechconfig.md#speechconfig_interface) | <b><i>(Public Preview)</i></b> Configuration for speech synthesis. |
@@ -47,6 +49,21 @@ Frequency penalties.
4749
frequencyPenalty?: number;
4850
```
4951

52+
## LiveGenerationConfig.inputAudioTranscription
53+
54+
> 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.
55+
>
56+
57+
Enables transcription of audio input.
58+
59+
When enabled, the model will respond with transcriptions of your audio input in the `inputTranscriptions` property in [LiveServerContent](./ai.liveservercontent.md#liveservercontent_interface) messages. Note that the transcriptions are broken up across messages, so you may only receive small amounts of text per message. For example, if you ask the model "How are you today?", the model may transcribe that input across three messages, broken up as "How a", "re yo", "u today?".
60+
61+
<b>Signature:</b>
62+
63+
```typescript
64+
inputAudioTranscription?: AudioTranscriptionConfig;
65+
```
66+
5067
## LiveGenerationConfig.maxOutputTokens
5168

5269
> 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.
@@ -60,6 +77,21 @@ Specifies the maximum number of tokens that can be generated in the response. Th
6077
maxOutputTokens?: number;
6178
```
6279

80+
## LiveGenerationConfig.outputAudioTranscription
81+
82+
> 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.
83+
>
84+
85+
Enables transcription of audio input.
86+
87+
When enabled, the model will respond with transcriptions of its audio output in the `outputTranscription` property in [LiveServerContent](./ai.liveservercontent.md#liveservercontent_interface) messages. Note that the transcriptions are broken up across messages, so you may only receive small amounts of text per message. For example, if the model says "How are you today?", the model may transcribe that output across three messages, broken up as "How a", "re yo", "u today?".
88+
89+
<b>Signature:</b>
90+
91+
```typescript
92+
outputAudioTranscription?: AudioTranscriptionConfig;
93+
```
94+
6395
## LiveGenerationConfig.presencePenalty
6496

6597
> 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.

docs-devsite/ai.liveservercontent.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,26 @@ export interface LiveServerContent
2525

2626
| Property | Type | Description |
2727
| --- | --- | --- |
28+
| [inputTranscription](./ai.liveservercontent.md#liveservercontentinputtranscription) | [Transcription](./ai.transcription.md#transcription_interface) | <b><i>(Public Preview)</i></b> Transcription of the audio that was input to the model. |
2829
| [interrupted](./ai.liveservercontent.md#liveservercontentinterrupted) | boolean | <b><i>(Public Preview)</i></b> Indicates whether the model was interrupted by the client. An interruption occurs when the client sends a message before the model finishes it's turn. This is <code>undefined</code> if the model was not interrupted. |
2930
| [modelTurn](./ai.liveservercontent.md#liveservercontentmodelturn) | [Content](./ai.content.md#content_interface) | <b><i>(Public Preview)</i></b> The content that the model has generated as part of the current conversation with the user. |
31+
| [outputTranscription](./ai.liveservercontent.md#liveservercontentoutputtranscription) | [Transcription](./ai.transcription.md#transcription_interface) | <b><i>(Public Preview)</i></b> Transcription of the audio output from the model. |
3032
| [turnComplete](./ai.liveservercontent.md#liveservercontentturncomplete) | boolean | <b><i>(Public Preview)</i></b> Indicates whether the turn is complete. This is <code>undefined</code> if the turn is not complete. |
3133
| [type](./ai.liveservercontent.md#liveservercontenttype) | 'serverContent' | <b><i>(Public Preview)</i></b> |
3234

35+
## LiveServerContent.inputTranscription
36+
37+
> 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.
38+
>
39+
40+
Transcription of the audio that was input to the model.
41+
42+
<b>Signature:</b>
43+
44+
```typescript
45+
inputTranscription?: Transcription;
46+
```
47+
3348
## LiveServerContent.interrupted
3449

3550
> 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.
@@ -56,6 +71,19 @@ The content that the model has generated as part of the current conversation wit
5671
modelTurn?: Content;
5772
```
5873

74+
## LiveServerContent.outputTranscription
75+
76+
> 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.
77+
>
78+
79+
Transcription of the audio output from the model.
80+
81+
<b>Signature:</b>
82+
83+
```typescript
84+
outputTranscription?: Transcription;
85+
```
86+
5987
## LiveServerContent.turnComplete
6088

6189
> 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.

0 commit comments

Comments
 (0)