From c1975f8b7056884f641b1d2014e5c2c57488b9ca Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Wed, 8 May 2024 14:14:23 -0400 Subject: [PATCH 1/3] Add a responseMimeType to generationConfig --- common/api-review/vertexai-preview.api.md | 2 ++ packages/vertexai/src/types/requests.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/common/api-review/vertexai-preview.api.md b/common/api-review/vertexai-preview.api.md index 96d8ec70050..55e61d379eb 100644 --- a/common/api-review/vertexai-preview.api.md +++ b/common/api-review/vertexai-preview.api.md @@ -312,6 +312,8 @@ export interface GenerationConfig { // (undocumented) presencePenalty?: number; // (undocumented) + responseMimeType?: string; + // (undocumented) stopSequences?: string[]; // (undocumented) temperature?: number; diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts index 079d72f348f..931c4ef49be 100644 --- a/packages/vertexai/src/types/requests.ts +++ b/packages/vertexai/src/types/requests.ts @@ -77,6 +77,7 @@ export interface GenerationConfig { topK?: number; presencePenalty?: number; frequencyPenalty?: number; + responseMimeType?: string; } /** From 3b33a0a22028394ebdc4df124a02e5604bcd02af Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Wed, 8 May 2024 15:11:05 -0400 Subject: [PATCH 2/3] Docs update. --- common/api-review/vertexai-preview.api.md | 1 - docs-devsite/vertexai-preview.generationconfig.md | 11 +++++++++++ packages/vertexai/src/types/requests.ts | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/common/api-review/vertexai-preview.api.md b/common/api-review/vertexai-preview.api.md index 55e61d379eb..b3ae09e8dc7 100644 --- a/common/api-review/vertexai-preview.api.md +++ b/common/api-review/vertexai-preview.api.md @@ -311,7 +311,6 @@ export interface GenerationConfig { maxOutputTokens?: number; // (undocumented) presencePenalty?: number; - // (undocumented) responseMimeType?: string; // (undocumented) stopSequences?: string[]; diff --git a/docs-devsite/vertexai-preview.generationconfig.md b/docs-devsite/vertexai-preview.generationconfig.md index 0aa8e5567f7..3b00214d88b 100644 --- a/docs-devsite/vertexai-preview.generationconfig.md +++ b/docs-devsite/vertexai-preview.generationconfig.md @@ -26,6 +26,7 @@ export interface GenerationConfig | [frequencyPenalty](./vertexai-preview.generationconfig.md#generationconfigfrequencypenalty) | number | | | [maxOutputTokens](./vertexai-preview.generationconfig.md#generationconfigmaxoutputtokens) | number | | | [presencePenalty](./vertexai-preview.generationconfig.md#generationconfigpresencepenalty) | number | | +| [responseMimeType](./vertexai-preview.generationconfig.md#generationconfigresponsemimetype) | string | Output response mimetype of the generated candidate text. Supported mimetype: text/plain: (default) Text output. 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. | | [stopSequences](./vertexai-preview.generationconfig.md#generationconfigstopsequences) | string\[\] | | | [temperature](./vertexai-preview.generationconfig.md#generationconfigtemperature) | number | | | [topK](./vertexai-preview.generationconfig.md#generationconfigtopk) | number | | @@ -63,6 +64,16 @@ maxOutputTokens?: number; presencePenalty?: number; ``` +## GenerationConfig.responseMimeType + +Output response mimetype of the generated candidate text. Supported mimetype: `text/plain`: (default) Text output. `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. + +Signature: + +```typescript +responseMimeType?: string; +``` + ## GenerationConfig.stopSequences Signature: diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts index d49fb5f698f..161dfbb5076 100644 --- a/packages/vertexai/src/types/requests.ts +++ b/packages/vertexai/src/types/requests.ts @@ -77,6 +77,15 @@ export interface GenerationConfig { topK?: number; presencePenalty?: number; frequencyPenalty?: number; + /** + * Output response mimetype of the generated candidate text. + * Supported mimetype: + * `text/plain`: (default) Text output. + * `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?: string; } From 70a2f7ad7bf274552a6c0f5af27656e113f42876 Mon Sep 17 00:00:00 2001 From: DellaBitta Date: Wed, 8 May 2024 15:23:46 -0400 Subject: [PATCH 3/3] format fix. --- packages/vertexai/src/types/requests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vertexai/src/types/requests.ts b/packages/vertexai/src/types/requests.ts index 161dfbb5076..5da8f05b6bb 100644 --- a/packages/vertexai/src/types/requests.ts +++ b/packages/vertexai/src/types/requests.ts @@ -77,7 +77,7 @@ export interface GenerationConfig { topK?: number; presencePenalty?: number; frequencyPenalty?: number; - /** + /** * Output response mimetype of the generated candidate text. * Supported mimetype: * `text/plain`: (default) Text output.