Skip to content

Commit f6a2b88

Browse files
authored
[Vertex AI] Add a responseMimeType to generationConfig (#8235)
Provide Apps with an ability to configure the responseMimeType. This enables applications to request that VertexAI returns the response in a JSON format instead of a normal textual format.
1 parent c66445c commit f6a2b88

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

common/api-review/vertexai-preview.api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ export interface GenerationConfig {
311311
maxOutputTokens?: number;
312312
// (undocumented)
313313
presencePenalty?: number;
314+
responseMimeType?: string;
314315
// (undocumented)
315316
stopSequences?: string[];
316317
// (undocumented)

docs-devsite/vertexai-preview.generationconfig.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface GenerationConfig
2626
| [frequencyPenalty](./vertexai-preview.generationconfig.md#generationconfigfrequencypenalty) | number | |
2727
| [maxOutputTokens](./vertexai-preview.generationconfig.md#generationconfigmaxoutputtokens) | number | |
2828
| [presencePenalty](./vertexai-preview.generationconfig.md#generationconfigpresencepenalty) | number | |
29+
| [responseMimeType](./vertexai-preview.generationconfig.md#generationconfigresponsemimetype) | string | Output response mimetype of the generated candidate text. Supported mimetype: <code>text/plain</code>: (default) Text output. <code>application/json</code>: 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. |
2930
| [stopSequences](./vertexai-preview.generationconfig.md#generationconfigstopsequences) | string\[\] | |
3031
| [temperature](./vertexai-preview.generationconfig.md#generationconfigtemperature) | number | |
3132
| [topK](./vertexai-preview.generationconfig.md#generationconfigtopk) | number | |
@@ -63,6 +64,16 @@ maxOutputTokens?: number;
6364
presencePenalty?: number;
6465
```
6566

67+
## GenerationConfig.responseMimeType
68+
69+
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.
70+
71+
<b>Signature:</b>
72+
73+
```typescript
74+
responseMimeType?: string;
75+
```
76+
6677
## GenerationConfig.stopSequences
6778

6879
<b>Signature:</b>

packages/vertexai/src/types/requests.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ export interface GenerationConfig {
7777
topK?: number;
7878
presencePenalty?: number;
7979
frequencyPenalty?: number;
80+
/**
81+
* Output response mimetype of the generated candidate text.
82+
* Supported mimetype:
83+
* `text/plain`: (default) Text output.
84+
* `application/json`: JSON response in the candidates.
85+
* The model needs to be prompted to output the appropriate response type,
86+
* otherwise the behavior is undefined.
87+
* This is a preview feature.
88+
*/
89+
responseMimeType?: string;
8090
}
8191

8292
/**

0 commit comments

Comments
 (0)