Skip to content

Commit 5ddf24c

Browse files
pashankagsiddh
authored andcommitted
Complete Hybrid inference impl
Fix languageCode parameter in action_code_url (#8912) * Fix languageCode parameter in action_code_url * Add changeset Vaihi add langmodel types. (#8927) * Adding LanguageModel types. These are based off https://github.com/webmachinelearning/prompt-api?tab=readme-ov-file#full-api-surface-in-web-idl * Adding LanguageModel types. * Remove bunch of exports * yarn formatted * after lint Define HybridParams (#8935) Co-authored-by: Erik Eldridge <[email protected]> Adding smoke test for new hybrid params (#8937) * Adding smoke test for new hybrid params * Use the existing name of the model params input --------- Co-authored-by: Erik Eldridge <[email protected]> Moving to in-cloud naming (#8938) Co-authored-by: Erik Eldridge <[email protected]> Moving to string type for the inference mode (#8941) Define ChromeAdapter class (#8942) Co-authored-by: Erik Eldridge <[email protected]> VinF Hybrid Inference: Implement ChromeAdapter (rebased) (#8943) Adding count token impl (#8950) VinF Hybrid Inference #4: ChromeAdapter in stream methods (rebased) (#8949) Define values for Availability enum (#8951) VinF Hybrid Inference: narrow Chrome input type (#8953) Add image inference support (#8954) * Adding image based input for inference * adding image as input to create language model object disable count tokens api for on-device inference (#8962) VinF Hybrid Inference: throw if only_on_device and model is unavailable (#8965) VinF Hybrid Inference: update docs (#8970) VinF Hybrid Inference: consolidate onDeviceParams initialization (#8969) VinF Hybrid Inference: disable multi-turn support (#8973) VinF Hybrid Inference: remove default expected input types (#8974) VinF Hybrid Inference: set image (and text) as default input type (#8984) VinF Hybrid Inference: log debug messages in conditional logic (#8992)
1 parent a516771 commit 5ddf24c

24 files changed

+1459
-118
lines changed

common/api-review/vertexai.api.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ export class BooleanSchema extends Schema {
112112

113113
// @public
114114
export class ChatSession {
115-
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
115+
// Warning: (ae-forgotten-export) The symbol "ChromeAdapter" needs to be exported by the entry point index.d.ts
116+
constructor(apiSettings: ApiSettings, model: string, chromeAdapter: ChromeAdapter, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
116117
getHistory(): Promise<Content[]>;
117118
// (undocumented)
118119
model: string;
@@ -392,8 +393,9 @@ export interface GenerativeContentBlob {
392393

393394
// @public
394395
export class GenerativeModel extends AIModel {
395-
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions);
396+
constructor(ai: AI, modelParams: ModelParams, chromeAdapter: ChromeAdapter, requestOptions?: RequestOptions);
396397
countTokens(request: CountTokensRequest | string | Array<string | Part>): Promise<CountTokensResponse>;
398+
static DEFAULT_HYBRID_IN_CLOUD_MODEL: string;
397399
generateContent(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentResult>;
398400
generateContentStream(request: GenerateContentRequest | string | Array<string | Part>): Promise<GenerateContentStreamResult>;
399401
// (undocumented)
@@ -415,7 +417,7 @@ export class GenerativeModel extends AIModel {
415417
export function getAI(app?: FirebaseApp, options?: AIOptions): AI;
416418

417419
// @public
418-
export function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
420+
export function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;
419421

420422
// @beta
421423
export function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
@@ -547,6 +549,14 @@ export enum HarmSeverity {
547549
HARM_SEVERITY_UNSUPPORTED = "HARM_SEVERITY_UNSUPPORTED"
548550
}
549551

552+
// @public
553+
export interface HybridParams {
554+
inCloudParams?: ModelParams;
555+
mode: InferenceMode;
556+
// Warning: (ae-forgotten-export) The symbol "LanguageModelCreateOptions" needs to be exported by the entry point index.d.ts
557+
onDeviceParams?: LanguageModelCreateOptions;
558+
}
559+
550560
// @beta
551561
export enum ImagenAspectRatio {
552562
LANDSCAPE_16x9 = "16:9",
@@ -631,6 +641,9 @@ export interface ImagenSafetySettings {
631641
safetyFilterLevel?: ImagenSafetyFilterLevel;
632642
}
633643

644+
// @public
645+
export type InferenceMode = 'prefer_on_device' | 'only_on_device' | 'only_in_cloud';
646+
634647
// @public
635648
export interface InlineDataPart {
636649
// (undocumented)

docs-devsite/_toc.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ toc:
530530
path: /docs/reference/js/vertexai.groundingattribution.md
531531
- title: GroundingMetadata
532532
path: /docs/reference/js/vertexai.groundingmetadata.md
533+
- title: HybridParams
534+
path: /docs/reference/js/vertexai.hybridparams.md
533535
- title: ImagenGCSImage
534536
path: /docs/reference/js/vertexai.imagengcsimage.md
535537
- title: ImagenGenerationConfig

docs-devsite/vertexai.chatsession.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export declare class ChatSession
2222

2323
| Constructor | Modifiers | Description |
2424
| --- | --- | --- |
25-
| [(constructor)(apiSettings, model, params, requestOptions)](./vertexai.chatsession.md#chatsessionconstructor) | | Constructs a new instance of the <code>ChatSession</code> class |
25+
| [(constructor)(apiSettings, model, chromeAdapter, params, requestOptions)](./vertexai.chatsession.md#chatsessionconstructor) | | Constructs a new instance of the <code>ChatSession</code> class |
2626

2727
## Properties
2828

@@ -47,7 +47,7 @@ Constructs a new instance of the `ChatSession` class
4747
<b>Signature:</b>
4848

4949
```typescript
50-
constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
50+
constructor(apiSettings: ApiSettings, model: string, chromeAdapter: ChromeAdapter, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
5151
```
5252

5353
#### Parameters
@@ -56,6 +56,7 @@ constructor(apiSettings: ApiSettings, model: string, params?: StartChatParams |
5656
| --- | --- | --- |
5757
| apiSettings | ApiSettings | |
5858
| model | string | |
59+
| chromeAdapter | ChromeAdapter | |
5960
| params | [StartChatParams](./vertexai.startchatparams.md#startchatparams_interface) \| undefined | |
6061
| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) \| undefined | |
6162

docs-devsite/vertexai.generativemodel.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ export declare class GenerativeModel extends AIModel
2323
2424
| Constructor | Modifiers | Description |
2525
| --- | --- | --- |
26-
| [(constructor)(ai, modelParams, requestOptions)](./vertexai.generativemodel.md#generativemodelconstructor) | | Constructs a new instance of the <code>GenerativeModel</code> class |
26+
| [(constructor)(ai, modelParams, chromeAdapter, requestOptions)](./vertexai.generativemodel.md#generativemodelconstructor) | | Constructs a new instance of the <code>GenerativeModel</code> class |
2727
2828
## Properties
2929
3030
| Property | Modifiers | Type | Description |
3131
| --- | --- | --- | --- |
32+
| [DEFAULT\_HYBRID\_IN\_CLOUD\_MODEL](./vertexai.generativemodel.md#generativemodeldefault_hybrid_in_cloud_model) | <code>static</code> | string | Defines the name of the default in-cloud model to use for hybrid inference. |
3233
| [generationConfig](./vertexai.generativemodel.md#generativemodelgenerationconfig) | | [GenerationConfig](./vertexai.generationconfig.md#generationconfig_interface) | |
3334
| [requestOptions](./vertexai.generativemodel.md#generativemodelrequestoptions) | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | |
3435
| [safetySettings](./vertexai.generativemodel.md#generativemodelsafetysettings) | | [SafetySetting](./vertexai.safetysetting.md#safetysetting_interface)<!-- -->\[\] | |
@@ -52,7 +53,7 @@ Constructs a new instance of the `GenerativeModel` class
5253
<b>Signature:</b>
5354
5455
```typescript
55-
constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions);
56+
constructor(ai: AI, modelParams: ModelParams, chromeAdapter: ChromeAdapter, requestOptions?: RequestOptions);
5657
```
5758
5859
#### Parameters
@@ -61,8 +62,19 @@ constructor(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions);
6162
| --- | --- | --- |
6263
| ai | [AI](./vertexai.ai.md#ai_interface) | |
6364
| modelParams | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | |
65+
| chromeAdapter | ChromeAdapter | |
6466
| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | |
6567
68+
## GenerativeModel.DEFAULT\_HYBRID\_IN\_CLOUD\_MODEL
69+
70+
Defines the name of the default in-cloud model to use for hybrid inference.
71+
72+
<b>Signature:</b>
73+
74+
```typescript
75+
static DEFAULT_HYBRID_IN_CLOUD_MODEL: string;
76+
```
77+
6678
## GenerativeModel.generationConfig
6779
6880
<b>Signature:</b>

docs-devsite/vertexai.hybridparams.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
# HybridParams interface
13+
Toggles hybrid inference.
14+
15+
<b>Signature:</b>
16+
17+
```typescript
18+
export interface HybridParams
19+
```
20+
21+
## Properties
22+
23+
| Property | Type | Description |
24+
| --- | --- | --- |
25+
| [inCloudParams](./vertexai.hybridparams.md#hybridparamsincloudparams) | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Optional. Specifies advanced params for in-cloud inference. |
26+
| [mode](./vertexai.hybridparams.md#hybridparamsmode) | [InferenceMode](./vertexai.md#inferencemode) | Specifies on-device or in-cloud inference. Defaults to prefer on-device. |
27+
| [onDeviceParams](./vertexai.hybridparams.md#hybridparamsondeviceparams) | LanguageModelCreateOptions | Optional. Specifies advanced params for on-device inference. |
28+
29+
## HybridParams.inCloudParams
30+
31+
Optional. Specifies advanced params for in-cloud inference.
32+
33+
<b>Signature:</b>
34+
35+
```typescript
36+
inCloudParams?: ModelParams;
37+
```
38+
39+
## HybridParams.mode
40+
41+
Specifies on-device or in-cloud inference. Defaults to prefer on-device.
42+
43+
<b>Signature:</b>
44+
45+
```typescript
46+
mode: InferenceMode;
47+
```
48+
49+
## HybridParams.onDeviceParams
50+
51+
Optional. Specifies advanced params for on-device inference.
52+
53+
<b>Signature:</b>
54+
55+
```typescript
56+
onDeviceParams?: LanguageModelCreateOptions;
57+
```

docs-devsite/vertexai.md

+18-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The Firebase AI Web SDK.
2020
| [getAI(app, options)](./vertexai.md#getai_a94a413) | Returns the default [AI](./vertexai.ai.md#ai_interface) instance that is associated with the provided [FirebaseApp](./app.firebaseapp.md#firebaseapp_interface)<!-- -->. If no instance exists, initializes a new instance with the default settings. |
2121
| [getVertexAI(app, options)](./vertexai.md#getvertexai_04094cf) | It is recommended to use the new [getAI()](./vertexai.md#getai_a94a413)<!-- -->.<!-- -->Returns a [VertexAI](./vertexai.md#vertexai) instance for the given app, configured to use the Vertex AI Gemini API. This instance will be configured to use the Vertex AI Gemini API. |
2222
| <b>function(ai, ...)</b> |
23-
| [getGenerativeModel(ai, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_80bd839) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. |
23+
| [getGenerativeModel(ai, modelParams, requestOptions)](./vertexai.md#getgenerativemodel_c63f46a) | Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality. |
2424
| [getImagenModel(ai, modelParams, requestOptions)](./vertexai.md#getimagenmodel_e1f6645) | <b><i>(Public Preview)</i></b> Returns an [ImagenModel](./vertexai.imagenmodel.md#imagenmodel_class) class with methods for using Imagen.<!-- -->Only Imagen 3 models (named <code>imagen-3.0-*</code>) are supported. |
2525

2626
## Classes
@@ -97,6 +97,7 @@ The Firebase AI Web SDK.
9797
| [GenerativeContentBlob](./vertexai.generativecontentblob.md#generativecontentblob_interface) | Interface for sending an image. |
9898
| [GroundingAttribution](./vertexai.groundingattribution.md#groundingattribution_interface) | |
9999
| [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. |
100+
| [HybridParams](./vertexai.hybridparams.md#hybridparams_interface) | Toggles hybrid inference. |
100101
| [ImagenGCSImage](./vertexai.imagengcsimage.md#imagengcsimage_interface) | An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.<!-- -->This feature is not available yet. |
101102
| [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface) | <b><i>(Public Preview)</i></b> Configuration options for generating images with Imagen.<!-- -->See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images-imagen) for more details. |
102103
| [ImagenGenerationResponse](./vertexai.imagengenerationresponse.md#imagengenerationresponse_interface) | <b><i>(Public Preview)</i></b> The response from a request to generate images with Imagen. |
@@ -105,10 +106,10 @@ The Firebase AI Web SDK.
105106
| [ImagenSafetySettings](./vertexai.imagensafetysettings.md#imagensafetysettings_interface) | <b><i>(Public Preview)</i></b> Settings for controlling the aggressiveness of filtering out sensitive content.<!-- -->See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details. |
106107
| [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. |
107108
| [ModalityTokenCount](./vertexai.modalitytokencount.md#modalitytokencount_interface) | Represents token counting info for a single modality. |
108-
| [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_80bd839)<!-- -->. |
109+
| [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_c63f46a)<!-- -->. |
109110
| [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. |
110111
| [PromptFeedback](./vertexai.promptfeedback.md#promptfeedback_interface) | If the prompt was blocked, this will be populated with <code>blockReason</code> and the relevant <code>safetyRatings</code>. |
111-
| [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_80bd839)<!-- -->. |
112+
| [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_c63f46a)<!-- -->. |
112113
| [RetrievedContextAttribution](./vertexai.retrievedcontextattribution.md#retrievedcontextattribution_interface) | |
113114
| [SafetyRating](./vertexai.safetyrating.md#safetyrating_interface) | A safety rating associated with a [GenerateContentCandidate](./vertexai.generatecontentcandidate.md#generatecontentcandidate_interface) |
114115
| [SafetySetting](./vertexai.safetysetting.md#safetysetting_interface) | Safety setting that can be sent as part of request parameters. |
@@ -139,6 +140,7 @@ The Firebase AI Web SDK.
139140
| Type Alias | Description |
140141
| --- | --- |
141142
| [BackendType](./vertexai.md#backendtype) | Type alias representing valid backend types. It can be either <code>'VERTEX_AI'</code> or <code>'GOOGLE_AI'</code>. |
143+
| [InferenceMode](./vertexai.md#inferencemode) | Determines whether inference happens on-device or in-cloud. |
142144
| [Part](./vertexai.md#part) | Content part - includes text, image/video, or function call/response part types. |
143145
| [Role](./vertexai.md#role) | Role is the producer of the content. |
144146
| [Tool](./vertexai.md#tool) | Defines a tool that model can call to access external knowledge. |
@@ -221,22 +223,22 @@ export declare function getVertexAI(app?: FirebaseApp, options?: VertexAIOptions
221223

222224
## function(ai, ...)
223225

224-
### getGenerativeModel(ai, modelParams, requestOptions) {:#getgenerativemodel_80bd839}
226+
### getGenerativeModel(ai, modelParams, requestOptions) {:#getgenerativemodel_c63f46a}
225227

226228
Returns a [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) class with methods for inference and other functionality.
227229

228230
<b>Signature:</b>
229231

230232
```typescript
231-
export declare function getGenerativeModel(ai: AI, modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
233+
export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | HybridParams, requestOptions?: RequestOptions): GenerativeModel;
232234
```
233235

234236
#### Parameters
235237

236238
| Parameter | Type | Description |
237239
| --- | --- | --- |
238240
| ai | [AI](./vertexai.ai.md#ai_interface) | |
239-
| modelParams | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | |
241+
| modelParams | [ModelParams](./vertexai.modelparams.md#modelparams_interface) \| [HybridParams](./vertexai.hybridparams.md#hybridparams_interface) | |
240242
| requestOptions | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | |
241243

242244
<b>Returns:</b>
@@ -333,6 +335,16 @@ Type alias representing valid backend types. It can be either `'VERTEX_AI'` or `
333335
export type BackendType = (typeof BackendType)[keyof typeof BackendType];
334336
```
335337

338+
## InferenceMode
339+
340+
Determines whether inference happens on-device or in-cloud.
341+
342+
<b>Signature:</b>
343+
344+
```typescript
345+
export type InferenceMode = 'prefer_on_device' | 'only_on_device' | 'only_in_cloud';
346+
```
347+
336348
## Part
337349

338350
Content part - includes text, image/video, or function call/response part types.

docs-devsite/vertexai.modelparams.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# ModelParams interface
13-
Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_80bd839)<!-- -->.
13+
Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_c63f46a)<!-- -->.
1414

1515
<b>Signature:</b>
1616

docs-devsite/vertexai.requestoptions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk
1010
{% endcomment %}
1111

1212
# RequestOptions interface
13-
Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_80bd839)<!-- -->.
13+
Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_c63f46a)<!-- -->.
1414

1515
<b>Signature:</b>
1616

e2e/sample-apps/modular.js

+31-16
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
onValue,
5959
off
6060
} from 'firebase/database';
61-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
61+
import { getGenerativeModel, getVertexAI } from 'firebase/vertexai';
6262
import { getDataConnect, DataConnect } from 'firebase/data-connect';
6363

6464
/**
@@ -313,9 +313,24 @@ function callPerformance(app) {
313313
async function callVertexAI(app) {
314314
console.log('[VERTEXAI] start');
315315
const vertexAI = getVertexAI(app);
316-
const model = getGenerativeModel(vertexAI, { model: 'gemini-1.5-flash' });
317-
const result = await model.countTokens('abcdefg');
318-
console.log(`[VERTEXAI] counted tokens: ${result.totalTokens}`);
316+
const model = getGenerativeModel(vertexAI, {
317+
mode: 'prefer_on_device'
318+
});
319+
const singleResult = await model.generateContent([
320+
{ text: 'describe this 20 x 20 px image in two words' },
321+
{
322+
inlineData: {
323+
mimeType: 'image/heic',
324+
data: 'AAAAGGZ0eXBoZWljAAAAAGhlaWNtaWYxAAAB7G1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAHBpY3QAAAAAAAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAADnBpdG0AAAAAAAEAAAA4aWluZgAAAAAAAgAAABVpbmZlAgAAAAABAABodmMxAAAAABVpbmZlAgAAAQACAABFeGlmAAAAABppcmVmAAAAAAAAAA5jZHNjAAIAAQABAAABD2lwcnAAAADtaXBjbwAAABNjb2xybmNseAACAAIABoAAAAAMY2xsaQDLAEAAAAAUaXNwZQAAAAAAAAAUAAAADgAAAChjbGFwAAAAFAAAAAEAAAANAAAAAQAAAAAAAAAB/8AAAACAAAAAAAAJaXJvdAAAAAAQcGl4aQAAAAADCAgIAAAAcWh2Y0MBA3AAAACwAAAAAAAe8AD8/fj4AAALA6AAAQAXQAEMAf//A3AAAAMAsAAAAwAAAwAecCShAAEAI0IBAQNwAAADALAAAAMAAAMAHqAUIEHAjw1iHuRZVNwICBgCogABAAlEAcBhcshAUyQAAAAaaXBtYQAAAAAAAAABAAEHgQIDhIUGhwAAACxpbG9jAAAAAEQAAAIAAQAAAAEAAAJsAAABDAACAAAAAQAAAhQAAABYAAAAAW1kYXQAAAAAAAABdAAAAAZFeGlmAABNTQAqAAAACAAEARIAAwAAAAEAAQAAARoABQAAAAEAAAA+ARsABQAAAAEAAABGASgAAwAAAAEAAgAAAAAAAAAAAEgAAAABAAAASAAAAAEAAAEIKAGvoR8wDimTiRYUbALiHkU3ZdZ8DXAcSrRB9GARtVQHvnCE0LEyBGAyb5P4eYr6JAK5UxNX10WNlARq3ZpcGeVD+Xom6LodYasuZKKtDHCz/xnswOtC/ksZzVKhtWQqGvkXcsJnLYqWevNkacnccQ95jbHJBg9nXub69jAAN3xhNOXxjGSxaG9QvES5R7sYICEojRjLF5OB5K3v+okQAwfgWpz/u21ayideOgOZQLAyBkKOv7ymLNCagiPWTlHAuy/3qR1Q7m2ERFaxKIAbLSkIVO/P8m8+anKxhzhC//L8NMAUoF+Sf3aEH9O41fwLc+PlcbrDrjgY2EboD3cn9DyN32Rum2Ym'
325+
}
326+
}
327+
]);
328+
console.log(`Generated text: ${singleResult.response.text()}`);
329+
const chat = model.startChat();
330+
let chatResult = await chat.sendMessage('describe red in two words');
331+
chatResult = await chat.sendMessage('describe blue');
332+
console.log('Chat history:', await chat.getHistory());
333+
console.log(`[VERTEXAI] end`);
319334
}
320335

321336
/**
@@ -339,20 +354,20 @@ function callDataConnect(app) {
339354
async function main() {
340355
console.log('FIREBASE VERSION', SDK_VERSION);
341356
const app = initializeApp(config);
342-
setLogLevel('warn');
357+
setLogLevel('debug');
343358

344-
callAppCheck(app);
345-
await authLogin(app);
346-
await callStorage(app);
347-
await callFirestore(app);
348-
await callDatabase(app);
349-
await callMessaging(app);
350-
callAnalytics(app);
351-
callPerformance(app);
352-
await callFunctions(app);
359+
// callAppCheck(app);
360+
// await authLogin(app);
361+
// await callStorage(app);
362+
// await callFirestore(app);
363+
// await callDatabase(app);
364+
// await callMessaging(app);
365+
// callAnalytics(app);
366+
// callPerformance(app);
367+
// await callFunctions(app);
353368
await callVertexAI(app);
354-
callDataConnect(app);
355-
await authLogout(app);
369+
// callDataConnect(app);
370+
// await authLogout(app);
356371
console.log('DONE');
357372
}
358373

0 commit comments

Comments
 (0)