@firebase/ai 2.7.0-canary.817151ee9 → 2.7.0-canary.b10a296fa

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.
@@ -21,6 +21,7 @@ export declare const STAGING_URL = "https://staging-firebasevertexai.sandbox.goo
21
21
  export declare const DEFAULT_API_VERSION = "v1beta";
22
22
  export declare const PACKAGE_VERSION: string;
23
23
  export declare const LANGUAGE_TAG = "gl-js";
24
+ export declare const HYBRID_TAG = "hybrid";
24
25
  export declare const DEFAULT_FETCH_TIMEOUT_MS: number;
25
26
  /**
26
27
  * Defines the name of the default in-cloud model to use for hybrid inference.
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { FunctionResponse, GenerativeContentBlob, LiveServerContent, LiveServerToolCall, LiveServerToolCallCancellation, Part } from '../public-types';
17
+ import { FunctionResponse, GenerativeContentBlob, LiveServerContent, LiveServerGoingAwayNotice, LiveServerToolCall, LiveServerToolCallCancellation, Part } from '../public-types';
18
18
  import { WebSocketHandler } from '../websocket';
19
19
  /**
20
20
  * Represents an active, real-time, bidirectional conversation with the model.
@@ -121,7 +121,7 @@ export declare class LiveSession {
121
121
  *
122
122
  * @beta
123
123
  */
124
- receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation>;
124
+ receive(): AsyncGenerator<LiveServerContent | LiveServerToolCall | LiveServerToolCallCancellation | LiveServerGoingAwayNotice>;
125
125
  /**
126
126
  * Closes this session.
127
127
  * All methods on this session will throw an error once this resolves.
@@ -138,7 +138,7 @@ export interface FileDataPart {
138
138
  /**
139
139
  * Represents the code that is executed by the model.
140
140
  *
141
- * @beta
141
+ * @public
142
142
  */
