From 9af20017c69d7f28d56fd0810edff2b994d74dd0 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 30 Sep 2024 13:24:42 -0700 Subject: [PATCH] Address some PR comments --- docs-devsite/vertexai.functiondeclaration.md | 4 +- ...texai.functiondeclarationschemaproperty.md | 125 ------------------ docs-devsite/vertexai.generationconfig.md | 5 +- docs-devsite/vertexai.md | 79 ++++++----- docs-devsite/vertexai.requestoptions.md | 2 +- docs-devsite/vertexai.vertexaierror.md | 1 - packages/vertexai/src/api.ts | 4 +- packages/vertexai/src/errors.ts | 2 +- packages/vertexai/src/methods/chat-session.ts | 4 +- .../vertexai/src/models/generative-model.ts | 4 +- packages/vertexai/src/public-types.ts | 2 +- .../vertexai/src/requests/response-helpers.ts | 2 +- packages/vertexai/src/types/content.ts | 12 +- packages/vertexai/src/types/error.ts | 4 +- packages/vertexai/src/types/requests.ts | 17 +-- packages/vertexai/src/types/responses.ts | 8 +- packages/vertexai/src/types/schema.ts | 14 +- 17 files changed, 90 insertions(+), 199 deletions(-) delete mode 100644 docs-devsite/vertexai.functiondeclarationschemaproperty.md diff --git a/docs-devsite/vertexai.functiondeclaration.md b/docs-devsite/vertexai.functiondeclaration.md index 397edc9d7f3..211c1dd868d 100644 --- a/docs-devsite/vertexai.functiondeclaration.md +++ b/docs-devsite/vertexai.functiondeclaration.md @@ -22,9 +22,9 @@ export declare interface FunctionDeclaration | Property | Type | Description | | --- | --- | --- | -| [description](./vertexai.functiondeclaration.md#functiondeclarationdescription) | string | Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. | +| [description](./vertexai.functiondeclaration.md#functiondeclarationdescription) | string | Description and purpose of the function. Model uses it to decide how and whether to call the function. | | [name](./vertexai.functiondeclaration.md#functiondeclarationname) | string | The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a max length of 64. | -| [parameters](./vertexai.functiondeclaration.md#functiondeclarationparameters) | [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface) | Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. Parameter names are case-sensitive. For a function with no parameters, this can be left unset. | +| [parameters](./vertexai.functiondeclaration.md#functiondeclarationparameters) | [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. Parameter names are case-sensitive. For a function with no parameters, this can be left unset. | ## FunctionDeclaration.description diff --git a/docs-devsite/vertexai.functiondeclarationschemaproperty.md b/docs-devsite/vertexai.functiondeclarationschemaproperty.md deleted file mode 100644 index b0e234fa383..00000000000 --- a/docs-devsite/vertexai.functiondeclarationschemaproperty.md +++ /dev/null @@ -1,125 +0,0 @@ -Project: /docs/reference/js/_project.yaml -Book: /docs/reference/_book.yaml -page_type: reference - -{% comment %} -DO NOT EDIT THIS FILE! -This is generated by the JS SDK team, and any local changes will be -overwritten. Changes should be made in the source code at -https://github.com/firebase/firebase-js-sdk -{% endcomment %} - -# FunctionDeclarationSchemaProperty interface -Schema is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed. - -Signature: - -```typescript -export interface FunctionDeclarationSchemaProperty -``` - -## Properties - -| Property | Type | Description | -| --- | --- | --- | -| [description](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertydescription) | string | Optional. The description of the property. | -| [enum](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyenum) | string\[\] | Optional. The enum of the property. | -| [example](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyexample) | unknown | Optional. The example of the property. | -| [format](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyformat) | string | Optional. The format of the property. | -| [items](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyitems) | [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface) | Optional. The items of the property. [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface) | -| [nullable](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertynullable) | boolean | Optional. Whether the property is nullable. | -| [properties](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyproperties) | { \[k: string\]: [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface); } | Optional. Map of [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface). | -| [required](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertyrequired) | string\[\] | Optional. Array of required property. | -| [type](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemapropertytype) | [FunctionDeclarationSchemaType](./vertexai.md#functiondeclarationschematype) | Optional. The type of the property. [FunctionDeclarationSchemaType](./vertexai.md#functiondeclarationschematype). | - -## FunctionDeclarationSchemaProperty.description - -Optional. The description of the property. - -Signature: - -```typescript -description?: string; -``` - -## FunctionDeclarationSchemaProperty.enum - -Optional. The enum of the property. - -Signature: - -```typescript -enum?: string[]; -``` - -## FunctionDeclarationSchemaProperty.example - -Optional. The example of the property. - -Signature: - -```typescript -example?: unknown; -``` - -## FunctionDeclarationSchemaProperty.format - -Optional. The format of the property. - -Signature: - -```typescript -format?: string; -``` - -## FunctionDeclarationSchemaProperty.items - -Optional. The items of the property. [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface) - -Signature: - -```typescript -items?: FunctionDeclarationSchema; -``` - -## FunctionDeclarationSchemaProperty.nullable - -Optional. Whether the property is nullable. - -Signature: - -```typescript -nullable?: boolean; -``` - -## FunctionDeclarationSchemaProperty.properties - -Optional. Map of [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface). - -Signature: - -```typescript -properties?: { - [k: string]: FunctionDeclarationSchema; - }; -``` - -## FunctionDeclarationSchemaProperty.required - -Optional. Array of required property. - -Signature: - -```typescript -required?: string[]; -``` - -## FunctionDeclarationSchemaProperty.type - -Optional. The type of the property. [FunctionDeclarationSchemaType](./vertexai.md#functiondeclarationschematype). - -Signature: - -```typescript -type?: FunctionDeclarationSchemaType; -``` diff --git a/docs-devsite/vertexai.generationconfig.md b/docs-devsite/vertexai.generationconfig.md index 36859b7d8e4..4e0592bd91a 100644 --- a/docs-devsite/vertexai.generationconfig.md +++ b/docs-devsite/vertexai.generationconfig.md @@ -26,7 +26,8 @@ export interface GenerationConfig | [frequencyPenalty](./vertexai.generationconfig.md#generationconfigfrequencypenalty) | number | | | [maxOutputTokens](./vertexai.generationconfig.md#generationconfigmaxoutputtokens) | number | | | [presencePenalty](./vertexai.generationconfig.md#generationconfigpresencepenalty) | number | | -| [responseMimeType](./vertexai.generationconfig.md#generationconfigresponsemimetype) | string | Output response mimetype of the generated candidate text. Supported mimetypes are text/plain (default, text output) and application/json (JSON response in the candidates). The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature. | +| [responseMimeType](./vertexai.generationconfig.md#generationconfigresponsemimetype) | string | Output response MIME type of the generated candidate text. Supported MIME types are text/plain (default, text output) and application/json (JSON response in the candidates). | +| [responseSchema](./vertexai.generationconfig.md#generationconfigresponseschema) | [TypedSchema](./vertexai.md#typedschema) \| [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface) | Output response schema of the generated candidate text. This value can be a class generated with a {@link Schema} static method like Schema.string() or Schema.object() or it can be a plain JS object matching the [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface) interface.
Note: This only applies when the specified responseMIMEType supports a schema; currently this is limited to application/json. | | [stopSequences](./vertexai.generationconfig.md#generationconfigstopsequences) | string\[\] | | | [temperature](./vertexai.generationconfig.md#generationconfigtemperature) | number | | | [topK](./vertexai.generationconfig.md#generationconfigtopk) | number | | @@ -76,7 +77,7 @@ responseMimeType?: string; ## GenerationConfig.responseSchema -Output response schema of the generated candidate text. This value can be a class generated with a [Schema](./vertexai-preview.schema.md#schema_class) static method like `Schema.string()` or `Schema.object()` or it can be a plain JS object matching the [SchemaRequest](./vertexai-preview.schemarequest.md#schemarequest_interface) interface.
Note: This only applies when the specified `responseMIMEType` supports a schema; currently this is limited to `application/json`. +Output response schema of the generated candidate text. This value can be a class generated with a `{@link Schema}` static method like `Schema.string()` or `Schema.object()` or it can be a plain JS object matching the [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface) interface.
Note: This only applies when the specified `responseMIMEType` supports a schema; currently this is limited to `application/json`. Signature: diff --git a/docs-devsite/vertexai.md b/docs-devsite/vertexai.md index e92c3cb8dc6..a250bac2e2a 100644 --- a/docs-devsite/vertexai.md +++ b/docs-devsite/vertexai.md @@ -25,8 +25,15 @@ The Vertex AI in Firebase Web SDK. | Class | Description | | --- | --- | +| [ArraySchema](./vertexai.arrayschema.md#arrayschema_class) | Schema class for "array" types. The items param should refer to the type of item that can be a member of the array. | +| [BooleanSchema](./vertexai.booleanschema.md#booleanschema_class) | Schema class for "boolean" types. | | [ChatSession](./vertexai.chatsession.md#chatsession_class) | ChatSession class that enables sending chat messages and stores history of sent and received messages so far. | | [GenerativeModel](./vertexai.generativemodel.md#generativemodel_class) | Class for generative model APIs. | +| [IntegerSchema](./vertexai.integerschema.md#integerschema_class) | Schema class for "integer" types. | +| [NumberSchema](./vertexai.numberschema.md#numberschema_class) | Schema class for "number" types. | +| [ObjectSchema](./vertexai.objectschema.md#objectschema_class) | Schema class for "object" types. The properties param must be a map of Schema. | +| [Schema](./vertexai.schema.md#schema_class) | Parent class encompassing all Schema types, with static methods that allow building specific Schema types. This class can be converted with JSON.stringify() into a JSON string accepted by Vertex AI REST endpoints. (This string conversion is automatically done when calling SDK methods.) | +| [StringSchema](./vertexai.stringschema.md#stringschema_class) | Schema class for "string" types. Can be used with or without enum values. | | [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) | Error class for the Vertex AI in Firebase SDK. | ## Enumerations @@ -36,12 +43,12 @@ The Vertex AI in Firebase Web SDK. | [BlockReason](./vertexai.md#blockreason) | Reason that a prompt was blocked. | | [FinishReason](./vertexai.md#finishreason) | Reason that a candidate finished. | | [FunctionCallingMode](./vertexai.md#functioncallingmode) | | -| [FunctionDeclarationSchemaType](./vertexai.md#functiondeclarationschematype) | Contains the list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/ | | [HarmBlockMethod](./vertexai.md#harmblockmethod) | | | [HarmBlockThreshold](./vertexai.md#harmblockthreshold) | Threshold above which a prompt or candidate will be blocked. | | [HarmCategory](./vertexai.md#harmcategory) | Harm categories that would cause prompts or candidates to be blocked. | | [HarmProbability](./vertexai.md#harmprobability) | Probability that a prompt or candidate matches a harm category. | | [HarmSeverity](./vertexai.md#harmseverity) | Harm severity levels. | +| [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/) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | Standardized error codes that [VertexAIError](./vertexai.vertexaierror.md#vertexaierror_class) can have. | ## Interfaces @@ -64,8 +71,6 @@ The Vertex AI in Firebase Web SDK. | [FunctionCallingConfig](./vertexai.functioncallingconfig.md#functioncallingconfig_interface) | | | [FunctionCallPart](./vertexai.functioncallpart.md#functioncallpart_interface) | Content part interface if the part represents a [FunctionCall](./vertexai.functioncall.md#functioncall_interface). | | [FunctionDeclaration](./vertexai.functiondeclaration.md#functiondeclaration_interface) | Structured representation of a function declaration as defined by the [OpenAPI 3.0 specification](https://spec.openapis.org/oas/v3.0.3). Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a Tool by the model and executed by the client. | -| [FunctionDeclarationSchema](./vertexai.functiondeclarationschema.md#functiondeclarationschema_interface) | Schema for parameters passed to [FunctionDeclaration.parameters](./vertexai.functiondeclaration.md#functiondeclarationparameters). | -| [FunctionDeclarationSchemaProperty](./vertexai.functiondeclarationschemaproperty.md#functiondeclarationschemaproperty_interface) | Schema is used to define the format of input/output data. Represents a select subset of an OpenAPI 3.0 schema object. More fields may be added in the future as needed. | | [FunctionDeclarationsTool](./vertexai.functiondeclarationstool.md#functiondeclarationstool_interface) | A FunctionDeclarationsTool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. | | [FunctionResponse](./vertexai.functionresponse.md#functionresponse_interface) | The result output from a [FunctionCall](./vertexai.functioncall.md#functioncall_interface) that contains a string representing the [FunctionDeclaration.name](./vertexai.functiondeclaration.md#functiondeclarationname) and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a [FunctionCall](./vertexai.functioncall.md#functioncall_interface) made based on model prediction. | | [FunctionResponsePart](./vertexai.functionresponsepart.md#functionresponsepart_interface) | Content part interface if the part represents [FunctionResponse](./vertexai.functionresponse.md#functionresponse_interface). | @@ -80,11 +85,16 @@ The Vertex AI in Firebase Web SDK. | [GroundingMetadata](./vertexai.groundingmetadata.md#groundingmetadata_interface) | Metadata returned to client when grounding is enabled. | | [InlineDataPart](./vertexai.inlinedatapart.md#inlinedatapart_interface) | Content part interface if the part represents an image. | | [ModelParams](./vertexai.modelparams.md#modelparams_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | +| [ObjectSchemaInterface](./vertexai.objectschemainterface.md#objectschemainterface_interface) | Interface for [ObjectSchema](./vertexai.objectschema.md#objectschema_class) class. | | [PromptFeedback](./vertexai.promptfeedback.md#promptfeedback_interface) | If the prompt was blocked, this will be populated with blockReason and the relevant safetyRatings. | | [RequestOptions](./vertexai.requestoptions.md#requestoptions_interface) | Params passed to [getGenerativeModel()](./vertexai.md#getgenerativemodel_e3037c9). | | [RetrievedContextAttribution](./vertexai.retrievedcontextattribution.md#retrievedcontextattribution_interface) | | | [SafetyRating](./vertexai.safetyrating.md#safetyrating_interface) | A safety rating associated with a [GenerateContentCandidate](./vertexai.generatecontentcandidate.md#generatecontentcandidate_interface) | | [SafetySetting](./vertexai.safetysetting.md#safetysetting_interface) | Safety setting that can be sent as part of request parameters. | +| [SchemaInterface](./vertexai.schemainterface.md#schemainterface_interface) | Interface for [Schema](./vertexai.schema.md#schema_class) class. | +| [SchemaParams](./vertexai.schemaparams.md#schemaparams_interface) | Params passed to [Schema](./vertexai.schema.md#schema_class) static methods to create specific [Schema](./vertexai.schema.md#schema_class) classes. | +| [SchemaRequest](./vertexai.schemarequest.md#schemarequest_interface) | Final format for [Schema](./vertexai.schema.md#schema_class) params passed to backend requests. | +| [SchemaShared](./vertexai.schemashared.md#schemashared_interface) | Basic [Schema](./vertexai.schema.md#schema_class) properties shared across several Schema-related types. | | [Segment](./vertexai.segment.md#segment_interface) | | | [StartChatParams](./vertexai.startchatparams.md#startchatparams_interface) | Params for [GenerativeModel.startChat()](./vertexai.generativemodel.md#generativemodelstartchat). | | [TextPart](./vertexai.textpart.md#textpart_interface) | Content part interface if the part represents a text string. | @@ -108,6 +118,7 @@ The Vertex AI in Firebase Web SDK. | [Part](./vertexai.md#part) | Content part - includes text, image/video, or function call/response part types. | | [Role](./vertexai.md#role) | Role is the producer of the content. | | [Tool](./vertexai.md#tool) | Defines a tool that model can call to access external knowledge. | +| [TypedSchema](./vertexai.md#typedschema) | A type that includes all specific Schema types. | ## function(app, ...) @@ -196,6 +207,16 @@ Defines a tool that model can call to access external knowledge. export declare type Tool = FunctionDeclarationsTool; ``` +## TypedSchema + +A type that includes all specific Schema types. + +Signature: + +```typescript +export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema; +``` + ## BlockReason Reason that a prompt was blocked. @@ -210,7 +231,6 @@ export declare enum BlockReason | Member | Value | Description | | --- | --- | --- | -| BLOCKED\_REASON\_UNSPECIFIED | "BLOCKED_REASON_UNSPECIFIED" | | | OTHER | "OTHER" | | | SAFETY | "SAFETY" | | @@ -228,7 +248,6 @@ export declare enum FinishReason | Member | Value | Description | | --- | --- | --- | -| FINISH\_REASON\_UNSPECIFIED | "FINISH_REASON_UNSPECIFIED" | | | MAX\_TOKENS | "MAX_TOKENS" | | | OTHER | "OTHER" | | | RECITATION | "RECITATION" | | @@ -250,30 +269,8 @@ export declare enum FunctionCallingMode | --- | --- | --- | | ANY | "ANY" | | | AUTO | "AUTO" | | -| MODE\_UNSPECIFIED | "MODE_UNSPECIFIED" | | | NONE | "NONE" | | -## FunctionDeclarationSchemaType - -Contains the list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/ - -Signature: - -```typescript -export declare enum FunctionDeclarationSchemaType -``` - -## Enumeration Members - -| Member | Value | Description | -| --- | --- | --- | -| ARRAY | "ARRAY" | Array type. | -| BOOLEAN | "BOOLEAN" | Boolean type. | -| INTEGER | "INTEGER" | Integer type. | -| NUMBER | "NUMBER" | Number type. | -| OBJECT | "OBJECT" | Object type. | -| STRING | "STRING" | String type. | - ## HarmBlockMethod @@ -287,7 +284,6 @@ export declare enum HarmBlockMethod | Member | Value | Description | | --- | --- | --- | -| HARM\_BLOCK\_METHOD\_UNSPECIFIED | "HARM_BLOCK_METHOD_UNSPECIFIED" | | | PROBABILITY | "PROBABILITY" | | | SEVERITY | "SEVERITY" | | @@ -309,7 +305,6 @@ export declare enum HarmBlockThreshold | BLOCK\_MEDIUM\_AND\_ABOVE | "BLOCK_MEDIUM_AND_ABOVE" | | | BLOCK\_NONE | "BLOCK_NONE" | | | BLOCK\_ONLY\_HIGH | "BLOCK_ONLY_HIGH" | | -| HARM\_BLOCK\_THRESHOLD\_UNSPECIFIED | "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | | ## HarmCategory @@ -329,7 +324,6 @@ export declare enum HarmCategory | HARM\_CATEGORY\_HARASSMENT | "HARM_CATEGORY_HARASSMENT" | | | HARM\_CATEGORY\_HATE\_SPEECH | "HARM_CATEGORY_HATE_SPEECH" | | | HARM\_CATEGORY\_SEXUALLY\_EXPLICIT | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | | -| HARM\_CATEGORY\_UNSPECIFIED | "HARM_CATEGORY_UNSPECIFIED" | | ## HarmProbability @@ -345,7 +339,6 @@ export declare enum HarmProbability | Member | Value | Description | | --- | --- | --- | -| HARM\_PROBABILITY\_UNSPECIFIED | "HARM_PROBABILITY_UNSPECIFIED" | | | HIGH | "HIGH" | | | LOW | "LOW" | | | MEDIUM | "MEDIUM" | | @@ -369,7 +362,27 @@ export declare enum HarmSeverity | HARM\_SEVERITY\_LOW | "HARM_SEVERITY_LOW" | | | HARM\_SEVERITY\_MEDIUM | "HARM_SEVERITY_MEDIUM" | | | HARM\_SEVERITY\_NEGLIGIBLE | "HARM_SEVERITY_NEGLIGIBLE" | | -| HARM\_SEVERITY\_UNSPECIFIED | "HARM_SEVERITY_UNSPECIFIED" | | + +## SchemaType + +Contains the list of OpenAPI data types as defined by the [OpenAPI specification](https://swagger.io/docs/specification/data-models/data-types/) + +Signature: + +```typescript +export declare enum SchemaType +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| ARRAY | "array" | Array type. | +| BOOLEAN | "boolean" | Boolean type. | +| INTEGER | "integer" | Integer type. | +| NUMBER | "number" | Number type. | +| OBJECT | "object" | Object type. | +| STRING | "string" | String type. | ## VertexAIErrorCode @@ -385,9 +398,11 @@ export declare const enum VertexAIErrorCode | Member | Value | Description | | --- | --- | --- | +| API\_NOT\_ENABLED | "api-not-enabled" | An error due to the Firebase API not being enabled in the Console. | | ERROR | "error" | A generic error occurred. | | FETCH\_ERROR | "fetch-error" | An error occurred while performing a fetch. | | INVALID\_CONTENT | "invalid-content" | An error associated with a Content object. | +| INVALID\_SCHEMA | "invalid-schema" | An error due to invalid Schema input. | | NO\_API\_KEY | "no-api-key" | An error occurred due to a missing Firebase API key. | | NO\_MODEL | "no-model" | An error occurred due to a model name not being specified during initialization. | | NO\_PROJECT\_ID | "no-project-id" | An error occurred due to a missing project ID. | diff --git a/docs-devsite/vertexai.requestoptions.md b/docs-devsite/vertexai.requestoptions.md index a3f1e4b6fe2..c4630d76d8f 100644 --- a/docs-devsite/vertexai.requestoptions.md +++ b/docs-devsite/vertexai.requestoptions.md @@ -23,7 +23,7 @@ export interface RequestOptions | Property | Type | Description | | --- | --- | --- | | [baseUrl](./vertexai.requestoptions.md#requestoptionsbaseurl) | string | Base url for endpoint. Defaults to https://firebaseml.googleapis.com | -| [timeout](./vertexai.requestoptions.md#requestoptionstimeout) | number | Request timeout in milliseconds. | +| [timeout](./vertexai.requestoptions.md#requestoptionstimeout) | number | Request timeout in milliseconds. Defaults to 180 seconds (180000ms). | ## RequestOptions.baseUrl diff --git a/docs-devsite/vertexai.vertexaierror.md b/docs-devsite/vertexai.vertexaierror.md index 6885c597ec3..31f527e59b3 100644 --- a/docs-devsite/vertexai.vertexaierror.md +++ b/docs-devsite/vertexai.vertexaierror.md @@ -31,7 +31,6 @@ export declare class VertexAIError extends FirebaseError | --- | --- | --- | --- | | [code](./vertexai.vertexaierror.md#vertexaierrorcode) | | [VertexAIErrorCode](./vertexai.md#vertexaierrorcode) | | | [customErrorData](./vertexai.vertexaierror.md#vertexaierrorcustomerrordata) | | [CustomErrorData](./vertexai.customerrordata.md#customerrordata_interface) \| undefined | | -| [message](./vertexai.vertexaierror.md#vertexaierrormessage) | | string | | ## VertexAIError.(constructor) diff --git a/packages/vertexai/src/api.ts b/packages/vertexai/src/api.ts index 23c502895d8..42f33ed2a85 100644 --- a/packages/vertexai/src/api.ts +++ b/packages/vertexai/src/api.ts @@ -39,7 +39,7 @@ declare module '@firebase/component' { } /** - * Returns a {@link VertexAI} instance for the given app. + * Returns a {@link VertexAI} instance for the given app. * * @public * @@ -59,7 +59,7 @@ export function getVertexAI( } /** - * Returns a {@link GenerativeModel} class with methods for inference + * Returns a {@link GenerativeModel} class with methods for inference * and other functionality. * * @public diff --git a/packages/vertexai/src/errors.ts b/packages/vertexai/src/errors.ts index ad3f9b72f5a..b643a5f552d 100644 --- a/packages/vertexai/src/errors.ts +++ b/packages/vertexai/src/errors.ts @@ -28,7 +28,7 @@ export class VertexAIError extends FirebaseError { /** * Constructs a new instance of the `VertexAIError` class. * - * @param code - The error code from {@link VertexAIErrorCode}. + * @param code - The error code from {@link VertexAIErrorCode}. * @param message - A human-readable message describing the error. * @param customErrorData - Optional error data. */ diff --git a/packages/vertexai/src/methods/chat-session.ts b/packages/vertexai/src/methods/chat-session.ts index 0d1636c1cd8..bfa3f2a660f 100644 --- a/packages/vertexai/src/methods/chat-session.ts +++ b/packages/vertexai/src/methods/chat-session.ts @@ -71,7 +71,7 @@ export class ChatSession { /** * Sends a chat message and receives a non-streaming - * {@link GenerateContentResult} + * {@link GenerateContentResult} */ async sendMessage( request: string | Array @@ -125,7 +125,7 @@ export class ChatSession { /** * Sends a chat message and receives the response as a - * {@link GenerateContentStreamResult} containing an iterable stream + * {@link GenerateContentStreamResult} containing an iterable stream * and a response promise. */ async sendMessageStream( diff --git a/packages/vertexai/src/models/generative-model.ts b/packages/vertexai/src/models/generative-model.ts index 88be3ee6436..e719529967c 100644 --- a/packages/vertexai/src/models/generative-model.ts +++ b/packages/vertexai/src/models/generative-model.ts @@ -116,7 +116,7 @@ export class GenerativeModel { /** * Makes a single non-streaming call to the model - * and returns an object containing a single {@link GenerateContentResponse}. + * and returns an object containing a single {@link GenerateContentResponse}. */ async generateContent( request: GenerateContentRequest | string | Array @@ -163,7 +163,7 @@ export class GenerativeModel { } /** - * Gets a new {@link ChatSession} instance which can be used for + * Gets a new {@link ChatSession} instance which can be used for * multi-turn chats. */ startChat(startChatParams?: StartChatParams): ChatSession { diff --git a/packages/vertexai/src/public-types.ts b/packages/vertexai/src/public-types.ts index fbc5d51084d..280fee9d1cd 100644 --- a/packages/vertexai/src/public-types.ts +++ b/packages/vertexai/src/public-types.ts @@ -25,7 +25,7 @@ export * from './types'; */ export interface VertexAI { /** - * The {@link @firebase/app#FirebaseApp} this {@link VertexAI} instance is associated with. + * The {@link @firebase/app#FirebaseApp} this {@link VertexAI} instance is associated with. */ app: FirebaseApp; location: string; diff --git a/packages/vertexai/src/requests/response-helpers.ts b/packages/vertexai/src/requests/response-helpers.ts index 1b43602b0cb..efff09591a6 100644 --- a/packages/vertexai/src/requests/response-helpers.ts +++ b/packages/vertexai/src/requests/response-helpers.ts @@ -119,7 +119,7 @@ export function getText(response: GenerateContentResponse): string { } /** - * Returns {@link FunctionCall}s associated with first candidate. + * Returns {@link FunctionCall}s associated with first candidate. */ export function getFunctionCalls( response: GenerateContentResponse diff --git a/packages/vertexai/src/types/content.ts b/packages/vertexai/src/types/content.ts index ad2906671e4..abf5d29222a 100644 --- a/packages/vertexai/src/types/content.ts +++ b/packages/vertexai/src/types/content.ts @@ -82,7 +82,7 @@ export interface VideoMetadata { } /** - * Content part interface if the part represents a {@link FunctionCall}. + * Content part interface if the part represents a {@link FunctionCall}. * @public */ export interface FunctionCallPart { @@ -93,7 +93,7 @@ export interface FunctionCallPart { } /** - * Content part interface if the part represents {@link FunctionResponse}. + * Content part interface if the part represents {@link FunctionResponse}. * @public */ export interface FunctionResponsePart { @@ -104,7 +104,7 @@ export interface FunctionResponsePart { } /** - * Content part interface if the part represents {@link FileData} + * Content part interface if the part represents {@link FileData} * @public */ export interface FileDataPart { @@ -116,7 +116,7 @@ export interface FileDataPart { } /** - * A predicted {@link FunctionCall} returned from the model + * A predicted {@link FunctionCall} returned from the model * that contains a string representing the {@link FunctionDeclaration.name} * and a structured JSON object containing the parameters and their values. * @public @@ -127,11 +127,11 @@ export interface FunctionCall { } /** - * The result output from a {@link FunctionCall} that contains a string + * The result output from a {@link FunctionCall} that contains a string * representing the {@link FunctionDeclaration.name} * and a structured JSON object containing any output * from the function is used as context to the model. - * This should contain the result of a {@link FunctionCall} + * This should contain the result of a {@link FunctionCall} * made based on model prediction. * @public */ diff --git a/packages/vertexai/src/types/error.ts b/packages/vertexai/src/types/error.ts index aaaf19f05b3..8d83a52a0aa 100644 --- a/packages/vertexai/src/types/error.ts +++ b/packages/vertexai/src/types/error.ts @@ -50,7 +50,7 @@ export interface CustomErrorData { /** HTTP status text of the error response. */ statusText?: string; - /** Response from a {@link GenerateContentRequest} */ + /** Response from a {@link GenerateContentRequest} */ response?: GenerateContentResponse; /** Optional additional details about the error. */ @@ -58,7 +58,7 @@ export interface CustomErrorData { } /** - * Standardized error codes that {@link VertexAIError} can have. + * Standardized error codes that {@link VertexAIError} can have. * * @public */ diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts index c844ddfb878..e4e57ce7a20 100644 --- a/packages/vertexai/src/types/requests.ts +++ b/packages/vertexai/src/types/requests.ts @@ -35,7 +35,7 @@ export interface BaseParams { } /** - * Params passed to {@link getGenerativeModel}. + * Params passed to {@link getGenerativeModel}. * @public */ export interface ModelParams extends BaseParams { @@ -81,15 +81,16 @@ export interface GenerationConfig { frequencyPenalty?: number; /** * Output response MIME type of the generated candidate text. - * Supported MIME types are `text/plain` (default, text output) and `application/json` - * (JSON response in the candidates). + * Supported MIME types are `text/plain` (default, text output), + * `application/json` (JSON response in the candidates), and + * `text/x.enum`. */ responseMimeType?: string; /** * Output response schema of the generated candidate text. This - * value can be a class generated with a {@link Schema} static method + * value can be a class generated with a {@link Schema} static method * like `Schema.string()` or `Schema.object()` or it can be a plain - * JS object matching the {@link SchemaRequest} interface. + * JS object matching the {@link SchemaRequest} interface. *
Note: This only applies when the specified `responseMIMEType` supports a schema; currently * this is limited to `application/json`. */ @@ -116,7 +117,7 @@ export interface CountTokensRequest { } /** - * Params passed to {@link getGenerativeModel}. + * Params passed to {@link getGenerativeModel}. * @public */ export interface RequestOptions { @@ -176,8 +177,8 @@ export declare interface FunctionDeclarationsTool { * Optional. One or more function declarations * to be passed to the model along with the current user query. Model may * decide to call a subset of these functions by populating - * {@link FunctionCall} in the response. User should - * provide a {@link FunctionResponse} for each + * {@link FunctionCall} in the response. User should + * provide a {@link FunctionResponse} for each * function call in the next turn. Based on the function responses, the model will * generate the final response back to the user. Maximum 64 function * declarations can be provided. diff --git a/packages/vertexai/src/types/responses.ts b/packages/vertexai/src/types/responses.ts index 026002a851d..83cd4366f12 100644 --- a/packages/vertexai/src/types/responses.ts +++ b/packages/vertexai/src/types/responses.ts @@ -75,7 +75,7 @@ export interface GenerateContentResponse { } /** - * Usage metadata about a {@link GenerateContentResponse}. + * Usage metadata about a {@link GenerateContentResponse}. * * @public */ @@ -97,7 +97,7 @@ export interface PromptFeedback { } /** - * A candidate returned as part of a {@link GenerateContentResponse}. + * A candidate returned as part of a {@link GenerateContentResponse}. * @public */ export interface GenerateContentCandidate { @@ -111,7 +111,7 @@ export interface GenerateContentCandidate { } /** - * Citation metadata that may be found on a {@link GenerateContentCandidate}. + * Citation metadata that may be found on a {@link GenerateContentCandidate}. * @public */ export interface CitationMetadata { @@ -187,7 +187,7 @@ export interface Date { } /** - * A safety rating associated with a {@link GenerateContentCandidate} + * A safety rating associated with a {@link GenerateContentCandidate} * @public */ export interface SafetyRating { diff --git a/packages/vertexai/src/types/schema.ts b/packages/vertexai/src/types/schema.ts index 7b8f34d89d6..fca213431ad 100644 --- a/packages/vertexai/src/types/schema.ts +++ b/packages/vertexai/src/types/schema.ts @@ -37,7 +37,7 @@ export enum SchemaType { } /** - * Basic {@link Schema} properties shared across several Schema-related + * Basic {@link Schema} properties shared across several Schema-related * types. * @public */ @@ -48,7 +48,7 @@ export interface SchemaShared { description?: string; /** Optional. The items of the property. */ items?: T; - /** Optional. Map of Schemas. */ + /** Optional. Map of `Schema` objects. */ properties?: { [k: string]: T; }; @@ -62,14 +62,14 @@ export interface SchemaShared { } /** - * Params passed to {@link Schema} static methods to create specific - * {@link Schema} classes. + * Params passed to {@link Schema} static methods to create specific + * {@link Schema} classes. * @public */ export interface SchemaParams extends SchemaShared {} /** - * Final format for {@link Schema} params passed to backend requests. + * Final format for {@link Schema} params passed to backend requests. * @public */ export interface SchemaRequest extends SchemaShared { @@ -83,7 +83,7 @@ export interface SchemaRequest extends SchemaShared { } /** - * Interface for {@link Schema} class. + * Interface for {@link Schema} class. * @public */ export interface SchemaInterface extends SchemaShared { @@ -95,7 +95,7 @@ export interface SchemaInterface extends SchemaShared { } /** - * Interface for {@link ObjectSchema} class. + * Interface for {@link ObjectSchema} class. * @public */ export interface ObjectSchemaInterface extends SchemaInterface {