/v1/schemas/gemini/chat/v1beta/models/{modelsId}:generateAnswer
| field | recorded source |
|---|---|
| schema | Source linked above. upstream-spec Source trace343ff1b68827292bea63e0965dec5cfd8c97953c3345c7c552e91fce8bb4ab90{
"fetchedAt": 1794375004,
"extractorVersion": "2",
"verifiedAt": null
} |
Request body
6 properties · 0 required · 24 $defs| property | type | description | constraints |
|---|---|---|---|
| temperature | number | Optional. Controls the randomness of the output. Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses fro… | format: float |
| safetySettings | SafetySetting[] | Optional. A list of unique `SafetySetting` instances for blocking unsafe content. This will be enforced on the `GenerateAnswerRequest.contents` and `GenerateAnswerResponse.candidate`. There should not be more than one setting for each `SafetyCategory` type. Th… | |
| semanticRetriever | SemanticRetrieverConfig | Configuration for retrieving grounding content from a `Corpus` or `Document` created using the Semantic Retriever API. | |
| inlinePassages | GroundingPassages | A repeated list of passages. | |
| contents | Content[] | Required. The content of the current conversation with the `Model`. For single-turn queries, this is a single question to answer. For multi-turn queries, this is a repeated field that contains conversation history and the last `Content` in the list containing … | |
| answerStyle | enum | Required. Style in which answers should be returned. | ANSWER_STYLE_UNSPECIFIED | ABSTRACTIVE | EXTRACTIVE | VERBOSE |
Types
24 $defsAudioTranscriptionobject
The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label.
| speakerLabel | string | Optional. A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). Present when diarization is set. | |
| words | WordInfo[] | Optional. Detailed word-level transcriptions and timing details. Present when word_timestamp is set. | |
| text | string | Required. The transcription text of this audio segment. |
Blobobject
Raw media bytes. Text should not be sent as raw bytes, use the 'text' field.
| mimeType | string | The IANA standard MIME type of the source data. Examples of supported types: - Images: image/png, image/jpeg, image/jpg, image/webp, image/heic, image/heif, image/gif, image/avif - Audio: audio/*, video/audio/s16le, video/audio/wav - Video: video/* - Text: tex… | |
| data | string | Raw bytes for media formats. | format: byte |
| displayName | string | Optional. Specifies the name used to refer to this blob to the model (e.g. "my_blob.png"). Used as the blob reference identifier when `verbalization_mode` is set to `REFERENCE_ONLY`. |
CodeExecutionResultobject
Result of executing the `ExecutableCode`. Generated only when the `CodeExecution` tool is used.
| output | string | Optional. Contains stdout when code execution is successful, stderr or other description otherwise. | |
| outcome | enum | Required. Outcome of the code execution. | OUTCOME_UNSPECIFIED | OUTCOME_OK | OUTCOME_FAILED | OUTCOME_DEADLINE_EXCEEDED |
| id | string | Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. |
Conditionobject
Filter condition applicable to a single key.
| numericValue | number | The numeric value to filter the metadata on. | format: float |
| stringValue | string | The string value to filter the metadata on. | |
| operation | enum | Required. Operator applied to the given key-value pair to trigger the condition. | OPERATOR_UNSPECIFIED | LESS | LESS_EQUAL | EQUAL | GREATER_EQUAL | GREATER · +3 more |
Contentobject
The base structured datatype containing multi-part content of a message. A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn.
| role | string | Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. | |
| parts | Part[] | Ordered `Parts` that constitute a single message. Parts may have different MIME types. |
ExecutableCodeobject
Code generated by the model that is meant to be executed, and the result returned to the model. Only generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding `CodeExecutionResult` will also be generat…
| language | enum | Required. Programming language of the `code`. | LANGUAGE_UNSPECIFIED | PYTHON |
| code | string | Required. The code to be executed. | |
| id | string | Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. |
FileDataobject
URI based data.
| displayName | string | Optional. Specifies the name used to refer to this file to the model (e.g. "my_file.pdf"). Used as the file reference identifier when `verbalization_mode` is set to `REFERENCE_ONLY`. | |
| fileUri | string | Required. URI. | |
| mimeType | string | Optional. The IANA standard MIME type of the source data. |
FunctionCallobject
A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
| id | string | Optional. Unique identifier of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`. | |
| args | object | Optional. The function parameters and values in JSON object format. | |
| name | string | Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 128. |
FunctionResponseobject
The result output from a `FunctionCall` that contains a string representing the `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`FunctionCall` m…
| name | string | Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 128. | |
| scheduling | enum | Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. | SCHEDULING_UNSPECIFIED | SILENT | WHEN_IDLE | INTERRUPT |
| response | object | Required. The function response in JSON object format. Callers can use any keys of their choice that fit the function's syntax to return the function output, e.g. "output", "result", etc. In particular, if the function call failed to execute, the response can … | |
| parts | FunctionResponsePart[] | Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types. | |
| willContinue | boolean | Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. … | |
| id | string | Optional. The identifier of the function call this response is for. Populated by the client to match the corresponding function call `id`. |
FunctionResponseBlobobject
Raw media bytes for function response. Text should not be sent as raw bytes, use the 'FunctionResponse.response' field.
| mimeType | string | The IANA standard MIME type of the source data. Examples: - image/png - image/jpeg If an unsupported MIME type is provided, an error will be returned. For a complete list of supported types, see [Supported file formats](https://aistudio.google.com/docs/file-in… | |
| displayName | string | Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs, and to reference the blob from `FunctionResponse.response` (for example, via `{"$ref": "DISPLAY_NAME"}`). | |
| data | string | Raw bytes for media formats. | format: byte |
FunctionResponseFileDataobject
URI based data for function response.
| mimeType | string | The IANA standard MIME type of the source data. If an unsupported MIME type is provided, an error will be returned. For a complete list of supported types, see [Multimodal function responses](https://aistudio.google.com/docs/function-calling#multimodal) and [S… | |
| fileUri | string | Required. URI. | |
| displayName | string | Optional. Display name of the file. Used to provide a label or filename to distinguish file data, and to reference the file from `FunctionResponse.response` (for example, via `{"$ref": "DISPLAY_NAME"}`). |
FunctionResponsePartobject
A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. Media can …
| fileData | FunctionResponseFileData | URI based data for function response. | |
| inlineData | FunctionResponseBlob | Raw media bytes for function response. Text should not be sent as raw bytes, use the 'FunctionResponse.response' field. | |
| mediaProcessing | enum | Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field. | MEDIA_PROCESSING_UNSPECIFIED | STATIC | AGENTIC |
GroundingPassageobject
Passage included inline with a grounding configuration.
| content | Content | The base structured datatype containing multi-part content of a message. A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn. | |
| id | string | Identifier for the passage for attributing this passage in grounded answers. |
GroundingPassagesobject
A repeated list of passages.
| passages | GroundingPassage[] | List of passages. |
MetadataFilterobject
User provided filter to limit retrieval based on `Chunk` or `Document` level metadata values. Example (genre = drama OR genre = action): key = "document.custom_metadata.genre" conditions = [{string_value = "drama", operation = EQUAL}, {string_value = "action",…
| key | string | Required. The key of the metadata to filter on. | |
| conditions | Condition[] | Required. The `Condition`s for the given key that will trigger this filter. Multiple `Condition`s are joined by logical ORs. |
Partobject
A datatype containing media that is part of a multi-part `Content` message. A `Part` consists of data which has an associated datatype. A `Part` can only contain one of the accepted types in `Part.data`. A `Part` must have a fixed IANA MIME type identifying th…
| videoMetadata | VideoMetadata | Metadata describes the input video content. Set this in `Part.video_metadata` or `FunctionResponsePart.video_metadata` when `inline_data` or `file_data` contains video to configure static video preprocessing (such as time clipping, frame rate, maximum frame co… | |
| partMetadata | object | Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part str… | |
| speechMetadata | SpeechMetadata | Speech metadata for `text` parts. | |
| codeExecutionResult | CodeExecutionResult | Result of executing the `ExecutableCode`. Generated only when the `CodeExecution` tool is used. | |
| inlineData | Blob | Raw media bytes. Text should not be sent as raw bytes, use the 'text' field. | |
| text | string | Inline text. | |
| executableCode | ExecutableCode | Code generated by the model that is meant to be executed, and the result returned to the model. Only generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding `CodeExecutionResult` will also be generat… | |
| thought | boolean | Optional. Indicates if the part is thought from the model. | |
| mediaProcessing | enum | Optional. How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field. | MEDIA_PROCESSING_UNSPECIFIED | STATIC | AGENTIC |
| toolCall | ToolCall | A predicted server-side `ToolCall` returned from the model. This message contains information about a tool that the model wants to invoke. The client is NOT expected to execute this `ToolCall`. Instead, the client should pass this `ToolCall` back to the API in… | |
| toolResponse | ToolResponse | The output from a server-side `ToolCall` execution. This message contains the results of a tool invocation that was initiated by a `ToolCall` from the model. The client should pass this `ToolResponse` back to the API in a subsequent turn within a `Content` mes… | |
| functionCall | FunctionCall | A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values. | |
| audioTranscription | AudioTranscription | The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label. | |
| fileData | FileData | URI based data. | |
| functionResponse | FunctionResponse | The result output from a `FunctionCall` that contains a string representing the `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`FunctionCall` m… | |
| mediaResolution | V1mainMediaResolution | Media resolution for tokenization. | |
| thoughtSignature | string | Optional. An opaque signature for the thought so it can be reused in subsequent requests. | format: byte |
SafetySettingobject
Safety setting, affecting the safety-blocking behavior. Passing a safety setting for a category changes the allowed probability that content is blocked.
| category | enum | Required. The category for this setting. | HARM_CATEGORY_UNSPECIFIED | HARM_CATEGORY_DEROGATORY | HARM_CATEGORY_TOXICITY | HARM_CATEGORY_VIOLENCE | HARM_CATEGORY_SEXUAL | HARM_CATEGORY_MEDICAL · +7 more |
| threshold | enum | Required. Controls the probability threshold at which harm is blocked. | HARM_BLOCK_THRESHOLD_UNSPECIFIE… | BLOCK_LOW_AND_ABOVE | BLOCK_MEDIUM_AND_ABOVE | BLOCK_ONLY_HIGH | BLOCK_NONE | OFF |
SemanticRetrieverConfigobject
Configuration for retrieving grounding content from a `Corpus` or `Document` created using the Semantic Retriever API.
| source | string | Required. Name of the resource for retrieval. Example: `corpora/123` or `corpora/123/documents/abc`. | |
| query | Content | The base structured datatype containing multi-part content of a message. A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn. | |
| metadataFilters | MetadataFilter[] | Optional. Filters for selecting `Document`s and/or `Chunk`s from the resource. | |
| maxChunksCount | integer | Optional. Maximum number of relevant `Chunk`s to retrieve. | format: int32 |
| minimumRelevanceScore | number | Optional. Minimum relevance score for retrieved relevant `Chunk`s. | format: float |
SpeechMetadataobject
Speech metadata for `text` parts.
| style | string | Optional. Optional style instruction for the speech synthesis. | |
| speaker | string | Optional. Optional speaker name for multi-speaker synthesis. |
ToolCallobject
A predicted server-side `ToolCall` returned from the model. This message contains information about a tool that the model wants to invoke. The client is NOT expected to execute this `ToolCall`. Instead, the client should pass this `ToolCall` back to the API in…
| args | object | Optional. The tool call arguments. Example: {"arg1" : "value1", "arg2" : "value2" , ...} | |
| id | string | Optional. Unique identifier of the tool call. The server returns the tool response with the matching `id`. | |
| toolName | string | Optional. The name of the tool that was called. | |
| toolType | enum | Required. The type of tool that was called. | TOOL_TYPE_UNSPECIFIED | GOOGLE_SEARCH_WEB | GOOGLE_SEARCH_IMAGE | URL_CONTEXT | GOOGLE_MAPS | FILE_SEARCH · +1 more |
ToolResponseobject
The output from a server-side `ToolCall` execution. This message contains the results of a tool invocation that was initiated by a `ToolCall` from the model. The client should pass this `ToolResponse` back to the API in a subsequent turn within a `Content` mes…
| id | string | Optional. The identifier of the tool call this response is for. | |
| toolType | enum | Required. The type of tool that was called, matching the `tool_type` in the corresponding `ToolCall`. | TOOL_TYPE_UNSPECIFIED | GOOGLE_SEARCH_WEB | GOOGLE_SEARCH_IMAGE | URL_CONTEXT | GOOGLE_MAPS | FILE_SEARCH · +1 more |
| response | object | Optional. The tool response. |
V1mainMediaResolutionobject
Media resolution for tokenization.
| level | enum | The tokenization quality used for given media. for Gemini API support . | MEDIA_RESOLUTION_UNSPECIFIED | MEDIA_RESOLUTION_LOW | MEDIA_RESOLUTION_MEDIUM | MEDIA_RESOLUTION_HIGH | MEDIA_RESOLUTION_ULTRA_HIGH |
VideoMetadataobject
Metadata describes the input video content. Set this in `Part.video_metadata` or `FunctionResponsePart.video_metadata` when `inline_data` or `file_data` contains video to configure static video preprocessing (such as time clipping, frame rate, maximum frame co…
| endOffset | string | Optional. The end offset of the video. | format: google-duration |
| startOffset | string | Optional. The start offset of the video. | format: google-duration |
| fps | number | Optional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0]. | format: double |
WordInfoobject
Information about a single recognized word.
| word | string | Required. Transcript of the word. | |
| endOffset | string | Optional. End offset in time of the word relative to the start of the audio. | format: google-duration |
| startOffset | string | Optional. Start offset in time of the word relative to the start of the audio. | format: google-duration |
Validate a payload
before you spend tokens$ curl -X POST https://modelschemas.com/v1/validate \
-d '{"provider":"gemini","endpointId":"v1beta/models/{modelsId}:generateAnswer","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}