graph_visualization

Prompt Engineer’s Guide to Gemini Schemas

Prompt Engineer’s Guide to Gemini API GenerateContentResponse Schemas

This guide provides a comprehensive and technical deep dive into the GenerateContentResponse schema, which is the primary output structure for the Gemini API’s GenerateContent method. Understanding this schema is crucial for effectively parsing, interpreting, and utilizing the responses generated by the Gemini model.


1. Overview/Summary

The GenerateContentResponse object encapsulates all information returned by the Gemini API after processing a content generation request. It primarily contains:

  • candidates: A list of generated content variations, each with its own content, safety ratings, and other metadata.
  • promptFeedback: Information about any content filtering applied to the input prompt.
  • usageMetadata: Detailed token counts for the prompt and generated candidates, providing insights into API consumption.
  • automaticFunctionCallingHistory: A record of internal tool-use turns if the model engaged in automatic function calling.
  • parsed: The first candidate’s content parsed according to a provided response schema (if applicable).
  • createTime, responseId, modelVersion: General response identifiers and timestamps.

The schema is highly nested, with core components like Content and Part used to represent multimodal data. Safety and grounding information are also thoroughly detailed.


2. GenerateContentResponse (Root Object)

The top-level object returned by the GenerateContent call.

  • candidates (array of Candidate, optional, default: null)
    • Description: A list of generated content variations returned by the model. Each Candidate represents a potential response.
    • Type: Array of objects, where each object conforms to the #/definitions/Candidate schema.
    • Implications: When the model successfully generates one or more responses, this array will contain the different outputs. If no candidates are generated (e.g., due to content filtering of the prompt), this array might be empty or null, and promptFeedback would be relevant.
  • createTime (string, optional, default: null)
    • Description: Timestamp when the request was made to the server.
    • Type: String, format: date-time (ISO 8601).
    • Implications: Useful for logging, auditing, and measuring latency from the server’s perspective.
  • responseId (string, optional, default: null)
    • Description: A unique identifier for each response.
    • Type: String.
    • Implications: Can be used for tracing requests and responses in system logs or for support interactions.
  • modelVersion (string, optional, default: null)
    • Description: Output only. The model version used to generate the response.
    • Type: String.
    • Implications: Important for reproducibility and understanding model behavior across different deployments or updates.
  • promptFeedback (object, optional, default: null)
    • Description: Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations.
    • Type: Object, conforms to the #/definitions/GenerateContentResponsePromptFeedback schema.
    • Implications: If the input prompt itself violates safety policies, the candidates array will be empty, and this field will provide the reason for blocking. Essential for debugging content safety issues on the input side.
  • usageMetadata (object, optional, default: null)
    • Description: Usage metadata about the response(s).
    • Type: Object, conforms to the #/definitions/GenerateContentResponseUsageMetadata schema.
    • Implications: Critical for understanding token consumption and cost implications. Provides token counts for both prompt and generated content, and potentially for tool-use and cached content.
  • automaticFunctionCallingHistory (array of Content, optional, default: null)
    • Description: A history of internal tool-use turns if the model engaged in automatic function calling. Each Content object represents a turn (either the model’s function call or the user’s function response).
    • Type: Array of objects, where each object conforms to the #/definitions/Content schema.
    • Implications: Relevant when FunctionCallingConfig is enabled with Mode.AUTO. This provides a trace of the tool-use conversation the model had with itself to arrive at the final response.
  • parsed (anyOf BaseModel, object with additionalProperties: true, Enum, null; optional, default: null)
    • Description: First candidate from the parsed response if response_schema is provided in the request. Not available for streaming.
    • Type: Can be a BaseModel (likely a Pydantic model for structured output), a generic JSON object, an Enum type, or null.
    • Implications: This is a convenience field for structured responses. If you define a response_schema in your request, the first generated candidate will be automatically parsed into that schema and made available here. This simplifies client-side parsing for structured outputs. Note the anyOf which indicates flexibility in the type based on the defined schema.

3. Candidate

A single generated response variation from the model.

  • content (object, optional, default: null)
    • Description: Contains the multi-part content of the response.
    • Type: Object, conforms to the #/definitions/Content schema.
    • Implications: The primary output of the model, holding text, image data, function calls, etc.
  • citationMetadata (object, optional, default: null)
    • Description: Source attribution of the generated content.
    • Type: Object, conforms to the #/definitions/CitationMetadata schema.
    • Implications: Provides information on sources if the model directly quotes from other sources, enhancing transparency and trustworthiness.
  • finishMessage (string, optional, default: null)
    • Description: Describes the reason the model stopped generating tokens. This is often a more human-readable version of finishReason.
    • Type: String.
    • Implications: Useful for understanding why a response might be truncated or incomplete.
  • tokenCount (integer, optional, default: null)
    • Description: Number of tokens for this specific candidate.
    • Type: Integer.
    • Implications: Allows for per-candidate token cost accounting.
  • finishReason (enum FinishReason, optional, default: null)
    • Description: The reason why the model stopped generating tokens. If empty, the model has not stopped generating tokens (relevant for streaming responses where a candidate might still be in progress).
    • Type: Enum: FINISH_REASON_UNSPECIFIED, STOP, MAX_TOKENS, SAFETY, RECITATION, LANGUAGE, OTHER, BLOCKLIST, PROHIBITED_CONTENT, SPII, MALFORMED_FUNCTION_CALL, IMAGE_SAFETY, UNEXPECTED_TOOL_CALL.
    • Implications: Crucial for programmatic handling of responses.
      • STOP: Model completed response naturally.
      • MAX_TOKENS: Generation stopped because max_output_tokens limit was reached.
      • SAFETY: Content violated safety policies.
      • RECITATION: Model generated content too similar to training data.
      • LANGUAGE: Language-related issues.
      • OTHER: Generic stop reason.
      • BLOCKLIST: Content contained blocklisted terms.
      • PROHIBITED_CONTENT: Content was deemed illegal/harmful.
      • SPII: Contains Sensitive Personally Identifiable Information.
      • MALFORMED_FUNCTION_CALL: Model attempted a function call but it was malformed.
      • IMAGE_SAFETY: Image content violated safety policies.
      • UNEXPECTED_TOOL_CALL: Model produced a tool call when not expected or configured.
  • urlContextMetadata (object, optional, default: null)
    • Description: Metadata related to URL context retrieval tool.
    • Type: Object, conforms to the #/definitions/UrlContextMetadata schema.
    • Implications: Relevant if URL retrieval tools were used as part of the generation process.
  • avgLogprobs (number, optional, default: null)
    • Description: Output only. Average log probability score of the candidate.
    • Type: Number.
    • Implications: A higher value indicates higher confidence in the generated sequence of tokens. Useful for advanced analysis of model confidence.
  • groundingMetadata (object, optional, default: null)
    • Description: Output only. Metadata specifies sources used to ground generated content.
    • Type: Object, conforms to the #/definitions/GroundingMetadata schema.
    • Implications: Provided when grounding is enabled, indicating external information (e.g., from search or RAG) that influenced the response. Essential for verifying factual accuracy and tracing information sources.
  • index (integer, optional, default: null)
    • Description: Output only. Index of the candidate.
    • Type: Integer.
    • Implications: Useful for identifying which candidate in the candidates array this object corresponds to, especially if processing responses asynchronously.
  • logprobsResult (object, optional, default: null)
    • Description: Output only. Log-likelihood scores for the response tokens and top tokens.
    • Type: Object, conforms to the #/definitions/LogprobsResult schema.
    • Implications: Provides granular token-level log probabilities. Advanced use for research, understanding model certainty token by token, or implementing custom confidence thresholds.
  • safetyRatings (array of SafetyRating, optional, default: null)
    • Description: Output only. List of ratings for the safety of a response candidate. There is at most one rating per category.
    • Type: Array of objects, where each object conforms to the #/definitions/SafetyRating schema.
    • Implications: Crucial for content moderation. If any rating indicates blocked: true, the entire candidate should typically not be used.

