@firebase/ai 2.1.0-canary.44d8d742f → 2.1.0-firebase-studio-sdk-integration.f7536090e
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.
- package/dist/ai-public.d.ts +10 -5
- package/dist/ai.d.ts +10 -5
- package/dist/esm/index.esm.js +24 -22
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/methods/chrome-adapter.d.ts +23 -21
- package/dist/esm/src/types/chrome-adapter.d.ts +6 -4
- package/dist/esm/src/types/requests.d.ts +4 -1
- package/dist/index.cjs.js +24 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +24 -22
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +24 -22
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/methods/chrome-adapter.d.ts +23 -21
- package/dist/src/types/chrome-adapter.d.ts +6 -4
- package/dist/src/types/requests.d.ts +4 -1
- package/package.json +8 -8
package/dist/ai-public.d.ts
CHANGED
|
@@ -320,16 +320,18 @@ export declare interface ChromeAdapter {
|
|
|
320
320
|
/**
|
|
321
321
|
* Generates content using on-device inference.
|
|
322
322
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
323
|
+
* @remarks
|
|
324
|
+
* This is comparable to {@link GenerativeModel.generateContent} for generating
|
|
325
|
+
* content using in-cloud inference.
|
|
325
326
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
326
327
|
*/
|
|
327
328
|
generateContent(request: GenerateContentRequest): Promise<Response>;
|
|
328
329
|
/**
|
|
329
330
|
* Generates a content stream using on-device inference.
|
|
330
331
|
*
|
|
331
|
-
*
|
|
332
|
-
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* This is comparable to {@link GenerativeModel.generateContentStream} for generating
|
|
334
|
+
* a content stream using in-cloud inference.
|
|
333
335
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
334
336
|
*/
|
|
335
337
|
generateContentStream(request: GenerateContentRequest): Promise<Response>;
|
|
@@ -1904,7 +1906,10 @@ export declare interface RequestOptions {
|
|
|
1904
1906
|
*/
|
|
1905
1907
|
timeout?: number;
|
|
1906
1908
|
/**
|
|
1907
|
-
* Base url for endpoint. Defaults to
|
|
1909
|
+
* Base url for endpoint. Defaults to
|
|
1910
|
+
* https://firebasevertexai.googleapis.com, which is the
|
|
1911
|
+
* {@link https://console.cloud.google.com/apis/library/firebasevertexai.googleapis.com?project=_ | Firebase AI Logic API}
|
|
1912
|
+
* (used regardless of your chosen Gemini API provider).
|
|
1908
1913
|
*/
|
|
1909
1914
|
baseUrl?: string;
|
|
1910
1915
|
}
|
package/dist/ai.d.ts
CHANGED
|
@@ -360,16 +360,18 @@ export declare interface ChromeAdapter {
|
|
|
360
360
|
/**
|
|
361
361
|
* Generates content using on-device inference.
|
|
362
362
|
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
363
|
+
* @remarks
|
|
364
|
+
* This is comparable to {@link GenerativeModel.generateContent} for generating
|
|
365
|
+
* content using in-cloud inference.
|
|
365
366
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
366
367
|
*/
|
|
367
368
|
generateContent(request: GenerateContentRequest): Promise<Response>;
|
|
368
369
|
/**
|
|
369
370
|
* Generates a content stream using on-device inference.
|
|
370
371
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
372
|
+
* @remarks
|
|
373
|
+
* This is comparable to {@link GenerativeModel.generateContentStream} for generating
|
|
374
|
+
* a content stream using in-cloud inference.
|
|
373
375
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
374
376
|
*/
|
|
375
377
|
generateContentStream(request: GenerateContentRequest): Promise<Response>;
|
|
@@ -2003,7 +2005,10 @@ export declare interface RequestOptions {
|
|
|
2003
2005
|
*/
|
|
2004
2006
|
timeout?: number;
|
|
2005
2007
|
/**
|
|
2006
|
-
* Base url for endpoint. Defaults to
|
|
2008
|
+
* Base url for endpoint. Defaults to
|
|
2009
|
+
* https://firebasevertexai.googleapis.com, which is the
|
|
2010
|
+
* {@link https://console.cloud.google.com/apis/library/firebasevertexai.googleapis.com?project=_ | Firebase AI Logic API}
|
|
2011
|
+
* (used regardless of your chosen Gemini API provider).
|
|
2007
2012
|
*/
|
|
2008
2013
|
baseUrl?: string;
|
|
2009
2014
|
}
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { FirebaseError, getModularInstance } from '@firebase/util';
|
|
|
4
4
|
import { Logger } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
var name = "@firebase/ai";
|
|
7
|
-
var version = "2.1.0-
|
|
7
|
+
var version = "2.1.0-firebase-studio-sdk-integration.f7536090e";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -2369,17 +2369,17 @@ class ChromeAdapterImpl {
|
|
|
2369
2369
|
/**
|
|
2370
2370
|
* Checks if a given request can be made on-device.
|
|
2371
2371
|
*
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
* </ol>
|
|
2372
|
+
* Encapsulates a few concerns:
|
|
2373
|
+
* the mode
|
|
2374
|
+
* API existence
|
|
2375
|
+
* prompt formatting
|
|
2376
|
+
* model availability, including triggering download if necessary
|
|
2378
2377
|
*
|
|
2379
|
-
*
|
|
2380
|
-
*
|
|
2378
|
+
*
|
|
2379
|
+
* Pros: callers needn't be concerned with details of on-device availability.</p>
|
|
2380
|
+
* Cons: this method spans a few concerns and splits request validation from usage.
|
|
2381
2381
|
* If instance variables weren't already part of the API, we could consider a better
|
|
2382
|
-
* separation of concerns
|
|
2382
|
+
* separation of concerns.
|
|
2383
2383
|
*/
|
|
2384
2384
|
async isAvailable(request) {
|
|
2385
2385
|
if (!this.mode) {
|
|
@@ -2420,8 +2420,9 @@ class ChromeAdapterImpl {
|
|
|
2420
2420
|
/**
|
|
2421
2421
|
* Generates content on device.
|
|
2422
2422
|
*
|
|
2423
|
-
*
|
|
2424
|
-
*
|
|
2423
|
+
* @remarks
|
|
2424
|
+
* This is comparable to {@link GenerativeModel.generateContent} for generating content in
|
|
2425
|
+
* Cloud.
|
|
2425
2426
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
2426
2427
|
* @returns {@link Response}, so we can reuse common response formatting.
|
|
2427
2428
|
*/
|
|
@@ -2434,8 +2435,9 @@ class ChromeAdapterImpl {
|
|
|
2434
2435
|
/**
|
|
2435
2436
|
* Generates content stream on device.
|
|
2436
2437
|
*
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2438
|
+
* @remarks
|
|
2439
|
+
* This is comparable to {@link GenerativeModel.generateContentStream} for generating content in
|
|
2440
|
+
* Cloud.
|
|
2439
2441
|
* @param request - a standard Firebase AI {@link GenerateContentRequest}
|
|
2440
2442
|
* @returns {@link Response}, so we can reuse common response formatting.
|
|
2441
2443
|
*/
|
|
@@ -2486,11 +2488,11 @@ class ChromeAdapterImpl {
|
|
|
2486
2488
|
/**
|
|
2487
2489
|
* Triggers out-of-band download of an on-device model.
|
|
2488
2490
|
*
|
|
2489
|
-
*
|
|
2490
|
-
* LanguageModel.create
|
|
2491
|
+
* Chrome only downloads models as needed. Chrome knows a model is needed when code calls
|
|
2492
|
+
* LanguageModel.create.
|
|
2491
2493
|
*
|
|
2492
|
-
*
|
|
2493
|
-
* tracking if a download has previously been requested
|
|
2494
|
+
* Since Chrome manages the download, the SDK can only avoid redundant download requests by
|
|
2495
|
+
* tracking if a download has previously been requested.
|
|
2494
2496
|
*/
|
|
2495
2497
|
download() {
|
|
2496
2498
|
if (this.isDownloading) {
|
|
@@ -2544,12 +2546,12 @@ class ChromeAdapterImpl {
|
|
|
2544
2546
|
/**
|
|
2545
2547
|
* Abstracts Chrome session creation.
|
|
2546
2548
|
*
|
|
2547
|
-
*
|
|
2549
|
+
* Chrome uses a multi-turn session for all inference. Firebase AI uses single-turn for all
|
|
2548
2550
|
* inference. To map the Firebase AI API to Chrome's API, the SDK creates a new session for all
|
|
2549
|
-
* inference
|
|
2551
|
+
* inference.
|
|
2550
2552
|
*
|
|
2551
|
-
*
|
|
2552
|
-
* new session is created before an old session is destroyed
|
|
2553
|
+
* Chrome will remove a model from memory if it's no longer in use, so this method ensures a
|
|
2554
|
+
* new session is created before an old session is destroyed.
|
|
2553
2555
|
*/
|
|
2554
2556
|
async createSession() {
|
|
2555
2557
|
if (!this.languageModelProvider) {
|