@firebase/ai 2.4.0-canary.44d9891f9 → 2.4.0-canary.8209266c6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,32 +53,65 @@ export declare class LiveSession {
53
53
  */
54
54
  send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
55
55
  /**
56
- * Sends realtime input to the server.
56
+ * Sends text to the server in realtime.
57
57
  *
58
- * @param mediaChunks - The media chunks to send.
58
+ * @example
59
+ * ```javascript
60
+ * liveSession.sendTextRealtime("Hello, how are you?");
61
+ * ```
62
+ *
63
+ * @param text - The text data to send.
59
64
  * @throws If this session has been closed.
60
65
  *
61
66
  * @beta
62
67
  */
63
- sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
68
+ sendTextRealtime(text: string): Promise<void>;
64
69
  /**
65
- * Sends function responses to the server.
70
+ * Sends audio data to the server in realtime.
66
71
  *
67
- * @param functionResponses - The function responses to send.
72
+ * @remarks The server requires that the audio data is base64-encoded 16-bit PCM at 16kHz
73
+ * little-endian.
74
+ *
75
+ * @example
76
+ * ```javascript
77
+ * // const pcmData = ... base64-encoded 16-bit PCM at 16kHz little-endian.
78
+ * const blob = { mimeType: "audio/pcm", data: pcmData };
79
+ * liveSession.sendAudioRealtime(blob);
80
+ * ```
81
+ *
82
+ * @param blob - The base64-encoded PCM data to send to the server in realtime.
68
83
  * @throws If this session has been closed.
69
84
  *
70
85
  * @beta
71
86
  */
72
- sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
87
+ sendAudioRealtime(blob: GenerativeContentBlob): Promise<void>;
73
88
  /**
74
- * Sends a stream of {@link GenerativeContentBlob}.
89
+ * Sends video data to the server in realtime.
75
90
  *
76
- * @param mediaChunkStream - The stream of {@link GenerativeContentBlob} to send.
91
+ * @remarks The server requires that the video is sent as individual video frames at 1 FPS. It
92
+ * is recommended to set `mimeType` to `image/jpeg`.
93
+ *
94
+ * @example
95
+ * ```javascript
96
+ * // const videoFrame = ... base64-encoded JPEG data
97
+ * const blob = { mimeType: "image/jpeg", data: videoFrame };
98
+ * liveSession.sendVideoRealtime(blob);
99
+ * ```
100
+ * @param blob - The base64-encoded video data to send to the server in realtime.
77
101
  * @throws If this session has been closed.
78
102
  *
79
103
  * @beta
80
104
  */
81
- sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
105
+ sendVideoRealtime(blob: GenerativeContentBlob): Promise<void>;
106
+ /**
107
+ * Sends function responses to the server.
108
+ *
109
+ * @param functionResponses - The function responses to send.
110
+ * @throws If this session has been closed.
111
+ *
112
+ * @beta
113
+ */
114
+ sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
82
115
  /**
83
116
  * Yields messages received from the server.
84
117
  * This can only be used by one consumer at a time.
@@ -96,4 +129,26 @@ export declare class LiveSession {
96
129
  * @beta
97
130
  */
98
131
  close(): Promise<void>;
132
+ /**
133
+ * Sends realtime input to the server.
134
+ *
135
+ * @deprecated Use `sendTextRealtime()`, `sendAudioRealtime()`, and `sendVideoRealtime()` instead.
136
+ *
137
+ * @param mediaChunks - The media chunks to send.
138
+ * @throws If this session has been closed.
139
+ *
140
+ * @beta
141
+ */
142
+ sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
143
+ /**
144
+ * @deprecated Use `sendTextRealtime()`, `sendAudioRealtime()`, and `sendVideoRealtime()` instead.
145
+ *
146
+ * Sends a stream of {@link GenerativeContentBlob}.
147
+ *
148
+ * @param mediaChunkStream - The stream of {@link GenerativeContentBlob} to send.
149
+ * @throws If this session has been closed.
150
+ *
151
+ * @beta
152
+ */
153
+ sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
99
154
  }
@@ -34,7 +34,13 @@ export interface _LiveClientContent {
34
34
  */
35
35
  export interface _LiveClientRealtimeInput {
36
36
  realtimeInput: {
37
- mediaChunks: GenerativeContentBlob[];
37
+ text?: string;
38
+ audio?: GenerativeContentBlob;
39
+ video?: GenerativeContentBlob;
40
+ /**
41
+ * @deprecated Use `text`, `audio`, and `video` instead.
42
+ */
43
+ mediaChunks?: GenerativeContentBlob[];
38
44
  };
39
45
  }
40
46
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/ai",
3
- "version": "2.4.0-canary.44d9891f9",
3
+ "version": "2.4.0-canary.8209266c6",
4
4
  "description": "The Firebase AI SDK",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "engines": {
@@ -48,19 +48,19 @@
48
48
  "trusted-type-check": "tsec -p tsconfig.json --noEmit"
49
49
  },
50
50
  "peerDependencies": {
51
- "@firebase/app": "0.14.4-canary.44d9891f9",
52
- "@firebase/app-types": "0.9.3-canary.44d9891f9"
51
+ "@firebase/app": "0.14.4-canary.8209266c6",
52
+ "@firebase/app-types": "0.9.3-canary.8209266c6"
53
53
  },
54
54
  "dependencies": {
55
- "@firebase/app-check-interop-types": "0.3.3-canary.44d9891f9",
56
- "@firebase/component": "0.7.0-canary.44d9891f9",
57
- "@firebase/logger": "0.5.0-canary.44d9891f9",
58
- "@firebase/util": "1.13.0-canary.44d9891f9",
55
+ "@firebase/app-check-interop-types": "0.3.3-canary.8209266c6",
56
+ "@firebase/component": "0.7.0-canary.8209266c6",
57
+ "@firebase/logger": "0.5.0-canary.8209266c6",
58
+ "@firebase/util": "1.13.0-canary.8209266c6",
59
59
  "tslib": "^2.1.0"
60
60
  },
61
61
  "license": "Apache-2.0",
62
62
  "devDependencies": {
63
- "@firebase/app": "0.14.4-canary.44d9891f9",
63
+ "@firebase/app": "0.14.4-canary.8209266c6",
64
64
  "@rollup/plugin-json": "6.1.0",
65
65
  "rollup": "2.79.2",
66
66
  "rollup-plugin-replace": "2.2.0",