4. Content

Represents multi-part content of a message, either from a user or the model.

  • parts (array of Part, optional, default: null)
    • Description: List of parts that constitute a single message. Each part may have a different IANA MIME type.
    • Type: Array of objects, where each object conforms to the #/definitions/Part schema.
    • Implications: This is how multimodal content (text, images, function calls, etc.) is represented within a single turn.
  • role (string, optional, default: null)
    • Description: Optional. The producer of the content. Must be either ‘user’ or ‘model’. Useful to set for multi-turn conversations, otherwise can be empty. If role is not specified, SDK will determine the role.
    • Type: String ("user" or "model").
    • Implications: Essential for maintaining conversational turns and history. In a GenerateContentResponse, this will typically be "model".

5. Part

A datatype containing media content. Exactly one field within a Part should be set.

  • videoMetadata (object, optional, default: null)
    • Description: Metadata for a given video.
    • Type: Object, conforms to the #/definitions/VideoMetadata schema.
    • Implications: If the model output includes a reference to video data (e.g., a URI for a video it generated or analyzed), this metadata describes it.
  • thought (boolean, optional, default: null)
    • Description: Indicates if the part is thought from the model.
    • Type: Boolean.
    • Implications: If the model is configured to output its “thoughts” or reasoning steps, these will be marked with thought: true. This is for internal debugging or advanced prompt engineering, not typically for end-user display.
  • inlineData (object, optional, default: null)
    • Description: Optional. Inlined bytes data.
    • Type: Object, conforms to the #/definitions/Blob schema.
    • Implications: Used for small binary data directly embedded in the response, such as small images. The Blob object contains data (base64url encoded), mimeType, and displayName.
  • fileData (object, optional, default: null)
    • Description: Optional. URI based data.
    • Type: Object, conforms to the #/definitions/FileData schema.
    • Implications: Used for larger files referenced by a URI. The FileData object contains fileUri, mimeType, and displayName.
  • thoughtSignature (string, optional, default: null)
    • Description: An opaque signature for the thought so it can be reused in subsequent requests.
    • Type: String, format: base64url.
    • Implications: Related to thought. Allows the model to reference and reuse prior internal thought processes in subsequent turns without re-generating them.
  • codeExecutionResult (object, optional, default: null)
    • Description: Optional. Result of executing the ExecutableCode. Always follows a part containing ExecutableCode.
    • Type: Object, conforms to the #/definitions/CodeExecutionResult schema.
    • Implications: When the model generates ExecutableCode and it’s run, the result of that execution is returned in this part. Essential for tool execution loops.
  • executableCode (object, optional, default: null)
    • Description: Optional. Code generated by the model that is meant to be executed. Generated when using a FunctionDeclaration tool and FunctionCallingConfig mode is set to Mode.CODE.
    • Type: Object, conforms to the #/definitions/ExecutableCode schema.
    • Implications: Indicates the model wants to run code. The client is responsible for executing this code and returning the result via a CodeExecutionResult part in a subsequent request.
  • functionCall (object, optional, default: null)
    • Description: Optional. A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name with the parameters and their values.
    • Type: Object, conforms to the #/definitions/FunctionCall schema.
    • Implications: When the model decides to use a declared tool (function). The client must parse this FunctionCall and invoke the corresponding function.
  • functionResponse (object, optional, default: null)
    • Description: Optional. The result output of a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function call. It is used as context to the model.
    • Type: Object, conforms to the #/definitions/FunctionResponse schema.
    • Implications: This is the result of a function call previously requested by the model. The client sends this back to the model to provide context for further generation.
  • text (string, optional, default: null)
    • Description: Optional. Text part (can be code).
    • Type: String.
    • Implications: The most common type of content returned by the model. This is the plain text or code that the model generates.

6. GenerateContentResponsePromptFeedback

Details about how the input prompt was handled regarding safety.

  • blockReason (enum BlockedReason, optional, default: null)
    • Description: Output only. Blocked reason.
    • Type: Enum: BLOCKED_REASON_UNSPECIFIED, SAFETY, OTHER, BLOCKLIST, PROHIBITED_CONTENT.
    • Implications: Indicates the specific reason the prompt was blocked.
  • blockReasonMessage (string, optional, default: null)
    • Description: Output only. A readable block reason message.
    • Type: String.
    • Implications: Provides more human-friendly context for the blockReason.
  • safetyRatings (array of SafetyRating, optional, default: null)
    • Description: Output only. Safety ratings for the prompt.
    • Type: Array of objects, where each object conforms to the #/definitions/SafetyRating schema.
    • Implications: Detailed breakdown of safety violations in the input prompt across different categories.

