Skip to content

Commit 7b14419

Browse files
committed
Moving to a string type for inference mode
1 parent 40f9882 commit 7b14419

File tree

4 files changed

+21
-39
lines changed

4 files changed

+21
-39
lines changed

common/api-review/vertexai.api.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,7 @@ export interface ImagenSafetySettings {
513513
}
514514

515515
// @public
516-
export enum InferenceMode {
517-
// (undocumented)
518-
ONLY_ON_CLOUD = "ONLY_ON_CLOUD",
519-
// (undocumented)
520-
ONLY_ON_DEVICE = "ONLY_ON_DEVICE",
521-
// (undocumented)
522-
PREFER_ON_DEVICE = "PREFER_ON_DEVICE"
523-
}
516+
export type InferenceMode = 'prefer_on_device' | 'only_on_device' | 'only_in_cloud';
524517

525518
// @public
526519
export interface InlineDataPart {

docs-devsite/vertexai.md

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ The Vertex AI in Firebase Web SDK.
5555
| [ImagenAspectRatio](./vertexai.md#imagenaspectratio) | <b><i>(Public Preview)</i></b> Aspect ratios for Imagen images.<!-- -->To specify an aspect ratio for generated images, set the <code>aspectRatio</code> property in your [ImagenGenerationConfig](./vertexai.imagengenerationconfig.md#imagengenerationconfig_interface)<!-- -->.<!-- -->See the the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) for more details and examples of the supported aspect ratios. |
5656
| [ImagenPersonFilterLevel](./vertexai.md#imagenpersonfilterlevel) | <b><i>(Public Preview)</i></b> A filter level controlling whether generation of images containing people or faces is allowed.<!-- -->See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a> documentation for more details. |
5757
| [ImagenSafetyFilterLevel](./vertexai.md#imagensafetyfilterlevel) | <b><i>(Public Preview)</i></b> A filter level controlling how aggressively to filter sensitive content.<!-- -->Text prompts provided as inputs and images (generated or uploaded) through Imagen on Vertex AI are assessed against a list of safety filters, which include 'harmful categories' (for example, <code>violence</code>, <code>sexual</code>, <code>derogatory</code>, and <code>toxic</code>). This filter level controls how aggressively to filter out potentially harmful content from responses. See the [documentation](http://firebase.google.com/docs/vertex-ai/generate-images) and the [Responsible AI and usage guidelines](https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters) for more details. |
58-
| [InferenceMode](./vertexai.md#inferencemode) | Determines whether inference happens on-device or on-cloud. |
5958
| [Modality](./vertexai.md#modality) | Content part modality. |
6059
| [SchemaType](./vertexai.md#schematype) | Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) |
6160
| [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. |
@@ -132,6 +131,7 @@ The Vertex AI in Firebase Web SDK.
132131

133132
| Type Alias | Description |
134133
| --- | --- |
134+
| [InferenceMode](./vertexai.md#inferencemode) | Determines whether inference happens on-device or in-cloud. |
135135
| [Part](./vertexai.md#part) | Content part - includes text, image/video, or function call/response part types. |
136136
| [Role](./vertexai.md#role) | Role is the producer of the content. |
137137
| [Tool](./vertexai.md#tool) | Defines a tool that model can call to access external knowledge. |
@@ -225,6 +225,16 @@ Possible roles.
225225
POSSIBLE_ROLES: readonly ["user", "model", "function", "system"]
226226
```
227227

228+
## InferenceMode
229+
230+
Determines whether inference happens on-device or in-cloud.
231+
232+
<b>Signature:</b>
233+
234+
```typescript
235+
export type InferenceMode = 'prefer_on_device' | 'only_on_device' | 'only_in_cloud';
236+
```
237+
228238
## Part
229239

230240
Content part - includes text, image/video, or function call/response part types.
@@ -491,24 +501,6 @@ export declare enum ImagenSafetyFilterLevel
491501
| BLOCK\_NONE | <code>&quot;block_none&quot;</code> | <b><i>(Public Preview)</i></b> The least aggressive filtering level; blocks very few sensitive prompts and responses.<!-- -->Access to this feature is restricted and may require your case to be reviewed and approved by Cloud support. |
492502
| BLOCK\_ONLY\_HIGH | <code>&quot;block_only_high&quot;</code> | <b><i>(Public Preview)</i></b> Blocks few sensitive prompts and responses. |
493503

494-
## InferenceMode
495-
496-
Determines whether inference happens on-device or on-cloud.
497-
498-
<b>Signature:</b>
499-
500-
```typescript
501-
export declare enum InferenceMode
502-
```
503-
504-
## Enumeration Members
505-
506-
| Member | Value | Description |
507-
| --- | --- | --- |
508-
| ONLY\_ON\_CLOUD | <code>&quot;ONLY_ON_CLOUD&quot;</code> | |
509-
| ONLY\_ON\_DEVICE | <code>&quot;ONLY_ON_DEVICE&quot;</code> | |
510-
| PREFER\_ON\_DEVICE | <code>&quot;PREFER_ON_DEVICE&quot;</code> | |
511-
512504
## Modality
513505

514506
Content part modality.

packages/vertexai/src/types/enums.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,3 @@ export enum Modality {
240240
*/
241241
DOCUMENT = 'DOCUMENT'
242242
}
243-
244-
/**
245-
* Determines whether inference happens on-device or on-cloud.
246-
* @public
247-
*/
248-
export enum InferenceMode {
249-
PREFER_ON_DEVICE = 'PREFER_ON_DEVICE',
250-
ONLY_ON_DEVICE = 'ONLY_ON_DEVICE',
251-
ONLY_ON_CLOUD = 'ONLY_ON_CLOUD'
252-
}

packages/vertexai/src/types/requests.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ import {
2222
FunctionCallingMode,
2323
HarmBlockMethod,
2424
HarmBlockThreshold,
25-
HarmCategory,
26-
InferenceMode
25+
HarmCategory
2726
} from './enums';
2827
import { ObjectSchemaInterface, SchemaRequest } from './schema';
2928

@@ -225,3 +224,11 @@ export interface HybridParams {
225224
onDeviceParams?: LanguageModelCreateOptions;
226225
onCloudParams?: ModelParams;
227226
}
227+
228+
/**
229+
* Determines whether inference happens on-device or in-cloud.
230+
*/
231+
export type InferenceMode =
232+
| 'prefer_on_device'
233+
| 'only_on_device'
234+
| 'only_in_cloud';

0 commit comments

Comments
 (0)