143
143
  export interface ExecutableCodePart {
144
144
  text?: never;
@@ -157,7 +157,7 @@ export interface ExecutableCodePart {
157
157
  /**
158
158
  * Represents the code execution result from the model.
159
159
  *
160
- * @beta
160
+ * @public
161
161
  */
162
162
  export interface CodeExecutionResultPart {
163
163
  text?: never;
@@ -176,7 +176,7 @@ export interface CodeExecutionResultPart {
176
176
  /**
177
177
  * An interface for executable code returned by the model.
178
178
  *
179
- * @beta
179
+ * @public
180
180
  */
181
181
  export interface ExecutableCode {
182
182
  /**
@@ -191,7 +191,7 @@ export interface ExecutableCode {
191
191
  /**
192
192
  * The results of code execution run by the model.
193
193
  *
194
- * @beta
194
+ * @public
195
195
  */
196
196
  export interface CodeExecutionResult {
197
197
  /**
@@ -367,7 +367,7 @@ export type InferenceSource = (typeof InferenceSource)[keyof typeof InferenceSou
367
367
  /**
368
368
  * Represents the result of the code execution.
369
369
  *
370
- * @beta
370
+ * @public
371
371
  */
372
372
  export declare const Outcome: {
373
373
  UNSPECIFIED: string;
@@ -378,13 +378,13 @@ export declare const Outcome: {
378
378
  /**
379
379
  * Represents the result of the code execution.
380
380
  *
381
- * @beta
381
+ * @public
382
382
  */
383
383
  export type Outcome = (typeof Outcome)[keyof typeof Outcome];
384
384
  /**
385
385
  * The programming language of the code.
386
386
  *
387
- * @beta
387
+ * @public
388
388
  */
389
389
  export declare const Language: {
390
390
  UNSPECIFIED: string;
@@ -393,7 +393,7 @@ export declare const Language: {
393
393
  /**
394
394
  * The programming language of the code.
395
395
  *
396
- * @beta
396
+ * @public
397
397
  */
398
398
  export type Language = (typeof Language)[keyof typeof Language];
399
399
  /**
@@ -17,6 +17,7 @@
17
17
  import { AppCheckTokenResult } from '@firebase/app-check-interop-types';
18
18
  import { FirebaseAuthTokenData } from '@firebase/auth-interop-types';
19
19
  import { Backend } from '../backend';
20
+ import { InferenceMode } from './enums';
20
21
  export * from './imagen/internal';
21
22
  export interface ApiSettings {
22
23
  apiKey: string;
@@ -30,4 +31,5 @@ export interface ApiSettings {
30
31
  backend: Backend;
31
32
  getAuthToken?: () => Promise<FirebaseAuthTokenData | null>;
32
33
  getAppCheckToken?: () => Promise<AppCheckTokenResult>;
34
+ inferenceMode?: InferenceMode;
33
35
  }
@@ -118,6 +118,18 @@ export interface UsageMetadata {
118
118
  * A list of tokens used by tools, broken down by modality.
119
119
  */
120
120
  toolUsePromptTokensDetails?: ModalityTokenCount[];
121
+ /**
122
+ * The number of tokens in the prompt that were served from the cache.
123
+ * If implicit caching is not active or no content was cached,
124
+ * this will be 0.
125
+ */
126
+ cachedContentTokenCount?: number;
127
+ /**
128
+ * Detailed breakdown of the cached tokens by modality (for example, text or
129
+ * image). This list provides granular insight into which parts of
130
+ * the content were cached.
131
+ */
132
+ cacheTokensDetails?: ModalityTokenCount[];
121
133
  }
122
134
  /**
123
135
  * Represents token counting info for a single modality.
@@ -341,7 +353,7 @@ export interface Segment {
341
353
  /**
342
354
  * Metadata related to {@link URLContextTool}.
343
355
  *
344
- * @beta
356
+ * @public
345
357
  */
346
358
  export interface URLContextMetadata {
347
359
  /**
@@ -352,7 +364,7 @@ export interface URLContextMetadata {
352
364
  /**
353
365
  * Metadata for a single URL retrieved by the {@link URLContextTool} tool.
354
366
  *
355
- * @beta
367
+ * @public
356
368
  */
357
369
  export interface URLMetadata {
358
370
  /**
@@ -379,7 +391,7 @@ export interface URLMetadata {
379
391
  * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
380
392
  * <br/>
381
393
  *
382
- * @beta
394
+ * @public
383
395
  */
384
396
  export declare const URLRetrievalStatus: {
385
397
  /**
@@ -418,7 +430,7 @@ export declare const URLRetrievalStatus: {
418
430
  * <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
419
431
  * <br/>
420
432
  *
421
- * @beta
433
+ * @public
422
434
  */
423
435
  export type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
424
436
  /**
@@ -562,6 +574,18 @@ export interface LiveServerToolCallCancellation {
562
574
  */
563
575
  functionIds: string[];
564
576
  }
577
+ /**
578
+ * Notification that the server will not be able to service the client soon.
579
+ *
580
+ * @beta
581
+ */
582
+ export interface LiveServerGoingAwayNotice {
583
+ type: 'goingAwayNotice';
584
+ /**
585
+ * The remaining time (in seconds) before the connection will be terminated.
586
+ */
587
+ timeLeft: number;
588
+ }
565
589
  /**
566
590
  * The types of responses that can be returned by {@link LiveSession.receive}.
567
591
  *
@@ -571,6 +595,7 @@ export declare const LiveResponseType: {
571
595
  SERVER_CONTENT: string;
572
596
  TOOL_CALL: string;
573
597
  TOOL_CALL_CANCELLATION: string;
598
+ GOING_AWAY_NOTICE: string;
574
599
  };
575
600
  /**
576
601
  * The types of responses that can be returned by {@link LiveSession.receive}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/ai",
3
- "version": "2.7.0-canary.817151ee9",
3
+ "version": "2.7.0-canary.b10a296fa",
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.7-canary.817151ee9",
52
- "@firebase/app-types": "0.9.3-canary.817151ee9"
51
+ "@firebase/app": "0.14.7-canary.b10a296fa",
52
+ "@firebase/app-types": "0.9.3-canary.b10a296fa"
53
53
  },
54
54
  "dependencies": {
55
- "@firebase/app-check-interop-types": "0.3.3-canary.817151ee9",
56
- "@firebase/component": "0.7.0-canary.817151ee9",
57
- "@firebase/logger": "0.5.0-canary.817151ee9",
58
- "@firebase/util": "1.13.0-canary.817151ee9",
55
+ "@firebase/app-check-interop-types": "0.3.3-canary.b10a296fa",
56
+ "@firebase/component": "0.7.0-canary.b10a296fa",
57
+ "@firebase/logger": "0.5.0-canary.b10a296fa",
58
+ "@firebase/util": "1.13.0-canary.b10a296fa",
59
59
  "tslib": "^2.1.0"
60
60
  },
61
61
  "license": "Apache-2.0",
62
62
  "devDependencies": {
63
- "@firebase/app": "0.14.7-canary.817151ee9",
63
+ "@firebase/app": "0.14.7-canary.b10a296fa",
64
64
  "@rollup/plugin-json": "6.1.0",
65
65
  "rollup": "2.79.2",
66
66
  "rollup-plugin-replace": "2.2.0",