7. GenerateContentResponseUsageMetadata

Detailed token usage information.

  • cacheTokensDetails (array of ModalityTokenCount, optional, default: null)
    • Description: Output only. List of modalities of the cached content in the request input.
    • Type: Array of ModalityTokenCount objects.
    • Implications: If using caching for input prompts, this breaks down token counts by modality for the cached portion.
  • cachedContentTokenCount (integer, optional, default: null)
    • Description: Output only. Number of tokens in the cached part in the input (the cached content).
    • Type: Integer.
    • Implications: Total token count for the cached segment of the prompt.
  • candidatesTokenCount (integer, optional, default: null)
    • Description: Number of tokens in the response(s) across all candidates.
    • Type: Integer.
    • Implications: Total output tokens generated by the model.
  • candidatesTokensDetails (array of ModalityTokenCount, optional, default: null)
    • Description: Output only. List of modalities that were returned in the response.
    • Type: Array of ModalityTokenCount objects.
    • Implications: Breaks down the candidatesTokenCount by modality (e.g., how many text tokens vs. image tokens).
  • promptTokenCount (integer, optional, default: null)
    • Description: Number of tokens in the request. When cached_content is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
    • Type: Integer.
    • Implications: Total input tokens sent to the model, regardless of whether parts were cached.
  • promptTokensDetails (array of ModalityTokenCount, optional, default: null)
    • Description: Output only. List of modalities that were processed in the request input.
    • Type: Array of ModalityTokenCount objects.
    • Implications: Breaks down the promptTokenCount by modality (e.g., how many text tokens from the prompt vs. image tokens from the prompt).
  • thoughtsTokenCount (integer, optional, default: null)
    • Description: Output only. Number of tokens present in thoughts output.
    • Type: Integer.
    • Implications: If the model generated thought parts, this counts their tokens.
  • toolUsePromptTokenCount (integer, optional, default: null)
    • Description: Output only. Number of tokens present in tool-use prompt(s).
    • Type: Integer.
    • Implications: If the model engaged in tool use (e.g., FunctionCall or ExecutableCode), this counts the tokens consumed by those internal prompts.
  • toolUsePromptTokensDetails (array of ModalityTokenCount, optional, default: null)
    • Description: Output only. List of modalities that were processed for tool-use request inputs.
    • Type: Array of ModalityTokenCount objects.
    • Implications: Modality breakdown for tokens used in tool-use prompts.
  • totalTokenCount (integer, optional, default: null)
    • Description: Total token count for prompt, response candidates, and tool-use prompts (if present).
    • Type: Integer.
    • Implications: The grand total of tokens for the entire request-response cycle, typically used for billing.
  • trafficType (enum TrafficType, optional, default: null)
    • Description: Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota.
    • Type: Enum: TRAFFIC_TYPE_UNSPECIFIED, ON_DEMAND, PROVISIONED_THROUGHPUT.
    • Implications: Informative for understanding billing models and resource consumption.

8. Auxiliary Schemas (Used by Candidate and PromptFeedback)

8.1 CitationMetadata and Citation

  • CitationMetadata (object)
    • citations (array of Citation, optional)
      • Description: Contains citation information when the model directly quotes, at length, from another source. Can include traditional websites and code repositories.
      • Type: Array of Citation objects.
  • Citation (object)
    • endIndex (integer, optional): End index into the content.
    • license (string, optional): License of the attribution.
    • publicationDate (object GoogleTypeDate, optional): Publication date of the attribution.
    • startIndex (integer, optional): Start index into the content.
    • title (string, optional): Title of the attribution.
    • uri (string, optional): URL reference of the attribution.
    • Implications: Provides transparency and allows users to verify information or explore sources. Important for applications where factual accuracy and source attribution are critical.

8.2 SafetyRating and related enums

  • SafetyRating (object)
    • blocked (boolean, optional): Indicates whether the content was filtered out because of this rating.
    • category (enum HarmCategory, optional): Harm category.
      • Enum: HARM_CATEGORY_UNSPECIFIED, HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_CIVIC_INTEGRITY.
    • probability (enum HarmProbability, optional): Harm probability levels in the content.
      • Enum: HARM_PROBABILITY_UNSPECIFIED, NEGLIGIBLE, LOW, MEDIUM, HIGH.
    • probabilityScore (number, optional): Harm probability score. (Raw score).
    • severity (enum HarmSeverity, optional): Harm severity levels in the content.
      • Enum: HARM_SEVERITY_UNSPECIFIED, HARM_SEVERITY_NEGLIGIBLE, HARM_SEVERITY_LOW, HARM_SEVERITY_MEDIUM, HARM_SEVERITY_HIGH.
    • severityScore (number, optional): Harm severity score. (Raw score).
    • Implications: Essential for implementing content moderation policies. If blocked is true for any SafetyRating, the content is considered unsuitable. The probability and severity scores/enums allow for fine-grained control and understanding of the detected harm.

8.3 UrlContextMetadata and UrlMetadata

  • UrlContextMetadata (object)
    • urlMetadata (array of UrlMetadata, optional)
      • Description: List of URL contexts.
      • Type: Array of UrlMetadata objects.
  • UrlMetadata (object)
    • retrievedUrl (string, optional): The URL retrieved by the tool.
    • urlRetrievalStatus (enum UrlRetrievalStatus, optional): Status of the URL retrieval.
      • Enum: URL_RETRIEVAL_STATUS_UNSPECIFIED, URL_RETRIEVAL_STATUS_SUCCESS, URL_RETRIEVAL_STATUS_ERROR.
    • Implications: Provides information about external URLs that were accessed or considered by the model during content generation, especially when using URL retrieval tools.

