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 %} # GenerationConfig interface Config options for content-related requests Signature: ```typescript export interface GenerationConfig ``` ## Properties | Property | Type | Description | | --- | --- | --- | | [candidateCount](./ai.generationconfig.md#generationconfigcandidatecount) | number | | | [frequencyPenalty](./ai.generationconfig.md#generationconfigfrequencypenalty) | number | | | [imageConfig](./ai.generationconfig.md#generationconfigimageconfig) | [ImageConfig](./ai.imageconfig.md#imageconfig_interface) | Configuration options for generating images with Gemini models. | | [maxOutputTokens](./ai.generationconfig.md#generationconfigmaxoutputtokens) | number | | | [presencePenalty](./ai.generationconfig.md#generationconfigpresencepenalty) | number | | | [responseJsonSchema](./ai.generationconfig.md#generationconfigresponsejsonschema) | { \[key: string\]: unknown; } | Output schema of the generated response. This is an alternative to responseSchema that accepts \[JSON Schema\](https://json-schema.org/).If set, responseSchema must be omitted, but responseMimeType is required and must be set to application/json. | | [responseMimeType](./ai.generationconfig.md#generationconfigresponsemimetype) | string | Output response MIME type of the generated candidate text. Supported MIME types are text/plain (default, text output), application/json (JSON response in the candidates), and text/x.enum. | | [responseModalities](./ai.generationconfig.md#generationconfigresponsemodalities) | [ResponseModality](./ai.md#responsemodality)\[\] | (Public Preview) Generation modalities to be returned in generation responses. | | [responseSchema](./ai.generationconfig.md#generationconfigresponseschema) | [TypedSchema](./ai.md#typedschema) \| [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) | Output response schema of the generated candidate text. This value can be a class generated with a [Schema](./ai.schema.md#schema_class) static method like Schema.string() or Schema.object() or it can be a plain JS object matching the [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) interface.
Note: This only applies when the specified responseMimeType supports a schema; currently this is limited to application/json and text/x.enum. | | [speechConfig](./ai.generationconfig.md#generationconfigspeechconfig) | [SpeechConfig](./ai.md#speechconfig) | (Public Preview) Configuration for speech synthesis for text-to-speech (TTS) models. | | [stopSequences](./ai.generationconfig.md#generationconfigstopsequences) | string\[\] | | | [temperature](./ai.generationconfig.md#generationconfigtemperature) | number | | | [thinkingConfig](./ai.generationconfig.md#generationconfigthinkingconfig) | [ThinkingConfig](./ai.thinkingconfig.md#thinkingconfig_interface) | Configuration for "thinking" behavior of compatible Gemini models. | | [topK](./ai.generationconfig.md#generationconfigtopk) | number | | | [topP](./ai.generationconfig.md#generationconfigtopp) | number | | ## GenerationConfig.candidateCount > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Make parallel requests instead. > Signature: ```typescript candidateCount?: number; ``` ## GenerationConfig.frequencyPenalty > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter. > Signature: ```typescript frequencyPenalty?: number; ``` ## GenerationConfig.imageConfig Configuration options for generating images with Gemini models. Signature: ```typescript imageConfig?: ImageConfig; ``` ## GenerationConfig.maxOutputTokens Signature: ```typescript maxOutputTokens?: number; ``` ## GenerationConfig.presencePenalty > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. Requests that include this parameter will fail with a 400 error. Omit this parameter. > Signature: ```typescript presencePenalty?: number; ``` ## GenerationConfig.responseJsonSchema Output schema of the generated response. This is an alternative to `responseSchema` that accepts \[JSON Schema\](https://json-schema.org/). If set, `responseSchema` must be omitted, but `responseMimeType` is required and must be set to `application/json`. Signature: ```typescript responseJsonSchema?: { [key: string]: unknown; }; ``` ## GenerationConfig.responseMimeType Output response MIME type of the generated candidate text. Supported MIME types are `text/plain` (default, text output), `application/json` (JSON response in the candidates), and `text/x.enum`. Signature: ```typescript responseMimeType?: string; ``` ## GenerationConfig.responseModalities > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > Generation modalities to be returned in generation responses. - Multimodal response generation is only supported by some Gemini models and versions; see [model versions](https://firebase.google.com/docs/ai-logic/models). - Only image generation (`ResponseModality.IMAGE`) is supported. Signature: ```typescript responseModalities?: ResponseModality[]; ``` ## GenerationConfig.responseSchema Output response schema of the generated candidate text. This value can be a class generated with a [Schema](./ai.schema.md#schema_class) static method like `Schema.string()` or `Schema.object()` or it can be a plain JS object matching the [SchemaRequest](./ai.schemarequest.md#schemarequest_interface) interface.
Note: This only applies when the specified `responseMimeType` supports a schema; currently this is limited to `application/json` and `text/x.enum`. Signature: ```typescript responseSchema?: TypedSchema | SchemaRequest; ``` ## GenerationConfig.speechConfig > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. > Configuration for speech synthesis for text-to-speech (TTS) models. Signature: ```typescript speechConfig?: SpeechConfig; ``` ## GenerationConfig.stopSequences Signature: ```typescript stopSequences?: string[]; ``` ## GenerationConfig.temperature > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically. > Signature: ```typescript temperature?: number; ``` ## GenerationConfig.thinkingConfig Configuration for "thinking" behavior of compatible Gemini models. Signature: ```typescript thinkingConfig?: ThinkingConfig; ``` ## GenerationConfig.topK > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically. > Signature: ```typescript topK?: number; ``` ## GenerationConfig.topP > Warning: This API is now obsolete. > > Not supported in Gemini 3.x and later models. The model will ignore this parameter if it's included in a request. Omit this parameter and let the model manage sampling automatically. > Signature: ```typescript topP?: number; ```