8.4 GroundingMetadata and GroundingChunk

  • GroundingMetadata (object)
    • groundingChunks (array of GroundingChunk, optional): List of supporting references retrieved from specified grounding source.
    • groundingSupports (array of GroundingSupport, optional): List of grounding support (mapping to segments).
    • retrievalMetadata (object RetrievalMetadata, optional): Retrieval metadata.
    • retrievalQueries (array of string, optional): Queries executed by the retrieval tools.
    • searchEntryPoint (object SearchEntryPoint, optional): Google search entry for the following-up web searches.
    • webSearchQueries (array of string, optional): Web search queries for the following-up web search.
  • GroundingChunk (object)
    • retrievedContext (object GroundingChunkRetrievedContext, optional): Chunk from context retrieved by retrieval tools.
    • web (object GroundingChunkWeb, optional): Chunk from the web.
  • GroundingChunkRetrievedContext (object)
    • ragChunk (object RagChunk, optional): Additional context for RAG retrieval result.
    • text (string, optional): Text of the attribution.
    • title (string, optional): Title of the attribution.
    • uri (string, optional): URI reference of the attribution.
  • GroundingChunkWeb (object)
    • domain (string, optional): Domain of the (original) URI.
    • title (string, optional): Title of the chunk.
    • uri (string, optional): URI reference of the chunk.
  • GroundingSupport (object)
    • confidenceScores (array of number, optional): Confidence score of the support references.
    • groundingChunkIndices (array of integer, optional): Indices into grounding_chunk associated with the claim.
    • segment (object Segment, optional): Segment of the content this support belongs to.
  • Segment (object)
    • endIndex (integer, optional): End index in the given Part (bytes).
    • partIndex (integer, optional): Index of a Part object within its parent Content.
    • startIndex (integer, optional): Start index in the given Part (bytes).
    • text (string, optional): The text corresponding to the segment from the response.
  • Implications: Provides deep insights into how the model used external information to generate its response. This is especially useful for RAG (Retrieval Augmented Generation) and web search grounding scenarios. It allows developers to trace the specific snippets of information that supported the model’s output and their confidence levels.

8.5 LogprobsResult, LogprobsResultCandidate, LogprobsResultTopCandidates

  • LogprobsResult (object)
    • chosenCandidates (array of LogprobsResultCandidate, optional): Log probabilities for the tokens chosen by the model.
    • topCandidates (array of LogprobsResultTopCandidates, optional): Top N log probabilities at each decoding step.
  • LogprobsResultCandidate (object)
    • logProbability (number, optional): The candidate’s log probability.
    • token (string, optional): The candidate’s token string value.
    • tokenId (integer, optional): The candidate’s token id value.
  • LogprobsResultTopCandidates (object)
    • candidates (array of LogprobsResultCandidate, optional): Sorted by log probability in descending order.
  • Implications: For advanced users who need to analyze the model’s token-level uncertainty and explore alternative token choices at each step. This can be used for debugging, research, or implementing custom confidence-based filtering.

8.6 FunctionCall and FunctionResponse

  • FunctionCall (object)
    • id (string, optional): Unique ID for the function call.
    • args (object with additionalProperties: true, optional): Function parameters and values in JSON object format.
    • name (string, optional): Name of the function to call.
  • FunctionResponse (object)
    • willContinue (boolean, optional): Signals if the function call is a generator.
    • scheduling (enum FunctionResponseScheduling, optional): Specifies how the response should be scheduled.
      • Enum: SCHEDULING_UNSPECIFIED, SILENT, WHEN_IDLE, INTERRUPT.
    • id (string, optional): ID of the function call this response is for.
    • name (string, optional): Name of the function.
    • response (object with additionalProperties: true, optional): Function response in JSON object format.
  • Implications: These are the core components for implementing and interacting with tool use (function calling). The model generates FunctionCall parts, your system executes them, and then you provide the results back to the model via FunctionResponse parts.

8.7 ExecutableCode and CodeExecutionResult

  • ExecutableCode (object)
    • code (string, optional): The code to be executed.
    • language (enum Language, optional): Programming language of the code.
      • Enum: LANGUAGE_UNSPECIFIED, PYTHON.
  • CodeExecutionResult (object)
    • outcome (enum Outcome, optional): Outcome of the code execution.
      • Enum: OUTCOME_UNSPECIFIED, OUTCOME_OK, OUTCOME_FAILED, OUTCOME_DEADLINE_EXCEEDED.
    • output (string, optional): Contains stdout on success, stderr or other description otherwise.
  • Implications: Enables the model to generate and request execution of code snippets. This is distinct from regular function calls and is often used for scenarios where the model itself needs to compute something programmatically.

9. Key Takeaways for Prompt Engineers

  • Multimodality is in Part: Always remember that content is broken down into Part objects within a Content object. Each Part can hold different types of data (text, image, function calls, code, etc.).
  • Safety First: Pay close attention to safetyRatings in candidates and promptFeedback in the root response. These are crucial for building responsible and compliant applications.
  • Token Management: Utilize usageMetadata for accurate token consumption tracking, which directly impacts billing.
  • Tool Use Flow: For function calling or code execution, understand the FunctionCall/FunctionResponse and ExecutableCode/CodeExecutionResult pairs, as they dictate the interaction loop.
  • Structured Output: Leverage the parsed field if you’re using response_schema in your request to receive strongly typed and pre-parsed output.
  • Grounding and Attribution: If using grounding, the groundingMetadata provides invaluable data for verifying factual claims and understanding source influence.
  • Streaming vs. Non-Streaming: Be mindful that some fields (like parsed and certain aspects of promptFeedback) might behave differently or be unavailable in streaming responses. finishReason is particularly important for streaming to know if a candidate is complete.
{
  "$defs": {
    "BaseModel": {
      "properties": {},
      "title": "BaseModel",
      "type": "object"
    },
    "Blob": {
      "additionalProperties": false,
      "description": "Content blob.",
      "properties": {
        "displayName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is not currently used in the Gemini GenerateContent calls.",
          "title": "Displayname"
        },
        "data": {
          "anyOf": [
            {
              "format": "base64url",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. Raw bytes.",
          "title": "Data"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The IANA standard MIME type of the source data.",
          "title": "Mimetype"
        }
      },
      "title": "Blob",
      "type": "object"
    },
    "BlockedReason": {
      "description": "Output only. Blocked reason.",
      "enum": [
        "BLOCKED_REASON_UNSPECIFIED",
        "SAFETY",
        "OTHER",
        "BLOCKLIST",
        "PROHIBITED_CONTENT"
      ],
      "title": "BlockedReason",
      "type": "string"
    },
    "Candidate": {
      "additionalProperties": false,
      "description": "A response candidate generated from the model.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "$ref": "#/$defs/Content"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Contains the multi-part content of the response.\n      "
        },
        "citationMetadata": {
          "anyOf": [
            {
              "$ref": "#/$defs/CitationMetadata"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Source attribution of the generated content.\n      "
        },
        "finishMessage": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Describes the reason the model stopped generating tokens.\n      ",
          "title": "Finishmessage"
        },
        "tokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of tokens for this candidate.\n      ",
          "title": "Tokencount"
        },
        "finishReason": {
          "anyOf": [
            {
              "$ref": "#/$defs/FinishReason"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The reason why the model stopped generating tokens.\n      If empty, the model has not stopped generating the tokens.\n      "
        },
        "urlContextMetadata": {
          "anyOf": [
            {
              "$ref": "#/$defs/UrlContextMetadata"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Metadata related to url context retrieval tool."
        },
        "avgLogprobs": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Average log probability score of the candidate.",
          "title": "Avglogprobs"
        },
        "groundingMetadata": {
          "anyOf": [
            {
              "$ref": "#/$defs/GroundingMetadata"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Metadata specifies sources used to ground generated content."
        },
        "index": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Index of the candidate.",
          "title": "Index"
        },
        "logprobsResult": {
          "anyOf": [
            {
              "$ref": "#/$defs/LogprobsResult"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Log-likelihood scores for the response tokens and top tokens"
        },
        "safetyRatings": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/SafetyRating"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. List of ratings for the safety of a response candidate. There is at most one rating per category.",
          "title": "Safetyratings"
        }
      },
      "title": "Candidate",
      "type": "object"
    },
    "Citation": {
      "additionalProperties": false,
      "description": "Source attributions for content.",
      "properties": {
        "endIndex": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. End index into the content.",
          "title": "Endindex"
        },
        "license": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. License of the attribution.",
          "title": "License"
        },
        "publicationDate": {
          "anyOf": [
            {
              "$ref": "#/$defs/GoogleTypeDate"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Publication date of the attribution."
        },
        "startIndex": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Start index into the content.",
          "title": "Startindex"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Title of the attribution.",
          "title": "Title"
        },
        "uri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Url reference of the attribution.",
          "title": "Uri"
        }
      },
      "title": "Citation",
      "type": "object"
    },
    "CitationMetadata": {
      "additionalProperties": false,
      "description": "Citation information when the model quotes another source.",
      "properties": {
        "citations": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/Citation"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Contains citation information when the model directly quotes, at\n      length, from another source. Can include traditional websites and code\n      repositories.\n      ",
          "title": "Citations"
        }
      },
      "title": "CitationMetadata",
      "type": "object"
    },
    "CodeExecutionResult": {
      "additionalProperties": false,
      "description": "Result of executing the [ExecutableCode].\n\nAlways follows a `part` containing the [ExecutableCode].",
      "properties": {
        "outcome": {
          "anyOf": [
            {
              "$ref": "#/$defs/Outcome"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. Outcome of the code execution."
        },
        "output": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Contains stdout when code execution is successful, stderr or other description otherwise.",
          "title": "Output"
        }
      },
      "title": "CodeExecutionResult",
      "type": "object"
    },
    "Content": {
      "additionalProperties": false,
      "description": "Contains the multi-part content of a message.",
      "properties": {
        "parts": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/Part"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of parts that constitute a single message. Each part may have\n      a different IANA MIME type.",
          "title": "Parts"
        },
        "role": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The producer of the content. Must be either 'user' or\n      'model'. Useful to set for multi-turn conversations, otherwise can be\n      empty. If role is not specified, SDK will determine the role.",
          "title": "Role"
        }
      },
      "title": "Content",
      "type": "object"
    },
    "ExecutableCode": {
      "additionalProperties": false,
      "description": "Code generated by the model that is meant to be executed, and the result returned to the model.\n\nGenerated when using the [FunctionDeclaration] tool and\n[FunctionCallingConfig] mode is set to [Mode.CODE].",
      "properties": {
        "code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The code to be executed.",
          "title": "Code"
        },
        "language": {
          "anyOf": [
            {
              "$ref": "#/$defs/Language"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. Programming language of the `code`."
        }
      },
      "title": "ExecutableCode",
      "type": "object"
    },
    "FileData": {
      "additionalProperties": false,
      "description": "URI based data.",
      "properties": {
        "displayName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. It is not currently used in the Gemini GenerateContent calls.",
          "title": "Displayname"
        },
        "fileUri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. URI.",
          "title": "Fileuri"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The IANA standard MIME type of the source data.",
          "title": "Mimetype"
        }
      },
      "title": "FileData",
      "type": "object"
    },
    "FinishReason": {
      "description": "Output only. The reason why the model stopped generating tokens.\n\nIf empty, the model has not stopped generating the tokens.",
      "enum": [
        "FINISH_REASON_UNSPECIFIED",
        "STOP",
        "MAX_TOKENS",
        "SAFETY",
        "RECITATION",
        "LANGUAGE",
        "OTHER",
        "BLOCKLIST",
        "PROHIBITED_CONTENT",
        "SPII",
        "MALFORMED_FUNCTION_CALL",
        "IMAGE_SAFETY",
        "UNEXPECTED_TOOL_CALL"
      ],
      "title": "FinishReason",
      "type": "string"
    },
    "FunctionCall": {
      "additionalProperties": false,
      "description": "A function call.",
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The unique id of the function call. If populated, the client to execute the\n   `function_call` and return the response with the matching `id`.",
          "title": "Id"
        },
        "args": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.",
          "title": "Args"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The name of the function to call. Matches [FunctionDeclaration.name].",
          "title": "Name"
        }
      },
      "title": "FunctionCall",
      "type": "object"
    },
    "FunctionResponse": {
      "additionalProperties": false,
      "description": "A function response.",
      "properties": {
        "willContinue": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "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 (see FunctionDeclaration.behavior for details), ignored otherwise. If false, the default, future responses will not be considered. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished.",
          "title": "Willcontinue"
        },
        "scheduling": {
          "anyOf": [
            {
              "$ref": "#/$defs/FunctionResponseScheduling"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE."
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.",
          "title": "Id"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].",
          "title": "Name"
        },
        "response": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Required. The function response in JSON object format. Use \"output\" key to specify function output and \"error\" key to specify error details (if any). If \"output\" and \"error\" keys are not specified, then whole \"response\" is treated as function output.",
          "title": "Response"
        }
      },
      "title": "FunctionResponse",
      "type": "object"
    },
    "FunctionResponseScheduling": {
      "description": "Specifies how the response should be scheduled in the conversation.",
      "enum": [
        "SCHEDULING_UNSPECIFIED",
        "SILENT",
        "WHEN_IDLE",
        "INTERRUPT"
      ],
      "title": "FunctionResponseScheduling",
      "type": "string"
    },
    "GenerateContentResponsePromptFeedback": {
      "additionalProperties": false,
      "description": "Content filter results for a prompt sent in the request.",
      "properties": {
        "blockReason": {
          "anyOf": [
            {
              "$ref": "#/$defs/BlockedReason"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Blocked reason."
        },
        "blockReasonMessage": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. A readable block reason message.",
          "title": "Blockreasonmessage"
        },
        "safetyRatings": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/SafetyRating"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Safety ratings.",
          "title": "Safetyratings"
        }
      },
      "title": "GenerateContentResponsePromptFeedback",
      "type": "object"
    },
    "GenerateContentResponseUsageMetadata": {
      "additionalProperties": false,
      "description": "Usage metadata about response(s).",
      "properties": {
        "cacheTokensDetails": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModalityTokenCount"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. List of modalities of the cached content in the request input.",
          "title": "Cachetokensdetails"
        },
        "cachedContentTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Number of tokens in the cached part in the input (the cached content).",
          "title": "Cachedcontenttokencount"
        },
        "candidatesTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of tokens in the response(s).",
          "title": "Candidatestokencount"
        },
        "candidatesTokensDetails": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModalityTokenCount"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. List of modalities that were returned in the response.",
          "title": "Candidatestokensdetails"
        },
        "promptTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of tokens in the request. When `cached_content` is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.",
          "title": "Prompttokencount"
        },
        "promptTokensDetails": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModalityTokenCount"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. List of modalities that were processed in the request input.",
          "title": "Prompttokensdetails"
        },
        "thoughtsTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Number of tokens present in thoughts output.",
          "title": "Thoughtstokencount"
        },
        "toolUsePromptTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Number of tokens present in tool-use prompt(s).",
          "title": "Tooluseprompttokencount"
        },
        "toolUsePromptTokensDetails": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ModalityTokenCount"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. List of modalities that were processed for tool-use request inputs.",
          "title": "Tooluseprompttokensdetails"
        },
        "totalTokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Total token count for prompt, response candidates, and tool-use prompts (if present).",
          "title": "Totaltokencount"
        },
        "trafficType": {
          "anyOf": [
            {
              "$ref": "#/$defs/TrafficType"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Traffic type. This shows whether a request consumes Pay-As-You-Go or Provisioned Throughput quota."
        }
      },
      "title": "GenerateContentResponseUsageMetadata",
      "type": "object"
    },
    "GoogleTypeDate": {
      "additionalProperties": false,
      "description": "Represents a whole or partial calendar date, such as a birthday.\n\nThe time of day and time zone are either specified elsewhere or are\ninsignificant. The date is relative to the Gregorian Calendar. This can\nrepresent one of the following: * A full date, with non-zero year, month, and\nday values. * A month and day, with a zero year (for example, an anniversary).\n* A year on its own, with a zero month and a zero day. * A year and month,\nwith a zero day (for example, a credit card expiration date). Related types: *\ngoogle.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp",
      "properties": {
        "day": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.",
          "title": "Day"
        },
        "month": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.",
          "title": "Month"
        },
        "year": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.",
          "title": "Year"
        }
      },
      "title": "GoogleTypeDate",
      "type": "object"
    },
    "GroundingChunk": {
      "additionalProperties": false,
      "description": "Grounding chunk.",
      "properties": {
        "retrievedContext": {
          "anyOf": [
            {
              "$ref": "#/$defs/GroundingChunkRetrievedContext"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Grounding chunk from context retrieved by the retrieval tools."
        },
        "web": {
          "anyOf": [
            {
              "$ref": "#/$defs/GroundingChunkWeb"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Grounding chunk from the web."
        }
      },
      "title": "GroundingChunk",
      "type": "object"
    },
    "GroundingChunkRetrievedContext": {
      "additionalProperties": false,
      "description": "Chunk from context retrieved by the retrieval tools.",
      "properties": {
        "ragChunk": {
          "anyOf": [
            {
              "$ref": "#/$defs/RagChunk"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool."
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Text of the attribution.",
          "title": "Text"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Title of the attribution.",
          "title": "Title"
        },
        "uri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "URI reference of the attribution.",
          "title": "Uri"
        }
      },
      "title": "GroundingChunkRetrievedContext",
      "type": "object"
    },
    "GroundingChunkWeb": {
      "additionalProperties": false,
      "description": "Chunk from the web.",
      "properties": {
        "domain": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Domain of the (original) URI.",
          "title": "Domain"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Title of the chunk.",
          "title": "Title"
        },
        "uri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "URI reference of the chunk.",
          "title": "Uri"
        }
      },
      "title": "GroundingChunkWeb",
      "type": "object"
    },
    "GroundingMetadata": {
      "additionalProperties": false,
      "description": "Metadata returned to client when grounding is enabled.",
      "properties": {
        "groundingChunks": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/GroundingChunk"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of supporting references retrieved from specified grounding source.",
          "title": "Groundingchunks"
        },
        "groundingSupports": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/GroundingSupport"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. List of grounding support.",
          "title": "Groundingsupports"
        },
        "retrievalMetadata": {
          "anyOf": [
            {
              "$ref": "#/$defs/RetrievalMetadata"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Output only. Retrieval metadata."
        },
        "retrievalQueries": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Queries executed by the retrieval tools.",
          "title": "Retrievalqueries"
        },
        "searchEntryPoint": {
          "anyOf": [
            {
              "$ref": "#/$defs/SearchEntryPoint"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Google search entry for the following-up web searches."
        },
        "webSearchQueries": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Web search queries for the following-up web search.",
          "title": "Websearchqueries"
        }
      },
      "title": "GroundingMetadata",
      "type": "object"
    },
    "GroundingSupport": {
      "additionalProperties": false,
      "description": "Grounding support.",
      "properties": {
        "confidenceScores": {
          "anyOf": [
            {
              "items": {
                "type": "number"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the grounding_chunk_indices.",
          "title": "Confidencescores"
        },
        "groundingChunkIndices": {
          "anyOf": [
            {
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim.",
          "title": "Groundingchunkindices"
        },
        "segment": {
          "anyOf": [
            {
              "$ref": "#/$defs/Segment"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Segment of the content this support belongs to."
        }
      },
      "title": "GroundingSupport",
      "type": "object"
    },
    "HarmCategory": {
      "description": "Required. Harm category.",
      "enum": [
        "HARM_CATEGORY_UNSPECIFIED",
        "HARM_CATEGORY_HATE_SPEECH",
        "HARM_CATEGORY_DANGEROUS_CONTENT",
        "HARM_CATEGORY_HARASSMENT",
        "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "HARM_CATEGORY_CIVIC_INTEGRITY"
      ],
      "title": "HarmCategory",
      "type": "string"
    },
    "HarmProbability": {
      "description": "Output only. Harm probability levels in the content.",
      "enum": [
        "HARM_PROBABILITY_UNSPECIFIED",
        "NEGLIGIBLE",
        "LOW",
        "MEDIUM",
        "HIGH"
      ],
      "title": "HarmProbability",
      "type": "string"
    },
    "HarmSeverity": {
      "description": "Output only. Harm severity levels in the content.",
      "enum": [
        "HARM_SEVERITY_UNSPECIFIED",
        "HARM_SEVERITY_NEGLIGIBLE",
        "HARM_SEVERITY_LOW",
        "HARM_SEVERITY_MEDIUM",
        "HARM_SEVERITY_HIGH"
      ],
      "title": "HarmSeverity",
      "type": "string"
    },
    "Language": {
      "description": "Required. Programming language of the `code`.",
      "enum": [
        "LANGUAGE_UNSPECIFIED",
        "PYTHON"
      ],
      "title": "Language",
      "type": "string"
    },
    "LogprobsResult": {
      "additionalProperties": false,
      "description": "Logprobs Result",
      "properties": {
        "chosenCandidates": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/LogprobsResultCandidate"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Length = total number of decoding steps. The chosen candidates may or may not be in top_candidates.",
          "title": "Chosencandidates"
        },
        "topCandidates": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/LogprobsResultTopCandidates"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Length = total number of decoding steps.",
          "title": "Topcandidates"
        }
      },
      "title": "LogprobsResult",
      "type": "object"
    },
    "LogprobsResultCandidate": {
      "additionalProperties": false,
      "description": "Candidate for the logprobs token and score.",
      "properties": {
        "logProbability": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The candidate's log probability.",
          "title": "Logprobability"
        },
        "token": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The candidate's token string value.",
          "title": "Token"
        },
        "tokenId": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The candidate's token id value.",
          "title": "Tokenid"
        }
      },
      "title": "LogprobsResultCandidate",
      "type": "object"
    },
    "LogprobsResultTopCandidates": {
      "additionalProperties": false,
      "description": "Candidates with top log probabilities at each decoding step.",
      "properties": {
        "candidates": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/LogprobsResultCandidate"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Sorted by log probability in descending order.",
          "title": "Candidates"
        }
      },
      "title": "LogprobsResultTopCandidates",
      "type": "object"
    },
    "MediaModality": {
      "description": "Server content modalities.",
      "enum": [
        "MODALITY_UNSPECIFIED",
        "TEXT",
        "IMAGE",
        "VIDEO",
        "AUDIO",
        "DOCUMENT"
      ],
      "title": "MediaModality",
      "type": "string"
    },
    "ModalityTokenCount": {
      "additionalProperties": false,
      "description": "Represents token counting info for a single modality.",
      "properties": {
        "modality": {
          "anyOf": [
            {
              "$ref": "#/$defs/MediaModality"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The modality associated with this token count."
        },
        "tokenCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of tokens.",
          "title": "Tokencount"
        }
      },
      "title": "ModalityTokenCount",
      "type": "object"
    },
    "Outcome": {
      "description": "Required. Outcome of the code execution.",
      "enum": [
        "OUTCOME_UNSPECIFIED",
        "OUTCOME_OK",
        "OUTCOME_FAILED",
        "OUTCOME_DEADLINE_EXCEEDED"
      ],
      "title": "Outcome",
      "type": "string"
    },
    "Part": {
      "additionalProperties": false,
      "description": "A datatype containing media content.\n\nExactly one field within a Part should be set, representing the specific type\nof content being conveyed. Using multiple fields within the same `Part`\ninstance is considered invalid.",
      "properties": {
        "videoMetadata": {
          "anyOf": [
            {
              "$ref": "#/$defs/VideoMetadata"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Metadata for a given video."
        },
        "thought": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Indicates if the part is thought from the model.",
          "title": "Thought"
        },
        "inlineData": {
          "anyOf": [
            {
              "$ref": "#/$defs/Blob"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Inlined bytes data."
        },
        "fileData": {
          "anyOf": [
            {
              "$ref": "#/$defs/FileData"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. URI based data."
        },
        "thoughtSignature": {
          "anyOf": [
            {
              "format": "base64url",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "An opaque signature for the thought so it can be reused in subsequent requests.",
          "title": "Thoughtsignature"
        },
        "codeExecutionResult": {
          "anyOf": [
            {
              "$ref": "#/$defs/CodeExecutionResult"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Result of executing the [ExecutableCode]."
        },
        "executableCode": {
          "anyOf": [
            {
              "$ref": "#/$defs/ExecutableCode"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Code generated by the model that is meant to be executed."
        },
        "functionCall": {
          "anyOf": [
            {
              "$ref": "#/$defs/FunctionCall"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values."
        },
        "functionResponse": {
          "anyOf": [
            {
              "$ref": "#/$defs/FunctionResponse"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model."
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Text part (can be code).",
          "title": "Text"
        }
      },
      "title": "Part",
      "type": "object"
    },
    "RagChunk": {
      "additionalProperties": false,
      "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.",
      "properties": {
        "pageSpan": {
          "anyOf": [
            {
              "$ref": "#/$defs/RagChunkPageSpan"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "If populated, represents where the chunk starts and ends in the document."
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The content of the chunk.",
          "title": "Text"
        }
      },
      "title": "RagChunk",
      "type": "object"
    },
    "RagChunkPageSpan": {
      "additionalProperties": false,
      "description": "Represents where the chunk starts and ends in the document.",
      "properties": {
        "firstPage": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Page where chunk starts in the document. Inclusive. 1-indexed.",
          "title": "Firstpage"
        },
        "lastPage": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Page where chunk ends in the document. Inclusive. 1-indexed.",
          "title": "Lastpage"
        }
      },
      "title": "RagChunkPageSpan",
      "type": "object"
    },
    "RetrievalMetadata": {
      "additionalProperties": false,
      "description": "Metadata related to retrieval in the grounding flow.",
      "properties": {
        "googleSearchDynamicRetrievalScore": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.",
          "title": "Googlesearchdynamicretrievalscore"
        }
      },
      "title": "RetrievalMetadata",
      "type": "object"
    },
    "SafetyRating": {
      "additionalProperties": false,
      "description": "Safety rating corresponding to the generated content.",
      "properties": {
        "blocked": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Indicates whether the content was filtered out because of this rating.",
          "title": "Blocked"
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/HarmCategory"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Harm category."
        },
        "probability": {
          "anyOf": [
            {
              "$ref": "#/$defs/HarmProbability"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Harm probability levels in the content."
        },
        "probabilityScore": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Harm probability score.",
          "title": "Probabilityscore"
        },
        "severity": {
          "anyOf": [
            {
              "$ref": "#/$defs/HarmSeverity"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Harm severity levels in the content."
        },
        "severityScore": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Harm severity score.",
          "title": "Severityscore"
        }
      },
      "title": "SafetyRating",
      "type": "object"
    },
    "SearchEntryPoint": {
      "additionalProperties": false,
      "description": "Google search entry point.",
      "properties": {
        "renderedContent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Web content snippet that can be embedded in a web page or an app webview.",
          "title": "Renderedcontent"
        },
        "sdkBlob": {
          "anyOf": [
            {
              "format": "base64url",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. Base64 encoded JSON representing array of tuple.",
          "title": "Sdkblob"
        }
      },
      "title": "SearchEntryPoint",
      "type": "object"
    },
    "Segment": {
      "additionalProperties": false,
      "description": "Segment of the content.",
      "properties": {
        "endIndex": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero.",
          "title": "Endindex"
        },
        "partIndex": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. The index of a Part object within its parent Content object.",
          "title": "Partindex"
        },
        "startIndex": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.",
          "title": "Startindex"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Output only. The text corresponding to the segment from the response.",
          "title": "Text"
        }
      },
      "title": "Segment",
      "type": "object"
    },
    "TrafficType": {
      "description": "Output only.\n\nTraffic type. This shows whether a request consumes Pay-As-You-Go or\nProvisioned Throughput quota.",
      "enum": [
        "TRAFFIC_TYPE_UNSPECIFIED",
        "ON_DEMAND",
        "PROVISIONED_THROUGHPUT"
      ],
      "title": "TrafficType",
      "type": "string"
    },
    "UrlContextMetadata": {
      "additionalProperties": false,
      "description": "Metadata related to url context retrieval tool.",
      "properties": {
        "urlMetadata": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/UrlMetadata"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "List of url context.",
          "title": "Urlmetadata"
        }
      },
      "title": "UrlContextMetadata",
      "type": "object"
    },
    "UrlMetadata": {
      "additionalProperties": false,
      "description": "Context for a single url retrieval.",
      "properties": {
        "retrievedUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The URL retrieved by the tool.",
          "title": "Retrievedurl"
        },
        "urlRetrievalStatus": {
          "anyOf": [
            {
              "$ref": "#/$defs/UrlRetrievalStatus"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Status of the url retrieval."
        }
      },
      "title": "UrlMetadata",
      "type": "object"
    },
    "UrlRetrievalStatus": {
      "description": "Status of the url retrieval.",
      "enum": [
        "URL_RETRIEVAL_STATUS_UNSPECIFIED",
        "URL_RETRIEVAL_STATUS_SUCCESS",
        "URL_RETRIEVAL_STATUS_ERROR"
      ],
      "title": "UrlRetrievalStatus",
      "type": "string"
    },
    "VideoMetadata": {
      "additionalProperties": false,
      "description": "Describes how the video in the Part should be used by the model.",
      "properties": {
        "fps": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The frame rate of the video sent to the model. If not specified, the\n        default value will be 1.0. The fps range is (0.0, 24.0].",
          "title": "Fps"
        },
        "endOffset": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The end offset of the video.",
          "title": "Endoffset"
        },
        "startOffset": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional. The start offset of the video.",
          "title": "Startoffset"
        }
      },
      "title": "VideoMetadata",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "Response message for PredictionService.GenerateContent.",
  "properties": {
    "candidates": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/Candidate"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Response variations returned by the model.\n      ",
      "title": "Candidates"
    },
    "createTime": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Timestamp when the request is made to the server.\n      ",
      "title": "Createtime"
    },
    "responseId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Identifier for each response.\n      ",
      "title": "Responseid"
    },
    "modelVersion": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Output only. The model version used to generate the response.",
      "title": "Modelversion"
    },
    "promptFeedback": {
      "anyOf": [
        {
          "$ref": "#/$defs/GenerateContentResponsePromptFeedback"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations."
    },
    "usageMetadata": {
      "anyOf": [
        {
          "$ref": "#/$defs/GenerateContentResponseUsageMetadata"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Usage metadata about the response(s)."
    },
    "automaticFunctionCallingHistory": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/Content"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Automaticfunctioncallinghistory"
    },
    "parsed": {
      "anyOf": [
        {
          "$ref": "#/$defs/BaseModel"
        },
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "description": "Create a collection of name/value pairs.\n\nExample enumeration:\n\n>>> class Color(Enum):\n...     RED = 1\n...     BLUE = 2\n...     GREEN = 3\n\nAccess them by:\n\n- attribute access:\n\n  >>> Color.RED\n  <Color.RED: 1>\n\n- value lookup:\n\n  >>> Color(1)\n  <Color.RED: 1>\n\n- name lookup:\n\n  >>> Color['RED']\n  <Color.RED: 1>\n\nEnumerations can be iterated over, and know how many members they have:\n\n>>> len(Color)\n3\n\n>>> list(Color)\n[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]\n\nMethods can be added to enumerations, and members can have their own\nattributes -- see the documentation for details.",
          "enum": [],
          "title": "Enum"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "First candidate from the parsed response if response_schema is provided. Not available for streaming.",
      "title": "Parsed"
    }
  },
  "title": "GenerateContentResponse",
  "type": "object"
}

https://googleapis.github.io/python-genai


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *