Submodules

genai.client module

class genai.client.AsyncClient(api_client)

Bases: object

Client for making asynchronous (non-blocking) requests.

async aclose()

Closes the async client explicitly.

However, it doesn’t close the sync client, which can be closed using the Client.close() method or using the context manager.

Usage: .. code-block:: python

from google.genai import Client

async_client = Client(

vertexai=True, project=’my-project-id’, location=’us-central1’

).aio response_1 = await async_client.models.generate_content(

model=’gemini-2.0-flash’, contents=’Hello World’,

) response_2 = await async_client.models.generate_content(

model=’gemini-2.0-flash’, contents=’Hello World’,

) # Close the client to release resources. await async_client.aclose()

Return type:

None

property auth_tokens: AsyncTokens
property batches: AsyncBatches
property caches: AsyncCaches
property chats: AsyncChats
property file_search_stores: AsyncFileSearchStores
property files: AsyncFiles
property interactions: AsyncInteractionsResource
property live: AsyncLive
property models: AsyncModels
property operations: AsyncOperations
property tunings: AsyncTunings
class genai.client.Client(*, vertexai=None, api_key=None, credentials=None, project=None, location=None, debug_config=None, http_options=None)

Bases: object

Client for making synchronous requests.

Use this client to make a request to the Gemini Developer API or Vertex AI API and then wait for the response.

To initialize the client, provide the required arguments either directly or by using environment variables. Gemini API users and Vertex AI users in express mode can provide API key by providing input argument api_key=”your-api-key” or by defining GOOGLE_API_KEY=”your-api-key” as an environment variable

Vertex AI API users can provide inputs argument as vertexai=True, project=”your-project-id”, location=”us-central1” or by defining GOOGLE_GENAI_USE_VERTEXAI=true, GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.

api_key

The API key to use for authentication. Applies to the Gemini Developer API only.

vertexai

Indicates whether the client should use the Vertex AI API endpoints. Defaults to False (uses Gemini Developer API endpoints). Applies to the Vertex AI API only.

credentials

The credentials to use for authentication when calling the Vertex AI APIs. Credentials can be obtained from environment variables and default credentials. For more information, see Set up Application Default Credentials. Applies to the Vertex AI API only.

project

The Google Cloud project ID to use for quota. Can be obtained from environment variables (for example, GOOGLE_CLOUD_PROJECT). Applies to the Vertex AI API only. Find your Google Cloud project ID.

location

The location to send API requests to (for example, us-central1). Can be obtained from environment variables. Applies to the Vertex AI API only.

debug_config

Config settings that control network behavior of the client. This is typically used when running test code.

http_options

Http options to use for the client. These options will be applied to all requests made by the client. Example usage: client = genai.Client(http_options=types.HttpOptions(api_version=’v1’)).

Usage for the Gemini Developer API:

from google import genai

client = genai.Client(api_key='my-api-key')

Usage for the Vertex AI API:

from google import genai

client = genai.Client(
    vertexai=True, project='my-project-id', location='us-central1'
)

Initializes the client.

Parameters:
  • vertexai (bool) – Indicates whether the client should use the Vertex AI API endpoints. Defaults to False (uses Gemini Developer API endpoints). Applies to the Vertex AI API only.

  • api_key (str) –

    The API key to use for authentication. Applies to the Gemini Developer API only.

  • credentials (google.auth.credentials.Credentials) –

    The credentials to use for authentication when calling the Vertex AI APIs. Credentials can be obtained from environment variables and default credentials. For more information, see Set up Application Default Credentials. Applies to the Vertex AI API only.

  • project (str) –

    The Google Cloud project ID to use for quota. Can be obtained from environment variables (for example, GOOGLE_CLOUD_PROJECT). Applies to the Vertex AI API only.

  • location (str) –

    The location to send API requests to (for example, us-central1). Can be obtained from environment variables. Applies to the Vertex AI API only.

  • debug_config (DebugConfig) – Config settings that control network behavior of the client. This is typically used when running test code.

  • http_options (Union[HttpOptions, HttpOptionsDict]) – Http options to use for the client.

property aio: AsyncClient
property auth_tokens: Tokens
property batches: Batches
property caches: Caches
property chats: Chats
close()

Closes the synchronous client explicitly.

However, it doesn’t close the async client, which can be closed using the Client.aio.aclose() method or using the async context manager.

Usage: .. code-block:: python

from google.genai import Client

client = Client(

vertexai=True, project=’my-project-id’, location=’us-central1’

) response_1 = client.models.generate_content(

model=’gemini-2.0-flash’, contents=’Hello World’,

) response_2 = client.models.generate_content(

model=’gemini-2.0-flash’, contents=’Hello World’,

) # Close the client to release resources. client.close()

Return type:

None

property file_search_stores: FileSearchStores
property files: Files
property interactions: InteractionsResource
property models: Models
property operations: Operations
property tunings: Tunings
property vertexai: bool

Returns whether the client is using the Vertex AI API.

pydantic model genai.client.DebugConfig

Bases: BaseModel

Configuration options that change client network behavior when testing.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "DebugConfig",
   "description": "Configuration options that change client network behavior when testing.",
   "type": "object",
   "properties": {
      "client_mode": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "title": "Client Mode"
      },
      "replays_directory": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "title": "Replays Directory"
      },
      "replay_id": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "title": "Replay Id"
      }
   }
}

Fields:
field client_mode: Optional[str] [Optional]
field replay_id: Optional[str] [Optional]
field replays_directory: Optional[str] [Optional]

genai.batches module

class genai.batches.AsyncBatches(api_client_)

Bases: BaseModule

async cancel(*, name, config=None)

Cancels a batch job.

Only available for batch jobs that are running or pending.

Return type:

None

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the Vertex AI client. Or “batches/abc” using the Gemini Developer AI client.

Usage:

await client.aio.batches.cancel(name='123456789')
async create(*, model, src, config=None)

Creates a batch job asynchronously.

Return type:

BatchJob

Parameters:
  • model (str) – The model to use for the batch job.

  • src – The source of the batch job. Currently Vertex AI supports GCS URI(-s) or BigQuery URI. Example: “gs://path/to/input/data” or “bq://projectId.bqDatasetId.bqTableId”. Gemini Develop API supports List of inlined_request, or file name. Example: “files/file_name”.

  • config (CreateBatchJobConfig) – Optional configuration for the batch job.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = await client.aio.batches.create(
    model="gemini-2.0-flash-001",
    src="gs://path/to/input/data",
)
async create_embeddings(*, model, src, config=None)

Experimental Creates an asynchronously embedding batch job.

Return type:

BatchJob

Parameters:
  • model (str) – The model to use for the batch job.

  • src – Gemini Developer API supports inlined_requests, or file name. Example: “files/file_name”.

  • config (CreateBatchJobConfig) – Optional configuration for the batch job.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = await client.aio.batches.create_embeddings(
    model="text-embedding-004",
    src="files/my_embedding_input",
)
print(batch_job.state)
async delete(*, name, config=None)

Deletes a batch job.

Return type:

DeleteResourceJob

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the client.

Returns:

A DeleteResourceJob object that shows the status of the deletion.

Usage:

await client.aio.batches.delete(name='123456789')
async get(*, name, config=None)

Gets a batch job.

Return type:

BatchJob

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the Vertex AI client. Or “batches/abc” using the Gemini Developer AI client.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = await client.aio.batches.get(name='123456789')
print(f"Batch job: {batch_job.name}, state {batch_job.state}")
async list(*, config=None)

Lists batch jobs asynchronously.

Return type:

AsyncPager[BatchJob]

Parameters:

config (ListBatchJobsConfig) – Optional configuration for the list request.

Returns:

A Pager object that contains one page of batch jobs. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

class genai.batches.Batches(api_client_)

Bases: BaseModule

cancel(*, name, config=None)

Cancels a batch job.

Only available for batch jobs that are running or pending.

Return type:

None

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the Vertex AI client. Or “batches/abc” using the Gemini Developer AI client.

Usage:

client.batches.cancel(name='123456789')
create(*, model, src, config=None)

Creates a batch job.

Return type:

BatchJob

Parameters:
  • model (str) – The model to use for the batch job.

  • src – The source of the batch job. Currently Vertex AI supports GCS URI(-s) or BigQuery URI. Example: “gs://path/to/input/data” or “bq://projectId.bqDatasetId.bqTableId”. Gemini Developer API supports List of inlined_request, or file name. Example: “files/file_name”.

  • config (CreateBatchJobConfig) – Optional configuration for the batch job.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = client.batches.create(
    model="gemini-2.0-flash-001",
    src="gs://path/to/input/data",
)
print(batch_job.state)
create_embeddings(*, model, src, config=None)

Experimental Creates an embedding batch job.

Return type:

BatchJob

Parameters:
  • model (str) – The model to use for the batch job.

  • src – Gemini Developer API supports List of inlined_request, or file name. Example: “files/file_name”.

  • config (CreateBatchJobConfig) – Optional configuration for the batch job.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = client.batches.create_embeddings(
    model="text-embedding-004",
    src="files/my_embedding_input",
)
print(batch_job.state)
delete(*, name, config=None)

Deletes a batch job.

Return type:

DeleteResourceJob

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the client.

Returns:

A DeleteResourceJob object that shows the status of the deletion.

Usage:

client.batches.delete(name='123456789')
get(*, name, config=None)

Gets a batch job.

Return type:

BatchJob

Parameters:

name (str) –

A fully-qualified BatchJob resource name or ID. Example: “projects/…/locations/…/batchPredictionJobs/456” or “456”

when project and location are initialized in the Vertex AI client. Or “batches/abc” using the Gemini Developer AI client.

Returns:

A BatchJob object that contains details about the batch job.

Usage:

batch_job = client.batches.get(name='123456789')
print(f"Batch job: {batch_job.name}, state {batch_job.state}")
list(*, config=None)

Lists batch jobs.

Return type:

Pager[BatchJob]

Parameters:

config (ListBatchJobsConfig) – Optional configuration for the list request.

Returns:

A Pager object that contains one page of batch jobs. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

genai.caches module

class genai.caches.AsyncCaches(api_client_)

Bases: BaseModule

async create(*, model, config=None)

Creates a cached contents resource.

Usage:

contents = ... // Initialize the content to cache.
response = await client.aio.caches.create(
    model= ... // The publisher model id
    contents=contents,
    config={
        'display_name': 'test cache',
        'system_instruction': 'What is the sum of the two pdfs?',
        'ttl': '86400s',
    },
)
Return type:

CachedContent

async delete(*, name, config=None)

Deletes cached content.

Usage:

await client.aio.caches.delete(name= ... ) // The server-generated
resource name.
Return type:

DeleteCachedContentResponse

async get(*, name, config=None)

Gets cached content configurations.

await client.aio.caches.get(name= ... ) // The server-generated resource
name.
Return type:

CachedContent

async list(*, config=None)

Lists cached contents asynchronously.

Return type:

AsyncPager[CachedContent]

Parameters:

config (ListCachedContentsConfig) – Optional configuration for the list request.

Returns:

A Pager object that contains one page of cached contents. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

async update(*, name, config=None)

Updates cached content configurations.

response = await client.aio.caches.update(
    name= ... // The server-generated resource name.
    config={
        'ttl': '7600s',
    },
)
Return type:

CachedContent

class genai.caches.Caches(api_client_)

Bases: BaseModule

create(*, model, config=None)

Creates a cached contents resource.

Usage:

contents = ... // Initialize the content to cache.
response = client.caches.create(
    model= ... // The publisher model id
    contents=contents,
    config={
        'display_name': 'test cache',
        'system_instruction': 'What is the sum of the two pdfs?',
        'ttl': '86400s',
    },
)
Return type:

CachedContent

delete(*, name, config=None)

Deletes cached content.

Usage:

client.caches.delete(name= ... ) // The server-generated resource name.
Return type:

DeleteCachedContentResponse

get(*, name, config=None)

Gets cached content configurations.

client.caches.get(name= ... ) // The server-generated resource name.
Return type:

CachedContent

list(*, config=None)

Lists cached contents.

Return type:

Pager[CachedContent]

Parameters:

config (ListCachedContentsConfig) – Optional configuration for the list request.

Returns:

A Pager object that contains one page of cached contents. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

update(*, name, config=None)

Updates cached content configurations.

response = client.caches.update(
    name= ... // The server-generated resource name.
    config={
        'ttl': '7600s',
    },
)
Return type:

CachedContent

genai.chats module

class genai.chats.AsyncChat(*, modules, model, config=None, history)

Bases: _BaseChat

Async chat session.

async send_message(message, config=None)

Sends the conversation history with the additional message and returns model’s response.

Return type:

GenerateContentResponse

Parameters:
  • message – The message to send to the model.

  • config – Optional config to override the default Chat config for this request.

Returns:

The model’s response.

Usage:

chat = client.aio.chats.create(model='gemini-2.0-flash')
response = await chat.send_message('tell me a story')
async send_message_stream(message, config=None)

Sends the conversation history with the additional message and yields the model’s response in chunks.

Return type:

AsyncIterator[GenerateContentResponse]

Parameters:
  • message – The message to send to the model.

  • config – Optional config to override the default Chat config for this request.

Yields:

The model’s response in chunks.

Usage:

chat = client.aio.chats.create(model='gemini-2.0-flash')
async for chunk in await chat.send_message_stream('tell me a story'):
  print(chunk.text)
class genai.chats.AsyncChats(modules)

Bases: object

A util class to create async chat sessions.

create(*, model, config=None, history=None)

Creates a new chat session.

Return type:

AsyncChat

Parameters:
  • model – The model to use for the chat.

  • config – The configuration to use for the generate content request.

  • history – The history to use for the chat.

Returns:

A new chat session.

class genai.chats.Chat(*, modules, model, config=None, history)

Bases: _BaseChat

Chat session.

send_message(message, config=None)

Sends the conversation history with the additional message and returns the model’s response.

Return type:

GenerateContentResponse

Parameters:
  • message – The message to send to the model.

  • config – Optional config to override the default Chat config for this request.

Returns:

The model’s response.

Usage:

chat = client.chats.create(model='gemini-2.0-flash')
response = chat.send_message('tell me a story')
send_message_stream(message, config=None)

Sends the conversation history with the additional message and yields the model’s response in chunks.

Return type:

Iterator[GenerateContentResponse]

Parameters:
  • message – The message to send to the model.

  • config – Optional config to override the default Chat config for this request.

Yields:

The model’s response in chunks.

Usage:

chat = client.chats.create(model='gemini-2.0-flash')
for chunk in chat.send_message_stream('tell me a story'):
  print(chunk.text)
class genai.chats.Chats(modules)

Bases: object

A util class to create chat sessions.

create(*, model, config=None, history=None)

Creates a new chat session.

Return type:

Chat

Parameters:
  • model – The model to use for the chat.

  • config – The configuration to use for the generate content request.

  • history – The history to use for the chat.

Returns:

A new chat session.

genai.files module

class genai.files.AsyncFiles(api_client_)

Bases: BaseModule

async delete(*, name, config=None)

Deletes a remotely stored file.

Return type:

DeleteFileResponse

Parameters:
  • name (str) – The name identifier for the file to delete.

  • config (DeleteFileConfig) – Optional, configuration for the delete method.

Returns:

The response for the delete method

Return type:

DeleteFileResponse

Usage:

await client.aio.files.delete(name='files/...')
async download(*, file, config=None)

Downloads a file’s data from the file service.

The Vertex-AI implementation of the API foes not include the file service.

Files created by upload can’t be downloaded. You can tell which files are downloadable by checking the download_uri property.

Return type:

bytes

Parameters:
  • File (str) – A file name, uri, or file object. Identifying which file to download.

  • config (DownloadFileConfigOrDict) – Optional, configuration for the get method.

Returns:

The file data as bytes.

Return type:

File

Usage:

for file client.files.list():
  if file.download_uri is not None:
    break
else:
  raise ValueError('No files found with a `download_uri`.')
data = client.files.download(file=file)
# data = client.files.download(file=file.name)
# data = client.files.download(file=file.uri)
async get(*, name, config=None)

Retrieves the file information from the service.

Return type:

File

Parameters:
  • name (str) – The name identifier for the file to retrieve.

  • config (GetFileConfig) – Optional, configuration for the get method.

Returns:

The file information.

Return type:

File

Usage:

file = await client.aio.files.get(name='files/...')
print(file.uri)
async list(*, config=None)

Lists all files from the service asynchronously.

Return type:

AsyncPager[File]

Parameters:

config (ListFilesConfig) – Optional, configuration for the list method.

Returns:

A Pager object that contains one page of files. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

async for file in await client.aio.files.list(config={'page_size': 10}):
  print(file.name)
async register_files(*, auth, uris, config=None)

Registers gcs files with the file service.

Return type:

RegisterFilesResponse

async upload(*, file, config=None)

Calls the API to upload a file asynchronously using a supported file service.

Return type:

File

Parameters:
  • file – A path to the file or an IOBase object to be uploaded. If it’s an IOBase object, it must be opened in blocking (the default) mode and binary mode. In other words, do not use non-blocking mode or text mode. The given stream must be seekable, that is, it must be able to call seek() on ‘path’.

  • config – Optional parameters to set diplay_name, mime_type, and name.

class genai.files.Files(api_client_)

Bases: BaseModule

delete(*, name, config=None)

Deletes a remotely stored file.

Return type:

DeleteFileResponse

Parameters:
  • name (str) – The name identifier for the file to delete.

  • config (DeleteFileConfig) – Optional, configuration for the delete method.

Returns:

The response for the delete method

Return type:

DeleteFileResponse

Usage:

client.files.delete(name='files/...')
download(*, file, config=None)

Downloads a file’s data from storage.

Files created by upload can’t be downloaded. You can tell which files are downloadable by checking the source or download_uri property.

Note: This method returns the data as bytes. For Video and GeneratedVideo objects there is an additional side effect, that it also sets the video_bytes property on the Video object.

Return type:

bytes

Parameters:
  • file (str) – A file name, uri, or file object. Identifying which file to download.

  • config (DownloadFileConfigOrDict) – Optional, configuration for the get method.

Returns:

The file data as bytes.

Return type:

File

Usage:

for file client.files.list():
  if file.download_uri is not None:
    break
else:
  raise ValueError('No files found with a `download_uri`.')
data = client.files.download(file=file)
# data = client.files.download(file=file.name)
# data = client.files.download(file=file.download_uri)

video = types.Video(uri=file.uri)
video_bytes = client.files.download(file=video)
video.video_bytes
get(*, name, config=None)

Retrieves the file information from the service.

Return type:

File

Parameters:
  • name (str) – The name identifier for the file to retrieve.

  • config (GetFileConfig) – Optional, configuration for the get method.

Returns:

The file information.

Return type:

File

Usage:

file = client.files.get(name='files/...')
print(file.uri)
list(*, config=None)

Lists all files from the service.

Return type:

Pager[File]

Parameters:

config (ListFilesConfig) – Optional, configuration for the list method.

Returns:

A Pager object that contains one page of files. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

for file in client.files.list(config={'page_size': 10}):
  print(file.name)
register_files(*, auth, uris, config=None)

Registers gcs files with the file service.

Return type:

RegisterFilesResponse

upload(*, file, config=None)

Calls the API to upload a file using a supported file service.

Return type:

File

Parameters:
  • file – A path to the file or an IOBase object to be uploaded. If it’s an IOBase object, it must be opened in blocking (the default) mode and binary mode. In other words, do not use non-blocking mode or text mode. The given stream must be seekable, that is, it must be able to call seek() on ‘path’.

  • config – Optional parameters to set diplay_name, mime_type, and name.

genai.live module

[Preview] Live API client.

class genai.live.AsyncLive(api_client)

Bases: BaseModule

[Preview] AsyncLive.

connect(*, model, config=None)

[Preview] Connect to the live server.

Note: the live API is currently in preview.

Usage:

client = genai.Client(api_key=API_KEY)
config = {}
async with client.aio.live.connect(model='...', config=config) as session:
  await session.send_client_content(
    turns=types.Content(
      role='user',
      parts=[types.Part(text='hello!')]
    ),
    turn_complete=True
  )
  async for message in session.receive():
    print(message)
Return type:

AsyncIterator[AsyncSession]

Parameters:
  • model – The model to use for the live session.

  • config – The configuration for the live session.

  • **kwargs – additional keyword arguments.

Yields:

An AsyncSession object.

property music: AsyncLiveMusic
class genai.live.AsyncSession(api_client, websocket, session_id=None)

Bases: object

[Preview] AsyncSession.

async close()
Return type:

None

async receive()

Receive model responses from the server.

The method will yield the model responses from the server. The returned responses will represent a complete model turn. When the returned message is function call, user must call send with the function response to continue the turn.

Return type:

AsyncIterator[LiveServerMessage]

Yields:

The model responses from the server.

Example usage:

client = genai.Client(api_key=API_KEY)

async with client.aio.live.connect(model='...') as session:
  await session.send(input='Hello world!', end_of_turn=True)
  async for message in session.receive():
    print(message)
async send(*, input=None, end_of_turn=False)

[Deprecated] Send input to the model.

> Warning: This method is deprecated and will be removed in a future version (not before Q3 2025). Please use one of the more specific methods: send_client_content, send_realtime_input, or send_tool_response instead.

The method will send the input request to the server.

Return type:

None

Parameters:
  • input – The input request to the model.

  • end_of_turn – Whether the input is the last message in a turn.

Example usage:

client = genai.Client(api_key=API_KEY)

async with client.aio.live.connect(model='...') as session:
  await session.send(input='Hello world!', end_of_turn=True)
  async for message in session.receive():
    print(message)
async send_client_content(*, turns=None, turn_complete=True)

Send non-realtime, turn based content to the model.

There are two ways to send messages to the live API: send_client_content and send_realtime_input.

send_client_content messages are added to the model context in order. Having a conversation using send_client_content messages is roughly equivalent to using the Chat.send_message_stream method, except that the state of the chat history is stored on the API server.

Because of send_client_content’s order guarantee, the model cannot respond as quickly to send_client_content messages as to send_realtime_input messages. This makes the biggest difference when sending objects that have significant preprocessing time (typically images).

The send_client_content message sends a list of Content objects, which has more options than the media:Blob sent by send_realtime_input.

The main use-cases for send_client_content over send_realtime_input are:

  • Prefilling a conversation context (including sending anything that can’t be represented as a realtime message), before starting a realtime conversation.

  • Conducting a non-realtime conversation, similar to client.chat, using the live api.

Caution: Interleaving send_client_content and send_realtime_input

in the same conversation is not recommended and can lead to unexpected results.

Parameters:
  • turns – A Content object or list of Content objects (or equivalent dicts).

  • turn_complete – if true (the default) the model will reply immediately. If false, the model will wait for you to send additional client_content, and will not return until you send turn_complete=True.

Example:

import google.genai
from google.genai import types
import os

if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
  MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
else:
  MODEL_NAME = 'gemini-live-2.5-flash-preview';

client = genai.Client()
async with client.aio.live.connect(
    model=MODEL_NAME,
    config={"response_modalities": ["TEXT"]}
) as session:
  await session.send_client_content(
      turns=types.Content(
          role='user',
          parts=[types.Part(text="Hello world!")]))
  async for msg in session.receive():
    if msg.text:
      print(msg.text)
Return type:

None

async send_realtime_input(*, media=None, audio=None, audio_stream_end=None, video=None, text=None, activity_start=None, activity_end=None)

Send realtime input to the model, only send one argument per call.

Use send_realtime_input for realtime audio chunks and video frames(images).

With send_realtime_input the api will respond to audio automatically based on voice activity detection (VAD).

send_realtime_input is optimized for responsivness at the expense of deterministic ordering. Audio and video tokens are added to the context when they become available.

Return type:

None

Parameters:

media – A Blob-like object, the realtime media to send.

Example:

from pathlib import Path

from google import genai
from google.genai import types

import PIL.Image

import os

if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
  MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
else:
  MODEL_NAME = 'gemini-live-2.5-flash-preview';


client = genai.Client()

async with client.aio.live.connect(
    model=MODEL_NAME,
    config={"response_modalities": ["TEXT"]},
) as session:
  await session.send_realtime_input(
      media=PIL.Image.open('image.jpg'))

  audio_bytes = Path('audio.pcm').read_bytes()
  await session.send_realtime_input(
      media=types.Blob(data=audio_bytes, mime_type='audio/pcm;rate=16000'))

  async for msg in session.receive():
    if msg.text is not None:
      print(f'{msg.text}')
async send_tool_response(*, function_responses)

Send a tool response to the session.

Use send_tool_response to reply to LiveServerToolCall messages from the server.

To set the available tools, use the config.tools argument when you connect to the session (client.live.connect).

Return type:

None

Parameters:

function_responses – A FunctionResponse-like object or list of FunctionResponse-like objects.

Example:

from google import genai
from google.genai import types

import os

if os.environ.get('GOOGLE_GENAI_USE_VERTEXAI'):
  MODEL_NAME = 'gemini-2.0-flash-live-preview-04-09'
else:
  MODEL_NAME = 'gemini-live-2.5-flash-preview';

client = genai.Client()

tools = [{'function_declarations': [{'name': 'turn_on_the_lights'}]}]
config = {
    "tools": tools,
    "response_modalities": ['TEXT']
}

async with client.aio.live.connect(
    model='models/gemini-live-2.5-flash-preview',
    config=config
) as session:
  prompt = "Turn on the lights please"
  await session.send_client_content(
      turns={"parts": [{'text': prompt}]}
  )

  async for chunk in session.receive():
      if chunk.server_content:
        if chunk.text is not None:
          print(chunk.text)
      elif chunk.tool_call:
        print(chunk.tool_call)
        print('_'*80)
        function_response=types.FunctionResponse(
                name='turn_on_the_lights',
                response={'result': 'ok'},
                id=chunk.tool_call.function_calls[0].id,
            )
        print(function_response)
        await session.send_tool_response(
            function_responses=function_response
        )

        print('_'*80)
async start_stream(*, stream, mime_type)

[Deprecated] Start a live session from a data stream.

> Warning: This method is deprecated and will be removed in a future version (not before Q2 2025). Please use one of the more specific methods: send_client_content, send_realtime_input, or send_tool_response instead.

The interaction terminates when the input stream is complete. This method will start two async tasks. One task will be used to send the input stream to the model and the other task will be used to receive the responses from the model.

Return type:

AsyncIterator[LiveServerMessage]

Parameters:
  • stream – An iterator that yields the model response.

  • mime_type – The MIME type of the data in the stream.

Yields:

The audio bytes received from the model and server response messages.

Example usage:

client = genai.Client(api_key=API_KEY)
config = {'response_modalities': ['AUDIO']}
async def audio_stream():
  stream = read_audio()
  for data in stream:
    yield data
async with client.aio.live.connect(model='...', config=config) as session:
  for audio in session.start_stream(stream = audio_stream(),
  mime_type = 'audio/pcm'):
    play_audio_chunk(audio.data)

genai.models module

class genai.models.AsyncModels(api_client_)

Bases: BaseModule

async compute_tokens(*, model, contents, config=None)

Given a list of contents, returns a corresponding TokensInfo containing the

list of tokens and list of token ids.

Return type:

ComputeTokensResponse

Parameters:
  • model (str) – The model to use.

  • contents (list[shared.Content]) – The content to compute tokens for.

Usage:

response = await client.aio.models.compute_tokens(
    model='gemini-2.0-flash',
    contents='What is your name?',
)
print(response)
# tokens_info=[TokensInfo(role='user', token_ids=['1841', ...],
# tokens=[b'What', b' is', b' your', b' name', b'?'])]
async count_tokens(*, model, contents, config=None)

Counts the number of tokens in the given content.

Multimodal input is supported for Gemini models.

Return type:

CountTokensResponse

Parameters:
  • model (str) – The model to use for counting tokens.

  • contents (list[types.Content]) – The content to count tokens for.

  • config (CountTokensConfig) – The configuration for counting tokens.

Usage:

response = await client.aio.models.count_tokens(
    model='gemini-2.0-flash',
    contents='What is your name?',
)
print(response)
# total_tokens=5 cached_content_token_count=None
async delete(*, model, config=None)
Return type:

DeleteModelResponse

async edit_image(*, model, prompt, reference_images, config=None)

Edits an image based on a text description and configuration.

Return type:

EditImageResponse

Parameters:
  • model (str) – The model to use.

  • prompt (str) – A text description of the edit to apply to the image. reference_images (list[Union[RawReferenceImage, MaskReferenceImage, ControlReferenceImage, StyleReferenceImage, SubjectReferenceImage]): The reference images for editing.

  • config (EditImageConfig) – Configuration for editing.

Usage:

from google.genai.types import RawReferenceImage, MaskReferenceImage

raw_ref_image = RawReferenceImage(
  reference_id=1,
  reference_image=types.Image.from_file(IMAGE_FILE_PATH),
)

mask_ref_image = MaskReferenceImage(
  reference_id=2,
  config=types.MaskReferenceConfig(
      mask_mode='MASK_MODE_FOREGROUND',
      mask_dilation=0.06,
  ),
)
response = await client.aio.models.edit_image(
  model='imagen-3.0-capability-001',
  prompt='man with dog',
  reference_images=[raw_ref_image, mask_ref_image],
  config=types.EditImageConfig(
      edit_mode= "EDIT_MODE_INPAINT_INSERTION",
      number_of_images= 1,
      include_rai_reason= True,
  )
)
response.generated_images[0].image.show()
# Shows a man with a dog instead of a cat.
async embed_content(*, model, contents, config=None)

Calculates embeddings for the given contents. Only text is supported.

Return type:

EmbedContentResponse

Parameters:
  • model (str) – The model to use.

  • contents (list[Content]) – The contents to embed.

  • config (EmbedContentConfig) – Optional configuration for embeddings.

Usage:

embeddings = await client.aio.models.embed_content(
    model= 'text-embedding-004',
    contents=[
        'What is your name?',
        'What is your favorite color?',
    ],
    config={
        'output_dimensionality': 64
    },
)
async generate_content(*, model, contents, config=None)

Makes an API request to generate content using a model.

Some models support multimodal input and output.

Built-in MCP support is an experimental feature.

Usage:

from google.genai import types
from google import genai

client = genai.Client(
    vertexai=True, project='my-project-id', location='us-central1'
)

response = await client.aio.models.generate_content(
    model='gemini-2.0-flash',
    contents='User input: I like bagels. Answer:',
    config=types.GenerateContentConfig(
        system_instruction=
          [
            'You are a helpful language translator.',
            'Your mission is to translate text in English to French.'
          ]
    ),
)
print(response.text)
# J'aime les bagels.
Return type:

GenerateContentResponse

async generate_content_stream(*, model, contents, config=None)

Makes an API request to generate content using a model and yields the model’s response in chunks.

For the model parameter, supported formats for Vertex AI API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The full resource name starts with ‘projects/’, for example:

‘projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash’

  • The partial resource name with ‘publishers/’, for example: ‘publishers/google/models/gemini-2.0-flash’ or

  • / separated publisher and model name, for example: ‘google/gemini-2.0-flash’

For the model parameter, supported formats for Gemini API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The model name starts with ‘models/’, for example:

‘models/gemini-2.0-flash’

  • For tuned models, the model name starts with ‘tunedModels/’, for example: ‘tunedModels/1234567890123456789’

Some models support multimodal input and output.

Built-in MCP support is an experimental feature.

Usage:

from google.genai import types
from google import genai

client = genai.Client(
    vertexai=True, project='my-project-id', location='us-central1'
)

async for chunk in await client.aio.models.generate_content_stream(
  model='gemini-2.0-flash',
  contents='''What is a good name for a flower shop that specializes in
    selling bouquets of dried flowers?'''
):
  print(chunk.text)
# **Elegant & Classic:**
# * The Dried Bloom
# * Everlasting Florals
# * Timeless Petals

async for chunk in await client.aio.models.generate_content_stream(
  model='gemini-2.0-flash',
  contents=[
    types.Part.from_text('What is shown in this image?'),
    types.Part.from_uri('gs://generativeai-downloads/images/scones.jpg',
    'image/jpeg')
  ]
):
  print(chunk.text)
# The image shows a flat lay arrangement of freshly baked blueberry
# scones.
Return type:

AsyncIterator[GenerateContentResponse]

async generate_images(*, model, prompt, config=None)

Generates images based on a text description and configuration.

Return type:

GenerateImagesResponse

Parameters:
  • model (str) – The model to use.

  • prompt (str) – A text description of the images to generate.

  • config (GenerateImagesConfig) – Configuration for generation.

Usage:

response = await client.aio.models.generate_images(
  model='imagen-3.0-generate-002',
  prompt='Man with a dog',
  config=types.GenerateImagesConfig(
      number_of_images= 1,
      include_rai_reason= True,
  )
)
response.generated_images[0].image.show()
# Shows a man with a dog.
async generate_videos(*, model, prompt=None, image=None, video=None, source=None, config=None)

Generates videos based on an input (text, image, or video) and configuration.

The following use cases are supported: 1. Text to video generation. 2a. Image to video generation (additional text prompt is optional). 2b. Image to video generation with frame interpolation (specify last_frame in config). 3. Video extension (additional text prompt is optional)

Return type:

GenerateVideosOperation

Parameters:
  • model – The model to use.

  • prompt – The text prompt for generating the videos. Optional for image to video and video extension use cases. This argument is deprecated, please use source instead.

  • image – The input image for generating the videos. Optional if prompt is provided. This argument is deprecated, please use source instead.

  • video – The input video for video extension use cases. Optional if prompt or image is provided. This argument is deprecated, please use source instead.

  • source – The input source for generating the videos (prompt, image, and/or video)

  • config – Configuration for generation.

Usage:

``` operation = client.models.generate_videos(

model=”veo-2.0-generate-001”, source=types.GenerateVideosSource(

prompt=”A neon hologram of a cat driving at top speed”,

),

) while not operation.done:

time.sleep(10) operation = client.operations.get(operation)

operation.result.generated_videos[0].video.uri ```

async get(*, model, config=None)
Return type:

Model

async list(*, config=None)

Makes an API request to list the available models.

If query_base is set to True in the config or not set (default), the API will return all available base models. If set to False, it will return all tuned models.

Return type:

AsyncPager[Model]

Parameters:

config (ListModelsConfigOrDict) – Configuration for retrieving models.

Usage:

response = await client.aio.models.list(config={'page_size': 5})
print(response.page)
# [Model(name='projects/./locations/./models/123', display_name='my_model'

response = await client.aio.models.list(
    config={'page_size': 5, 'query_base': True}
  )
print(response.page)
# [Model(name='publishers/google/models/gemini-2.0-flash-exp' ...
async recontext_image(*, model, source, config=None)

Recontextualizes an image.

Return type:

RecontextImageResponse

There are two types of recontextualization currently supported: 1) Imagen Product Recontext - Generate images of products in new scenes

and contexts.

  1. Virtual Try-On: Generate images of persons modeling fashion products.

Parameters:
  • model (str) – The model to use.

  • source (RecontextImageSource) – An object containing the source inputs (prompt, person_image, product_images) for image recontext. prompt is optional for product recontext and disallowed for virtual try-on. person_image is required for virtual try-on, disallowed for product recontext. product_images is required for both product recontext and virtual try-on. Only one product image is supported for virtual try-on, and up to 3 product images (different angles of the same product) are supported for product recontext.

  • config (RecontextImageConfig) – Configuration for recontextualization.

Usage:

``` product_recontext_response = client.models.recontext_image(

model=”imagen-product-recontext-preview-06-30”, source=types.RecontextImageSource(

prompt=”In a modern kitchen setting.”, product_images=[types.ProductImage.from_file(IMAGE_FILE_PATH)],

), config=types.RecontextImageConfig(

number_of_images=1,

),

) image = product_recontext_response.generated_images[0].image

virtual_try_on_response = client.models.recontext_image(

model=”virtual-try-on-001”, source=types.RecontextImageSource(

person_image=types.Image.from_file(IMAGE1_FILE_PATH), product_images=[types.ProductImage.from_file(IMAGE2_FILE_PATH)],

), config=types.RecontextImageConfig(

number_of_images=1,

),

) image = virtual_try_on_response.generated_images[0].image ```

async segment_image(*, model, source, config=None)

Segments an image, creating a mask of a specified area.

Return type:

SegmentImageResponse

Parameters:
  • model (str) – The model to use.

  • source (SegmentImageSource) – An object containing the source inputs (prompt, image, scribble_image) for image segmentation. The prompt is required for prompt mode and semantic mode, disallowed for other modes. scribble_image is required for the interactive mode, disallowed for other modes.

  • config (SegmentImageConfig) – Configuration for segmentation.

Usage:

``` response = client.models.segment_image(

model=”image-segmentation-001”, source=types.SegmentImageSource(

image=types.Image.from_file(IMAGE_FILE_PATH),

), config=types.SegmentImageConfig(

mode=types.SegmentMode.foreground,

),

)

mask_image = response.generated_masks[0].mask ```

async update(*, model, config=None)
Return type:

Model

async upscale_image(*, model, image, upscale_factor, config=None)

Makes an API request to upscale a provided image.

Return type:

UpscaleImageResponse

Parameters:
  • model (str) – The model to use.

  • image (Image) – The input image for upscaling.

  • upscale_factor (str) – The factor to upscale the image (x2 or x4).

  • config (UpscaleImageConfig) – Configuration for upscaling.

Usage:

from google.genai.types import Image

IMAGE_FILE_PATH="my-image.png"
response = await client.aio.models.upscale_image(
    model='imagen-3.0-generate-001',
    image=types.Image.from_file(IMAGE_FILE_PATH),
    upscale_factor='x2',
)
response.generated_images[0].image.show()
# Opens my-image.png which is upscaled by a factor of 2.
class genai.models.Models(api_client_)

Bases: BaseModule

compute_tokens(*, model, contents, config=None)

Given a list of contents, returns a corresponding TokensInfo containing the

list of tokens and list of token ids.

This method is not supported by the Gemini Developer API.

Return type:

ComputeTokensResponse

Parameters:
  • model (str) – The model to use.

  • contents (list[shared.Content]) – The content to compute tokens for.

Usage:

response = client.models.compute_tokens(
    model='gemini-2.0-flash',
    contents='What is your name?',
)
print(response)
# tokens_info=[TokensInfo(role='user', token_ids=['1841', ...],
# tokens=[b'What', b' is', b' your', b' name', b'?'])]
count_tokens(*, model, contents, config=None)

Counts the number of tokens in the given content.

Multimodal input is supported for Gemini models.

Return type:

CountTokensResponse

Parameters:
  • model (str) – The model to use for counting tokens.

  • contents (list[types.Content]) – The content to count tokens for.

  • config (CountTokensConfig) – The configuration for counting tokens.

Usage:

response = client.models.count_tokens(
    model='gemini-2.0-flash',
    contents='What is your name?',
)
print(response)
# total_tokens=5 cached_content_token_count=None
delete(*, model, config=None)
Return type:

DeleteModelResponse

edit_image(*, model, prompt, reference_images, config=None)

Edits an image based on a text description and configuration.

Return type:

EditImageResponse

Parameters:
  • model (str) – The model to use.

  • prompt (str) – A text description of the edit to apply to the image. reference_images (list[Union[RawReferenceImage, MaskReferenceImage, ControlReferenceImage, StyleReferenceImage, SubjectReferenceImage]): The reference images for editing.

  • config (EditImageConfig) – Configuration for editing.

Usage:

from google.genai.types import RawReferenceImage, MaskReferenceImage

raw_ref_image = RawReferenceImage(
  reference_id=1,
  reference_image=types.Image.from_file(IMAGE_FILE_PATH),
)

mask_ref_image = MaskReferenceImage(
  reference_id=2,
  config=types.MaskReferenceConfig(
      mask_mode='MASK_MODE_FOREGROUND',
      mask_dilation=0.06,
  ),
)
response = client.models.edit_image(
  model='imagen-3.0-capability-001',
  prompt='man with dog',
  reference_images=[raw_ref_image, mask_ref_image],
  config=types.EditImageConfig(
      edit_mode= "EDIT_MODE_INPAINT_INSERTION",
      number_of_images= 1,
      include_rai_reason= True,
  )
)
response.generated_images[0].image.show()
# Shows a man with a dog instead of a cat.
embed_content(*, model, contents, config=None)

Calculates embeddings for the given contents. Only text is supported.

Return type:

EmbedContentResponse

Parameters:
  • model (str) – The model to use.

  • contents (list[Content]) – The contents to embed.

  • config (EmbedContentConfig) – Optional configuration for embeddings.

Usage:

embeddings = client.models.embed_content(
    model= 'text-embedding-004',
    contents=[
        'What is your name?',
        'What is your favorite color?',
    ],
    config={
        'output_dimensionality': 64
    },
)
generate_content(*, model, contents, config=None)

Makes an API request to generate content using a model.

For the model parameter, supported formats for Vertex AI API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The full resource name starts with ‘projects/’, for example:

‘projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash’

  • The partial resource name with ‘publishers/’, for example: ‘publishers/google/models/gemini-2.0-flash’ or

  • / separated publisher and model name, for example: ‘google/gemini-2.0-flash’

For the model parameter, supported formats for Gemini API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The model name starts with ‘models/’, for example:

‘models/gemini-2.0-flash’

  • For tuned models, the model name starts with ‘tunedModels/’, for example: ‘tunedModels/1234567890123456789’

Some models support multimodal input and output.

Built-in MCP support is an experimental feature.

Usage:

from google.genai import types
from google import genai

client = genai.Client(
    vertexai=True, project='my-project-id', location='us-central1'
)

response = client.models.generate_content(
  model='gemini-2.0-flash',
  contents='''What is a good name for a flower shop that specializes in
    selling bouquets of dried flowers?'''
)
print(response.text)
# **Elegant & Classic:**
# * The Dried Bloom
# * Everlasting Florals
# * Timeless Petals

response = client.models.generate_content(
  model='gemini-2.0-flash',
  contents=[
    types.Part.from_text(text='What is shown in this image?'),
    types.Part.from_uri(file_uri='gs://generativeai-downloads/images/scones.jpg',
    mime_type='image/jpeg')
  ]
)
print(response.text)
# The image shows a flat lay arrangement of freshly baked blueberry
# scones.
Return type:

GenerateContentResponse

generate_content_stream(*, model, contents, config=None)

Makes an API request to generate content using a model and yields the model’s response in chunks.

For the model parameter, supported formats for Vertex AI API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The full resource name starts with ‘projects/’, for example:

‘projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash’

  • The partial resource name with ‘publishers/’, for example: ‘publishers/google/models/gemini-2.0-flash’ or

  • / separated publisher and model name, for example: ‘google/gemini-2.0-flash’

For the model parameter, supported formats for Gemini API include: - The Gemini model ID, for example: ‘gemini-2.0-flash’ - The model name starts with ‘models/’, for example:

‘models/gemini-2.0-flash’

  • For tuned models, the model name starts with ‘tunedModels/’, for example: ‘tunedModels/1234567890123456789’

Some models support multimodal input and output.

Built-in MCP support is an experimental feature.

Usage:

from google.genai import types
from google import genai

client = genai.Client(
    vertexai=True, project='my-project-id', location='us-central1'
)

for chunk in client.models.generate_content_stream(
  model='gemini-2.0-flash',
  contents='''What is a good name for a flower shop that specializes in
    selling bouquets of dried flowers?'''
):
  print(chunk.text)
# **Elegant & Classic:**
# * The Dried Bloom
# * Everlasting Florals
# * Timeless Petals

for chunk in client.models.generate_content_stream(
  model='gemini-2.0-flash',
  contents=[
    types.Part.from_text('What is shown in this image?'),
    types.Part.from_uri('gs://generativeai-downloads/images/scones.jpg',
    'image/jpeg')
  ]
):
  print(chunk.text)
# The image shows a flat lay arrangement of freshly baked blueberry
# scones.
Return type:

Iterator[GenerateContentResponse]

generate_images(*, model, prompt, config=None)

Generates images based on a text description and configuration.

Return type:

GenerateImagesResponse

Parameters:
  • model (str) – The model to use.

  • prompt (str) – A text description of the images to generate.

  • config (GenerateImagesConfig) – Configuration for generation.

Usage:

response = client.models.generate_images(
  model='imagen-3.0-generate-002',
  prompt='Man with a dog',
  config=types.GenerateImagesConfig(
      number_of_images= 1,
      include_rai_reason= True,
  )
)
response.generated_images[0].image.show()
# Shows a man with a dog.
generate_videos(*, model, prompt=None, image=None, video=None, source=None, config=None)

Generates videos based on an input (text, image, or video) and configuration.

The following use cases are supported: 1. Text to video generation. 2a. Image to video generation (additional text prompt is optional). 2b. Image to video generation with frame interpolation (specify last_frame in config). 3. Video extension (additional text prompt is optional)

Return type:

GenerateVideosOperation

Parameters:
  • model – The model to use.

  • prompt – The text prompt for generating the videos. Optional for image to video and video extension use cases. This argument is deprecated, please use source instead.

  • image – The input image for generating the videos. Optional if prompt is provided. This argument is deprecated, please use source instead.

  • video – The input video for video extension use cases. Optional if prompt or image is provided. This argument is deprecated, please use source instead.

  • source – The input source for generating the videos (prompt, image, and/or video)

  • config – Configuration for generation.

Usage:

``` operation = client.models.generate_videos(

model=”veo-2.0-generate-001”, source=types.GenerateVideosSource(

prompt=”A neon hologram of a cat driving at top speed”,

),

) while not operation.done:

time.sleep(10) operation = client.operations.get(operation)

operation.result.generated_videos[0].video.uri ```

get(*, model, config=None)
Return type:

Model

list(*, config=None)

Makes an API request to list the available models.

If query_base is set to True in the config or not set (default), the API will return all available base models. If set to False, it will return all tuned models.

Return type:

Pager[Model]

Parameters:

config (ListModelsConfigOrDict) – Configuration for retrieving models.

Usage:

response=client.models.list(config={'page_size': 5})
print(response.page)
# [Model(name='projects/./locations/./models/123', display_name='my_model'

response=client.models.list(config={'page_size': 5, 'query_base': True})
print(response.page)
# [Model(name='publishers/google/models/gemini-2.0-flash-exp' ...
recontext_image(*, model, source, config=None)

Recontextualizes an image.

Return type:

RecontextImageResponse

There are two types of recontextualization currently supported: 1) Imagen Product Recontext - Generate images of products in new scenes

and contexts.

  1. Virtual Try-On: Generate images of persons modeling fashion products.

Parameters:
  • model (str) – The model to use.

  • source (RecontextImageSource) – An object containing the source inputs (prompt, person_image, product_images) for image recontext. prompt is optional for product recontext and disallowed for virtual try-on. person_image is required for virtual try-on, disallowed for product recontext. product_images is required for both product recontext and virtual try-on. Only one product image is supported for virtual try-on, and up to 3 product images (different angles of the same product) are supported for product recontext.

  • config (RecontextImageConfig) – Configuration for recontextualization.

Usage:

``` product_recontext_response = client.models.recontext_image(

model=”imagen-product-recontext-preview-06-30”, source=types.RecontextImageSource(

prompt=”In a modern kitchen setting.”, product_images=[types.ProductImage.from_file(IMAGE_FILE_PATH)],

), config=types.RecontextImageConfig(

number_of_images=1,

),

) image = product_recontext_response.generated_images[0].image

virtual_try_on_response = client.models.recontext_image(

model=”virtual-try-on-001”, source=types.RecontextImageSource(

person_image=types.Image.from_file(IMAGE1_FILE_PATH), product_images=[types.ProductImage.from_file(IMAGE2_FILE_PATH)],

), config=types.RecontextImageConfig(

number_of_images=1,

),

) image = virtual_try_on_response.generated_images[0].image ```

segment_image(*, model, source, config=None)

Segments an image, creating a mask of a specified area.

Return type:

SegmentImageResponse

Parameters:
  • model (str) – The model to use.

  • source (SegmentImageSource) – An object containing the source inputs (prompt, image, scribble_image) for image segmentation. The prompt is required for prompt mode and semantic mode, disallowed for other modes. scribble_image is required for the interactive mode, disallowed for other modes.

  • config (SegmentImageConfig) – Configuration for segmentation.

Usage:

``` response = client.models.segment_image(

model=”image-segmentation-001”, source=types.SegmentImageSource(

image=types.Image.from_file(IMAGE_FILE_PATH),

),

)

mask_image = response.generated_masks[0].mask ```

update(*, model, config=None)
Return type:

Model

upscale_image(*, model, image, upscale_factor, config=None)

Makes an API request to upscale a provided image.

Return type:

UpscaleImageResponse

Parameters:
  • model (str) – The model to use.

  • image (Image) – The input image for upscaling.

  • upscale_factor (str) – The factor to upscale the image (x2 or x4).

  • config (UpscaleImageConfig) – Configuration for upscaling.

Usage:

from google.genai.types import Image

IMAGE_FILE_PATH="my-image.png"
response=client.models.upscale_image(
    model='imagen-3.0-generate-001',
    image=types.Image.from_file(IMAGE_FILE_PATH),
    upscale_factor='x2',
)
response.generated_images[0].image.show()
# Opens my-image.png which is upscaled by a factor of 2.

genai.tokens module

[Experimental] Auth Tokens API client.

class genai.tokens.AsyncTokens(api_client_)

Bases: BaseModule

[Experimental] Async Auth Tokens API client.

This class provides asynchronous methods for creating auth tokens.

create(*, config=None)

Creates an auth token asynchronously. Support in v1alpha only.

Return type:

AuthToken

Parameters:

config (CreateAuthTokenConfig) – Optional configuration for the request.

Usage:

client = genai.Client(
    api_key=API_KEY,
    http_options=types.HttpOptions(api_version='v1alpha'),
)

auth_token = await client.aio.tokens.create(
    config=types.CreateAuthTokenConfig(
        uses=10,
        live_constrained_parameters=types.LiveEphemeralParameters(
            model='gemini-live-2.5-flash-preview',
            config=types.LiveConnectConfig(
                system_instruction='You are an LLM called Gemini.'
            ),
        ),
    )
)
class genai.tokens.Tokens(api_client_)

Bases: BaseModule

[Experimental] Auth Tokens API client.

This class provides methods for creating auth tokens.

create(*, config=None)

[Experimental] Creates an auth token.

Return type:

AuthToken

Parameters:

config (CreateAuthTokenConfig) – Optional configuration for the request.

The CreateAuthTokenConfig’s live_constrained_parameters attrubite Can be used to lock the parameters of the live session so they can’t be changed client side. This behavior has two basic modes depending on whether lock_additional_fields is set:

If you do not pass lock_additional_fields the entire live_constrained_parameters is locked and can’t be changed by the token’s user.

If you set lock_additional_fields, then the non-null fields of live_constrained_parameters are locked, and any additional fields specified in lock_additional_fields.

Usage:

# Case 1: If LiveEphemeralParameters is unset, unlock LiveConnectConfig
# when using the token in Live API sessions. Each session connection can
# use a different configuration.

config = types.CreateAuthTokenConfig(
    uses=10,
    expire_time='2025-05-01T00:00:00Z',
)
auth_token = client.tokens.create(config=config)
# Case 2: If LiveEphemeralParameters is set, lock all fields in
# LiveConnectConfig when using the token in Live API sessions. For
# example, changing `output_audio_transcription` in the Live API
# connection will be ignored by the API.

auth_token = client.tokens.create(
    config=types.CreateAuthTokenConfig(
        uses=10,
        live_constrained_parameters=types.LiveEphemeralParameters(
            model='gemini-live-2.5-flash-preview',
            config=types.LiveConnectConfig(
                system_instruction='You are an LLM called Gemini.'
            ),
        ),
    )
)
# Case 3: If LiveEphemeralParameters is set and lockAdditionalFields is
# empty, lock LiveConnectConfig with set fields (e.g.
# system_instruction in this example) when using the token in Live API
# sessions.
auth_token = client.tokens.create(
    config=types.CreateAuthTokenConfig(
        uses=10,
        live_constrained_parameters=types.LiveEphemeralParameters(
            config=types.LiveConnectConfig(
                system_instruction='You are an LLM called Gemini.'
            ),
        ),
        lock_additional_fields=[],
    )
)
# Case 4: If LiveEphemeralParameters is set and lockAdditionalFields is
# set, lock LiveConnectConfig with set and additional fields (e.g.
# system_instruction, temperature in this example) when using the token
# in Live API sessions.
auth_token = client.tokens.create(
    config=types.CreateAuthTokenConfig(
        uses=10,
        live_constrained_parameters=types.LiveEphemeralParameters(
            model='gemini-live-2.5-flash-preview',
            config=types.LiveConnectConfig(
                system_instruction='You are an LLM called Gemini.'
            ),
        ),
        lock_additional_fields=['temperature'],
    )
)

genai.tunings module

class genai.tunings.AsyncTunings(api_client_)

Bases: BaseModule

async cancel(*, name, config=None)

Cancels a tuning job asynchronously.

Return type:

CancelTuningJobResponse

Parameters:

name (str) – A TuningJob resource name.

async get(*, name, config=None)
Return type:

TuningJob

async list(*, config=None)

Lists TuningJob objects asynchronously.

Return type:

AsyncPager[TuningJob]

Parameters:

config – The configuration for the list request.

Returns:

A Pager object that contains one page of tuning jobs. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

tune(*, base_model, training_dataset, config=None)
Return type:

TuningJob

class genai.tunings.Tunings(api_client_)

Bases: BaseModule

cancel(*, name, config=None)

Cancels a tuning job.

Return type:

CancelTuningJobResponse

Parameters:

name (str) – TuningJob resource name.

get(*, name, config=None)
Return type:

TuningJob

list(*, config=None)

Lists TuningJob objects.

Return type:

Pager[TuningJob]

Parameters:

config – The configuration for the list request.

Returns:

A Pager object that contains one page of tuning jobs. When iterating over the pager, it automatically fetches the next page if there are more.

Usage:

tune(*, base_model, training_dataset, config=None)
Return type:

TuningJob

genai.types module

pydantic model genai.types.ActivityEnd

Bases: BaseModel

Marks the end of user activity.

This can only be sent if automatic (i.e. server-side) activity detection is disabled.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ActivityEnd",
   "description": "Marks the end of user activity.\n\nThis can only be sent if automatic (i.e. server-side) activity detection is\ndisabled.",
   "type": "object",
   "properties": {},
   "additionalProperties": false
}

Validators:

class genai.types.ActivityEndDict

Bases: TypedDict

Marks the end of user activity.

This can only be sent if automatic (i.e. server-side) activity detection is disabled.

class genai.types.ActivityHandling(*values)

Bases: CaseInSensitiveEnum

The different ways of handling user activity.

ACTIVITY_HANDLING_UNSPECIFIED = 'ACTIVITY_HANDLING_UNSPECIFIED'

If unspecified, the default behavior is START_OF_ACTIVITY_INTERRUPTS.

NO_INTERRUPTION = 'NO_INTERRUPTION'

The model’s response will not be interrupted.

START_OF_ACTIVITY_INTERRUPTS = 'START_OF_ACTIVITY_INTERRUPTS'

If true, start of activity will interrupt the model’s response (also called “barge in”). The model’s current response will be cut-off in the moment of the interruption. This is the default behavior.

pydantic model genai.types.ActivityStart

Bases: BaseModel

Marks the start of user activity.

This can only be sent if automatic (i.e. server-side) activity detection is disabled.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ActivityStart",
   "description": "Marks the start of user activity.\n\nThis can only be sent if automatic (i.e. server-side) activity detection is\ndisabled.",
   "type": "object",
   "properties": {},
   "additionalProperties": false
}

Validators:

class genai.types.ActivityStartDict

Bases: TypedDict

Marks the start of user activity.

This can only be sent if automatic (i.e. server-side) activity detection is disabled.

class genai.types.AdapterSize(*values)

Bases: CaseInSensitiveEnum

Adapter size for tuning. This enum is not supported in Gemini API.

ADAPTER_SIZE_EIGHT = 'ADAPTER_SIZE_EIGHT'

Adapter size 8.

ADAPTER_SIZE_FOUR = 'ADAPTER_SIZE_FOUR'

Adapter size 4.

ADAPTER_SIZE_ONE = 'ADAPTER_SIZE_ONE'

Adapter size 1.

ADAPTER_SIZE_SIXTEEN = 'ADAPTER_SIZE_SIXTEEN'

Adapter size 16.

ADAPTER_SIZE_THIRTY_TWO = 'ADAPTER_SIZE_THIRTY_TWO'

Adapter size 32.

ADAPTER_SIZE_TWO = 'ADAPTER_SIZE_TWO'

Adapter size 2.

ADAPTER_SIZE_UNSPECIFIED = 'ADAPTER_SIZE_UNSPECIFIED'

Adapter size is unspecified.

pydantic model genai.types.ApiAuth

Bases: BaseModel

The generic reusable api auth config.

Deprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto) instead. This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ApiAuth",
   "description": "The generic reusable api auth config.\n\nDeprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto)\ninstead. This data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "apiKeyConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/ApiAuthApiKeyConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The API secret."
      }
   },
   "$defs": {
      "ApiAuthApiKeyConfig": {
         "additionalProperties": false,
         "description": "The API secret. This data type is not supported in Gemini API.",
         "properties": {
            "apiKeySecretVersion": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version}",
               "title": "Apikeysecretversion"
            },
            "apiKeyString": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The API key string. Either this or `api_key_secret_version` must be set.",
               "title": "Apikeystring"
            }
         },
         "title": "ApiAuthApiKeyConfig",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field api_key_config: Optional[ApiAuthApiKeyConfig] = None (alias 'apiKeyConfig')

The API secret.

Validated by:
  • _check_field_type_mismatches

pydantic model genai.types.ApiAuthApiKeyConfig

Bases: BaseModel

The API secret. This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ApiAuthApiKeyConfig",
   "description": "The API secret. This data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "apiKeySecretVersion": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version}",
         "title": "Apikeysecretversion"
      },
      "apiKeyString": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The API key string. Either this or `api_key_secret_version` must be set.",
         "title": "Apikeystring"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field api_key_secret_version: Optional[str] = None (alias 'apiKeySecretVersion')

Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version}

Validated by:
  • _check_field_type_mismatches

field api_key_string: Optional[str] = None (alias 'apiKeyString')

The API key string. Either this or api_key_secret_version must be set.

Validated by:
  • _check_field_type_mismatches

class genai.types.ApiAuthApiKeyConfigDict

Bases: TypedDict

The API secret. This data type is not supported in Gemini API.

api_key_secret_version: Optional[str]

Required. The SecretManager secret version resource name storing API key. e.g. projects/{project}/secrets/{secret}/versions/{version}

api_key_string: Optional[str]

The API key string. Either this or api_key_secret_version must be set.

class genai.types.ApiAuthDict

Bases: TypedDict

The generic reusable api auth config.

Deprecated. Please use AuthConfig (google/cloud/aiplatform/master/auth.proto) instead. This data type is not supported in Gemini API.

api_key_config: Optional[ApiAuthApiKeyConfigDict]

The API secret.

pydantic model genai.types.ApiKeyConfig

Bases: BaseModel

Config for authentication with API key.

This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "ApiKeyConfig",
   "description": "Config for authentication with API key.\n\nThis data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "apiKeySecret": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. The name of the SecretManager secret version resource storing the API key. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If both `api_key_secret` and `api_key_string` are specified, this field takes precedence over `api_key_string`. - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.",
         "title": "Apikeysecret"
      },
      "apiKeyString": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. The API key to be used in the request directly.",
         "title": "Apikeystring"
      },
      "httpElementLocation": {
         "anyOf": [
            {
               "$ref": "#/$defs/HttpElementLocation"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. The location of the API key."
      },
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. The parameter name of the API key. E.g. If the API request is \"https://example.com/act?api_key=\", \"api_key\" would be the parameter name.",
         "title": "Name"
      }
   },
   "$defs": {
      "HttpElementLocation": {
         "description": "The location of the API key. This enum is not supported in Gemini API.",
         "enum": [
            "HTTP_IN_UNSPECIFIED",
            "HTTP_IN_QUERY",
            "HTTP_IN_HEADER",
            "HTTP_IN_PATH",
            "HTTP_IN_BODY",
            "HTTP_IN_COOKIE"
         ],
         "title": "HttpElementLocation",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field api_key_secret: Optional[str] = None (alias 'apiKeySecret')

Optional. The name of the SecretManager secret version resource storing the API key. Format: projects/{project}/secrets/{secrete}/versions/{version} - If both api_key_secret and api_key_string are specified, this field takes precedence over api_key_string. - If specified, the secretmanager.versions.access permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.

Validated by:
  • _check_field_type_mismatches

field api_key_string: Optional[str] = None (alias 'apiKeyString')

Optional. The API key to be used in the request directly.

Validated by:
  • _check_field_type_mismatches

field http_element_location: Optional[HttpElementLocation] = None (alias 'httpElementLocation')

Optional. The location of the API key.

Validated by:
  • _check_field_type_mismatches

field name: Optional[str] = None

Optional. The parameter name of the API key. E.g. If the API request is “https://example.com/act?api_key=”, “api_key” would be the parameter name.

Validated by:
  • _check_field_type_mismatches

class genai.types.ApiKeyConfigDict

Bases: TypedDict

Config for authentication with API key.

This data type is not supported in Gemini API.

api_key_secret: Optional[str]

//cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.

Type:

Optional. The name of the SecretManager secret version resource storing the API key. Format

Type:

projects/{project}/secrets/{secrete}/versions/{version} - If both api_key_secret and api_key_string are specified, this field takes precedence over api_key_string. - If specified, the secretmanager.versions.access permission should be granted to Vertex AI Extension Service Agent (https

api_key_string: Optional[str]

Optional. The API key to be used in the request directly.

http_element_location: Optional[HttpElementLocation]

Optional. The location of the API key.

name: Optional[str]

//example.com/act?api_key=”, “api_key” would be the parameter name.

Type:

Optional. The parameter name of the API key. E.g. If the API request is “https

class genai.types.ApiSpec(*values)

Bases: CaseInSensitiveEnum

The API spec that the external API implements.

This enum is not supported in Gemini API.

API_SPEC_UNSPECIFIED = 'API_SPEC_UNSPECIFIED'

Unspecified API spec. This value should not be used.

Elastic search API spec.

Simple search API spec.

pydantic model genai.types.AudioChunk

Bases: BaseModel

Representation of an audio chunk.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AudioChunk",
   "description": "Representation of an audio chunk.",
   "type": "object",
   "properties": {
      "data": {
         "anyOf": [
            {
               "format": "base64url",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Raw bytes of audio data.",
         "title": "Data"
      },
      "mimeType": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "MIME type of the audio chunk.",
         "title": "Mimetype"
      },
      "sourceMetadata": {
         "anyOf": [
            {
               "$ref": "#/$defs/LiveMusicSourceMetadata"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Prompts and config used for generating this audio chunk."
      }
   },
   "$defs": {
      "LiveMusicClientContent": {
         "additionalProperties": false,
         "description": "User input to start or steer the music.",
         "properties": {
            "weightedPrompts": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/WeightedPrompt"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Weighted prompts as the model input.",
               "title": "Weightedprompts"
            }
         },
         "title": "LiveMusicClientContent",
         "type": "object"
      },
      "LiveMusicGenerationConfig": {
         "additionalProperties": false,
         "description": "Configuration for music generation.",
         "properties": {
            "temperature": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Controls the variance in audio generation. Higher values produce\n      higher variance. Range is [0.0, 3.0].",
               "title": "Temperature"
            },
            "topK": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Controls how the model selects tokens for output. Samples the topK\n      tokens with the highest probabilities. Range is [1, 1000].",
               "title": "Topk"
            },
            "seed": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Seeds audio generation. If not set, the request uses a randomly\n      generated seed.",
               "title": "Seed"
            },
            "guidance": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Controls how closely the model follows prompts.\n      Higher guidance follows more closely, but will make transitions more\n      abrupt. Range is [0.0, 6.0].",
               "title": "Guidance"
            },
            "bpm": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Beats per minute. Range is [60, 200].",
               "title": "Bpm"
            },
            "density": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Density of sounds. Range is [0.0, 1.0].",
               "title": "Density"
            },
            "brightness": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Brightness of the music. Range is [0.0, 1.0].",
               "title": "Brightness"
            },
            "scale": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Scale"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Scale of the generated music."
            },
            "muteBass": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether the audio output should contain bass.",
               "title": "Mutebass"
            },
            "muteDrums": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether the audio output should contain drums.",
               "title": "Mutedrums"
            },
            "onlyBassAndDrums": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Whether the audio output should contain only bass and drums.",
               "title": "Onlybassanddrums"
            },
            "musicGenerationMode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MusicGenerationMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The mode of music generation. Default mode is QUALITY."
            }
         },
         "title": "LiveMusicGenerationConfig",
         "type": "object"
      },
      "LiveMusicSourceMetadata": {
         "additionalProperties": false,
         "description": "Prompts and config used for generating this audio chunk.",
         "properties": {
            "clientContent": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/LiveMusicClientContent"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Weighted prompts for generating this audio chunk."
            },
            "musicGenerationConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/LiveMusicGenerationConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Music generation config for generating this audio chunk."
            }
         },
         "title": "LiveMusicSourceMetadata",
         "type": "object"
      },
      "MusicGenerationMode": {
         "description": "The mode of music generation.",
         "enum": [
            "MUSIC_GENERATION_MODE_UNSPECIFIED",
            "QUALITY",
            "DIVERSITY",
            "VOCALIZATION"
         ],
         "title": "MusicGenerationMode",
         "type": "string"
      },
      "Scale": {
         "description": "Scale of the generated music.",
         "enum": [
            "SCALE_UNSPECIFIED",
            "C_MAJOR_A_MINOR",
            "D_FLAT_MAJOR_B_FLAT_MINOR",
            "D_MAJOR_B_MINOR",
            "E_FLAT_MAJOR_C_MINOR",
            "E_MAJOR_D_FLAT_MINOR",
            "F_MAJOR_D_MINOR",
            "G_FLAT_MAJOR_E_FLAT_MINOR",
            "G_MAJOR_E_MINOR",
            "A_FLAT_MAJOR_F_MINOR",
            "A_MAJOR_G_FLAT_MINOR",
            "B_FLAT_MAJOR_G_MINOR",
            "B_MAJOR_A_FLAT_MINOR"
         ],
         "title": "Scale",
         "type": "string"
      },
      "WeightedPrompt": {
         "additionalProperties": false,
         "description": "Maps a prompt to a relative weight to steer music generation.",
         "properties": {
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text prompt.",
               "title": "Text"
            },
            "weight": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Weight of the prompt. The weight is used to control the relative\n      importance of the prompt. Higher weights are more important than lower\n      weights.\n\n      Weight must not be 0. Weights of all weighted_prompts in this\n      LiveMusicClientContent message will be normalized.",
               "title": "Weight"
            }
         },
         "title": "WeightedPrompt",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field data: Optional[bytes] = None

Raw bytes of audio data.

Validated by:
  • _check_field_type_mismatches

field mime_type: Optional[str] = None (alias 'mimeType')

MIME type of the audio chunk.

Validated by:
  • _check_field_type_mismatches

field source_metadata: Optional[LiveMusicSourceMetadata] = None (alias 'sourceMetadata')

Prompts and config used for generating this audio chunk.

Validated by:
  • _check_field_type_mismatches

class genai.types.AudioChunkDict

Bases: TypedDict

Representation of an audio chunk.

data: Optional[bytes]

Raw bytes of audio data.

mime_type: Optional[str]

MIME type of the audio chunk.

source_metadata: Optional[LiveMusicSourceMetadataDict]

Prompts and config used for generating this audio chunk.

pydantic model genai.types.AudioTranscriptionConfig

Bases: BaseModel

The audio transcription configuration in Setup.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AudioTranscriptionConfig",
   "description": "The audio transcription configuration in Setup.",
   "type": "object",
   "properties": {},
   "additionalProperties": false
}

Validators:

class genai.types.AudioTranscriptionConfigDict

Bases: TypedDict

The audio transcription configuration in Setup.

pydantic model genai.types.AuthConfig

Bases: BaseModel

Auth configuration to run the extension.

This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthConfig",
   "description": "Auth configuration to run the extension.\n\nThis data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "apiKeyConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/ApiKeyConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Config for API key auth."
      },
      "authType": {
         "anyOf": [
            {
               "$ref": "#/$defs/AuthType"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Type of auth scheme."
      },
      "googleServiceAccountConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/AuthConfigGoogleServiceAccountConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Config for Google Service Account auth."
      },
      "httpBasicAuthConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/AuthConfigHttpBasicAuthConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Config for HTTP Basic auth."
      },
      "oauthConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/AuthConfigOauthConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Config for user oauth."
      },
      "oidcConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/AuthConfigOidcConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Config for user OIDC auth."
      }
   },
   "$defs": {
      "ApiKeyConfig": {
         "additionalProperties": false,
         "description": "Config for authentication with API key.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "apiKeySecret": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The name of the SecretManager secret version resource storing the API key. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If both `api_key_secret` and `api_key_string` are specified, this field takes precedence over `api_key_string`. - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.",
               "title": "Apikeysecret"
            },
            "apiKeyString": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The API key to be used in the request directly.",
               "title": "Apikeystring"
            },
            "httpElementLocation": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HttpElementLocation"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The location of the API key."
            },
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The parameter name of the API key. E.g. If the API request is \"https://example.com/act?api_key=\", \"api_key\" would be the parameter name.",
               "title": "Name"
            }
         },
         "title": "ApiKeyConfig",
         "type": "object"
      },
      "AuthConfigGoogleServiceAccountConfig": {
         "additionalProperties": false,
         "description": "Config for Google Service Account Authentication.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "serviceAccount": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The service account that the extension execution service runs as. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.",
               "title": "Serviceaccount"
            }
         },
         "title": "AuthConfigGoogleServiceAccountConfig",
         "type": "object"
      },
      "AuthConfigHttpBasicAuthConfig": {
         "additionalProperties": false,
         "description": "Config for HTTP Basic Authentication.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "credentialSecret": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.",
               "title": "Credentialsecret"
            }
         },
         "title": "AuthConfigHttpBasicAuthConfig",
         "type": "object"
      },
      "AuthConfigOauthConfig": {
         "additionalProperties": false,
         "description": "Config for user oauth. This data type is not supported in Gemini API.",
         "properties": {
            "accessToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.",
               "title": "Accesstoken"
            },
            "serviceAccount": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The service account used to generate access tokens for executing the Extension. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.",
               "title": "Serviceaccount"
            }
         },
         "title": "AuthConfigOauthConfig",
         "type": "object"
      },
      "AuthConfigOidcConfig": {
         "additionalProperties": false,
         "description": "Config for user OIDC auth.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "idToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.",
               "title": "Idtoken"
            },
            "serviceAccount": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant `iam.serviceAccounts.getOpenIdToken` permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents).",
               "title": "Serviceaccount"
            }
         },
         "title": "AuthConfigOidcConfig",
         "type": "object"
      },
      "AuthType": {
         "description": "Type of auth scheme. This enum is not supported in Gemini API.",
         "enum": [
            "AUTH_TYPE_UNSPECIFIED",
            "NO_AUTH",
            "API_KEY_AUTH",
            "HTTP_BASIC_AUTH",
            "GOOGLE_SERVICE_ACCOUNT_AUTH",
            "OAUTH",
            "OIDC_AUTH"
         ],
         "title": "AuthType",
         "type": "string"
      },
      "HttpElementLocation": {
         "description": "The location of the API key. This enum is not supported in Gemini API.",
         "enum": [
            "HTTP_IN_UNSPECIFIED",
            "HTTP_IN_QUERY",
            "HTTP_IN_HEADER",
            "HTTP_IN_PATH",
            "HTTP_IN_BODY",
            "HTTP_IN_COOKIE"
         ],
         "title": "HttpElementLocation",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field api_key_config: Optional[ApiKeyConfig] = None (alias 'apiKeyConfig')

Config for API key auth.

Validated by:
  • _check_field_type_mismatches

field auth_type: Optional[AuthType] = None (alias 'authType')

Type of auth scheme.

Validated by:
  • _check_field_type_mismatches

field google_service_account_config: Optional[AuthConfigGoogleServiceAccountConfig] = None (alias 'googleServiceAccountConfig')

Config for Google Service Account auth.

Validated by:
  • _check_field_type_mismatches

field http_basic_auth_config: Optional[AuthConfigHttpBasicAuthConfig] = None (alias 'httpBasicAuthConfig')

Config for HTTP Basic auth.

Validated by:
  • _check_field_type_mismatches

field oauth_config: Optional[AuthConfigOauthConfig] = None (alias 'oauthConfig')

Config for user oauth.

Validated by:
  • _check_field_type_mismatches

field oidc_config: Optional[AuthConfigOidcConfig] = None (alias 'oidcConfig')

Config for user OIDC auth.

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthConfigDict

Bases: TypedDict

Auth configuration to run the extension.

This data type is not supported in Gemini API.

api_key_config: Optional[ApiKeyConfigDict]

Config for API key auth.

auth_type: Optional[AuthType]

Type of auth scheme.

google_service_account_config: Optional[AuthConfigGoogleServiceAccountConfigDict]

Config for Google Service Account auth.

http_basic_auth_config: Optional[AuthConfigHttpBasicAuthConfigDict]

Config for HTTP Basic auth.

oauth_config: Optional[AuthConfigOauthConfigDict]

Config for user oauth.

oidc_config: Optional[AuthConfigOidcConfigDict]

Config for user OIDC auth.

pydantic model genai.types.AuthConfigGoogleServiceAccountConfig

Bases: BaseModel

Config for Google Service Account Authentication.

This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthConfigGoogleServiceAccountConfig",
   "description": "Config for Google Service Account Authentication.\n\nThis data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "serviceAccount": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. The service account that the extension execution service runs as. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.",
         "title": "Serviceaccount"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field service_account: Optional[str] = None (alias 'serviceAccount')

Optional. The service account that the extension execution service runs as. - If the service account is specified, the iam.serviceAccounts.getAccessToken permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthConfigGoogleServiceAccountConfigDict

Bases: TypedDict

Config for Google Service Account Authentication.

This data type is not supported in Gemini API.

service_account: Optional[str]

//cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified service account. - If not specified, the Vertex AI Extension Service Agent will be used to execute the Extension.

Type:

Optional. The service account that the extension execution service runs as. - If the service account is specified, the iam.serviceAccounts.getAccessToken permission should be granted to Vertex AI Extension Service Agent (https

pydantic model genai.types.AuthConfigHttpBasicAuthConfig

Bases: BaseModel

Config for HTTP Basic Authentication.

This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthConfigHttpBasicAuthConfig",
   "description": "Config for HTTP Basic Authentication.\n\nThis data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "credentialSecret": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: `projects/{project}/secrets/{secrete}/versions/{version}` - If specified, the `secretmanager.versions.access` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.",
         "title": "Credentialsecret"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field credential_secret: Optional[str] = None (alias 'credentialSecret')

Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format: projects/{project}/secrets/{secrete}/versions/{version} - If specified, the secretmanager.versions.access permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthConfigHttpBasicAuthConfigDict

Bases: TypedDict

Config for HTTP Basic Authentication.

This data type is not supported in Gemini API.

credential_secret: Optional[str]

//cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the specified resource.

Type:

Required. The name of the SecretManager secret version resource storing the base64 encoded credentials. Format

Type:

projects/{project}/secrets/{secrete}/versions/{version} - If specified, the secretmanager.versions.access permission should be granted to Vertex AI Extension Service Agent (https

pydantic model genai.types.AuthConfigOauthConfig

Bases: BaseModel

Config for user oauth. This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthConfigOauthConfig",
   "description": "Config for user oauth. This data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "accessToken": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.",
         "title": "Accesstoken"
      },
      "serviceAccount": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The service account used to generate access tokens for executing the Extension. - If the service account is specified, the `iam.serviceAccounts.getAccessToken` permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.",
         "title": "Serviceaccount"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field access_token: Optional[str] = None (alias 'accessToken')

Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.

Validated by:
  • _check_field_type_mismatches

field service_account: Optional[str] = None (alias 'serviceAccount')

The service account used to generate access tokens for executing the Extension. - If the service account is specified, the iam.serviceAccounts.getAccessToken permission should be granted to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthConfigOauthConfigDict

Bases: TypedDict

Config for user oauth. This data type is not supported in Gemini API.

access_token: Optional[str]

Access token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.

service_account: Optional[str]

//cloud.google.com/vertex-ai/docs/general/access-control#service-agents) on the provided service account.

Type:

The service account used to generate access tokens for executing the Extension. - If the service account is specified, the iam.serviceAccounts.getAccessToken permission should be granted to Vertex AI Extension Service Agent (https

pydantic model genai.types.AuthConfigOidcConfig

Bases: BaseModel

Config for user OIDC auth.

This data type is not supported in Gemini API.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthConfigOidcConfig",
   "description": "Config for user OIDC auth.\n\nThis data type is not supported in Gemini API.",
   "type": "object",
   "properties": {
      "idToken": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.",
         "title": "Idtoken"
      },
      "serviceAccount": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant `iam.serviceAccounts.getOpenIdToken` permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents).",
         "title": "Serviceaccount"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field id_token: Optional[str] = None (alias 'idToken')

OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.

Validated by:
  • _check_field_type_mismatches

field service_account: Optional[str] = None (alias 'serviceAccount')

The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant iam.serviceAccounts.getOpenIdToken permission to Vertex AI Extension Service Agent (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents).

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthConfigOidcConfigDict

Bases: TypedDict

Config for user OIDC auth.

This data type is not supported in Gemini API.

id_token: Optional[str]

OpenID Connect formatted ID token for extension endpoint. Only used to propagate token from [[ExecuteExtensionRequest.runtime_auth_config]] at request time.

service_account: Optional[str]

//cloud.google.com/vertex-ai/docs/general/access-control#service-agents).

Type:

The service account used to generate an OpenID Connect (OIDC)-compatible JWT token signed by the Google OIDC Provider (accounts.google.com) for extension endpoint (https

Type:

//cloud.google.com/iam/docs/create-short-lived-credentials-direct#sa-credentials-oidc). - The audience for the token will be set to the URL in the server url defined in the OpenApi spec. - If the service account is provided, the service account should grant iam.serviceAccounts.getOpenIdToken permission to Vertex AI Extension Service Agent (https

pydantic model genai.types.AuthToken

Bases: BaseModel

Config for auth_tokens.create parameters.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AuthToken",
   "description": "Config for auth_tokens.create parameters.",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The name of the auth token.",
         "title": "Name"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field name: Optional[str] = None

The name of the auth token.

Validated by:
  • _check_field_type_mismatches

class genai.types.AuthTokenDict

Bases: TypedDict

Config for auth_tokens.create parameters.

name: Optional[str]

The name of the auth token.

class genai.types.AuthType(*values)

Bases: CaseInSensitiveEnum

Type of auth scheme. This enum is not supported in Gemini API.

API_KEY_AUTH = 'API_KEY_AUTH'

API Key Auth.

AUTH_TYPE_UNSPECIFIED = 'AUTH_TYPE_UNSPECIFIED'
GOOGLE_SERVICE_ACCOUNT_AUTH = 'GOOGLE_SERVICE_ACCOUNT_AUTH'

Google Service Account Auth.

HTTP_BASIC_AUTH = 'HTTP_BASIC_AUTH'

HTTP Basic Auth.

NO_AUTH = 'NO_AUTH'

No Auth.

OAUTH = 'OAUTH'

OAuth auth.

OIDC_AUTH = 'OIDC_AUTH'

OpenID Connect (OIDC) Auth.

pydantic model genai.types.AutomaticActivityDetection

Bases: BaseModel

Configures automatic detection of activity.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AutomaticActivityDetection",
   "description": "Configures automatic detection of activity.",
   "type": "object",
   "properties": {
      "disabled": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals.",
         "title": "Disabled"
      },
      "startOfSpeechSensitivity": {
         "anyOf": [
            {
               "$ref": "#/$defs/StartSensitivity"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Determines how likely speech is to be detected."
      },
      "endOfSpeechSensitivity": {
         "anyOf": [
            {
               "$ref": "#/$defs/EndSensitivity"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Determines how likely detected speech is ended."
      },
      "prefixPaddingMs": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives.",
         "title": "Prefixpaddingms"
      },
      "silenceDurationMs": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user's activity but this will increase the model's latency.",
         "title": "Silencedurationms"
      }
   },
   "$defs": {
      "EndSensitivity": {
         "description": "End of speech sensitivity.",
         "enum": [
            "END_SENSITIVITY_UNSPECIFIED",
            "END_SENSITIVITY_HIGH",
            "END_SENSITIVITY_LOW"
         ],
         "title": "EndSensitivity",
         "type": "string"
      },
      "StartSensitivity": {
         "description": "Start of speech sensitivity.",
         "enum": [
            "START_SENSITIVITY_UNSPECIFIED",
            "START_SENSITIVITY_HIGH",
            "START_SENSITIVITY_LOW"
         ],
         "title": "StartSensitivity",
         "type": "string"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field disabled: Optional[bool] = None

If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals.

Validated by:
  • _check_field_type_mismatches

field end_of_speech_sensitivity: Optional[EndSensitivity] = None (alias 'endOfSpeechSensitivity')

Determines how likely detected speech is ended.

Validated by:
  • _check_field_type_mismatches

field prefix_padding_ms: Optional[int] = None (alias 'prefixPaddingMs')

The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives.

Validated by:
  • _check_field_type_mismatches

field silence_duration_ms: Optional[int] = None (alias 'silenceDurationMs')

The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user’s activity but this will increase the model’s latency.

Validated by:
  • _check_field_type_mismatches

field start_of_speech_sensitivity: Optional[StartSensitivity] = None (alias 'startOfSpeechSensitivity')

Determines how likely speech is to be detected.

Validated by:
  • _check_field_type_mismatches

class genai.types.AutomaticActivityDetectionDict

Bases: TypedDict

Configures automatic detection of activity.

disabled: Optional[bool]

If enabled, detected voice and text input count as activity. If disabled, the client must send activity signals.

end_of_speech_sensitivity: Optional[EndSensitivity]

Determines how likely detected speech is ended.

prefix_padding_ms: Optional[int]

The required duration of detected speech before start-of-speech is committed. The lower this value the more sensitive the start-of-speech detection is and the shorter speech can be recognized. However, this also increases the probability of false positives.

silence_duration_ms: Optional[int]

The required duration of detected non-speech (e.g. silence) before end-of-speech is committed. The larger this value, the longer speech gaps can be without interrupting the user’s activity but this will increase the model’s latency.

start_of_speech_sensitivity: Optional[StartSensitivity]

Determines how likely speech is to be detected.

pydantic model genai.types.AutomaticFunctionCallingConfig

Bases: BaseModel

The configuration for automatic function calling.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AutomaticFunctionCallingConfig",
   "description": "The configuration for automatic function calling.",
   "type": "object",
   "properties": {
      "disable": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Whether to disable automatic function calling.\n      If not set or set to False, will enable automatic function calling.\n      If set to True, will disable automatic function calling.\n      ",
         "title": "Disable"
      },
      "maximumRemoteCalls": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": 10,
         "description": "If automatic function calling is enabled,\n      maximum number of remote calls for automatic function calling.\n      This number should be a positive integer.\n      If not set, SDK will set maximum number of remote calls to 10.\n      ",
         "title": "Maximumremotecalls"
      },
      "ignoreCallHistory": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "If automatic function calling is enabled,\n      whether to ignore call history to the response.\n      If not set, SDK will set ignore_call_history to false,\n      and will append the call history to\n      GenerateContentResponse.automatic_function_calling_history.\n      ",
         "title": "Ignorecallhistory"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field disable: Optional[bool] = None

Whether to disable automatic function calling. If not set or set to False, will enable automatic function calling. If set to True, will disable automatic function calling.

Validated by:
  • _check_field_type_mismatches

field ignore_call_history: Optional[bool] = None (alias 'ignoreCallHistory')

If automatic function calling is enabled, whether to ignore call history to the response. If not set, SDK will set ignore_call_history to false, and will append the call history to GenerateContentResponse.automatic_function_calling_history.

Validated by:
  • _check_field_type_mismatches

field maximum_remote_calls: Optional[int] = 10 (alias 'maximumRemoteCalls')

If automatic function calling is enabled, maximum number of remote calls for automatic function calling. This number should be a positive integer. If not set, SDK will set maximum number of remote calls to 10.

Validated by:
  • _check_field_type_mismatches

class genai.types.AutomaticFunctionCallingConfigDict

Bases: TypedDict

The configuration for automatic function calling.

disable: Optional[bool]

Whether to disable automatic function calling. If not set or set to False, will enable automatic function calling. If set to True, will disable automatic function calling.

ignore_call_history: Optional[bool]

If automatic function calling is enabled, whether to ignore call history to the response. If not set, SDK will set ignore_call_history to false, and will append the call history to GenerateContentResponse.automatic_function_calling_history.

maximum_remote_calls: Optional[int]

If automatic function calling is enabled, maximum number of remote calls for automatic function calling. This number should be a positive integer. If not set, SDK will set maximum number of remote calls to 10.

pydantic model genai.types.AutoraterConfig

Bases: BaseModel

Autorater config used for evaluation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "AutoraterConfig",
   "description": "Autorater config used for evaluation.",
   "type": "object",
   "properties": {
      "samplingCount": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Number of samples for each instance in the dataset.\n  If not specified, the default is 4. Minimum value is 1, maximum value\n  is 32.",
         "title": "Samplingcount"
      },
      "flipEnabled": {
         "anyOf": [
            {
               "type": "boolean"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Optional. Default is true. Whether to flip the candidate and baseline\n  responses. This is only applicable to the pairwise metric. If enabled, also\n  provide PairwiseMetricSpec.candidate_response_field_name and\n  PairwiseMetricSpec.baseline_response_field_name. When rendering\n  PairwiseMetricSpec.metric_prompt_template, the candidate and baseline\n  fields will be flipped for half of the samples to reduce bias.",
         "title": "Flipenabled"
      },
      "autoraterModel": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The fully qualified name of the publisher model or tuned autorater\n  endpoint to use.\n\n  Publisher model format:\n  `projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`\n\n  Tuned model endpoint format:\n  `projects/{project}/locations/{location}/endpoints/{endpoint}`",
         "title": "Autoratermodel"
      },
      "generationConfig": {
         "anyOf": [
            {
               "$ref": "#/$defs/GenerationConfig"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Configuration options for model generation and outputs."
      }
   },
   "$defs": {
      "FeatureSelectionPreference": {
         "description": "Options for feature selection preference.",
         "enum": [
            "FEATURE_SELECTION_PREFERENCE_UNSPECIFIED",
            "PRIORITIZE_QUALITY",
            "BALANCED",
            "PRIORITIZE_COST"
         ],
         "title": "FeatureSelectionPreference",
         "type": "string"
      },
      "GenerationConfig": {
         "additionalProperties": false,
         "description": "Generation config.",
         "properties": {
            "modelSelectionConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelSelectionConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for model selection."
            },
            "responseJsonSchema": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output schema of the generated response. This is an alternative to\n      `response_schema` that accepts [JSON Schema](https://json-schema.org/).\n      ",
               "title": "Responsejsonschema"
            },
            "audioTimestamp": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If enabled, audio timestamp will be included in the request to the model. This field is not supported in Gemini API.",
               "title": "Audiotimestamp"
            },
            "candidateCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Number of candidates to generate.",
               "title": "Candidatecount"
            },
            "enableAffectiveDialog": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If enabled, the model will detect emotions and adapt its responses accordingly. This field is not supported in Gemini API.",
               "title": "Enableaffectivedialog"
            },
            "frequencyPenalty": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Frequency penalties.",
               "title": "Frequencypenalty"
            },
            "logprobs": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Logit probabilities.",
               "title": "Logprobs"
            },
            "maxOutputTokens": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The maximum number of output tokens to generate per message.",
               "title": "Maxoutputtokens"
            },
            "mediaResolution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MediaResolution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If specified, the media resolution specified will be used."
            },
            "presencePenalty": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Positive penalties.",
               "title": "Presencepenalty"
            },
            "responseLogprobs": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If true, export the logprobs results in response.",
               "title": "Responselogprobs"
            },
            "responseMimeType": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.",
               "title": "Responsemimetype"
            },
            "responseModalities": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Modality"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The modalities of the response.",
               "title": "Responsemodalities"
            },
            "responseSchema": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Schema"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response."
            },
            "routingConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Routing configuration. This field is not supported in Gemini API."
            },
            "seed": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Seed.",
               "title": "Seed"
            },
            "speechConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SpeechConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The speech generation config."
            },
            "stopSequences": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Stop sequences.",
               "title": "Stopsequences"
            },
            "temperature": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Controls the randomness of predictions.",
               "title": "Temperature"
            },
            "thinkingConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ThinkingConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking."
            },
            "topK": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If specified, top-k sampling will be used.",
               "title": "Topk"
            },
            "topP": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. If specified, nucleus sampling will be used.",
               "title": "Topp"
            },
            "enableEnhancedCivicAnswers": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Enables enhanced civic answers. It may not be available for all models. This field is not supported in Vertex AI.",
               "title": "Enableenhancedcivicanswers"
            }
         },
         "title": "GenerationConfig",
         "type": "object"
      },
      "GenerationConfigRoutingConfig": {
         "additionalProperties": false,
         "description": "The configuration for routing the request to a specific model.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "autoMode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfigAutoRoutingMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Automated routing."
            },
            "manualMode": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerationConfigRoutingConfigManualRoutingMode"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Manual routing."
            }
         },
         "title": "GenerationConfigRoutingConfig",
         "type": "object"
      },
      "GenerationConfigRoutingConfigAutoRoutingMode": {
         "additionalProperties": false,
         "description": "When automated routing is specified, the routing will be determined by the pretrained routing model and customer provided model routing preference.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "modelRoutingPreference": {
               "anyOf": [
                  {
                     "enum": [
                        "UNKNOWN",
                        "PRIORITIZE_QUALITY",
                        "BALANCED",
                        "PRIORITIZE_COST"
                     ],
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The model routing preference.",
               "title": "Modelroutingpreference"
            }
         },
         "title": "GenerationConfigRoutingConfigAutoRoutingMode",
         "type": "object"
      },
      "GenerationConfigRoutingConfigManualRoutingMode": {
         "additionalProperties": false,
         "description": "When manual routing is set, the specified model will be used directly.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "modelName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The model name to use. Only the public LLM models are accepted. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models).",
               "title": "Modelname"
            }
         },
         "title": "GenerationConfigRoutingConfigManualRoutingMode",
         "type": "object"
      },
      "MediaResolution": {
         "description": "The media resolution to use.",
         "enum": [
            "MEDIA_RESOLUTION_UNSPECIFIED",
            "MEDIA_RESOLUTION_LOW",
            "MEDIA_RESOLUTION_MEDIUM",
            "MEDIA_RESOLUTION_HIGH"
         ],
         "title": "MediaResolution",
         "type": "string"
      },
      "Modality": {
         "description": "Server content modalities.",
         "enum": [
            "MODALITY_UNSPECIFIED",
            "TEXT",
            "IMAGE",
            "AUDIO"
         ],
         "title": "Modality",
         "type": "string"
      },
      "ModelSelectionConfig": {
         "additionalProperties": false,
         "description": "Config for model selection.",
         "properties": {
            "featureSelectionPreference": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FeatureSelectionPreference"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Options for feature selection preference."
            }
         },
         "title": "ModelSelectionConfig",
         "type": "object"
      },
      "MultiSpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "Configuration for a multi-speaker text-to-speech request.",
         "properties": {
            "speakerVoiceConfigs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SpeakerVoiceConfig"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. A list of configurations for the voices of the speakers. Exactly two speaker voice configurations must be provided.",
               "title": "Speakervoiceconfigs"
            }
         },
         "title": "MultiSpeakerVoiceConfig",
         "type": "object"
      },
      "PrebuiltVoiceConfig": {
         "additionalProperties": false,
         "description": "The configuration for the prebuilt speaker to use.",
         "properties": {
            "voiceName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the preset voice to use.",
               "title": "Voicename"
            }
         },
         "title": "PrebuiltVoiceConfig",
         "type": "object"
      },
      "ReplicatedVoiceConfig": {
         "additionalProperties": false,
         "description": "ReplicatedVoiceConfig is used to configure replicated voice.",
         "properties": {
            "mimeType": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The mime type of the replicated voice.\n      ",
               "title": "Mimetype"
            },
            "voiceSampleAudio": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The sample audio of the replicated voice.\n      ",
               "title": "Voicesampleaudio"
            }
         },
         "title": "ReplicatedVoiceConfig",
         "type": "object"
      },
      "Schema": {
         "additionalProperties": false,
         "description": "Schema is used to define the format of input/output data.\n\nRepresents a select subset of an [OpenAPI 3.0 schema\nobject](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may\nbe added in the future as needed.",
         "properties": {
            "additionalProperties": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Can either be a boolean or an object; controls the presence of additional properties.",
               "title": "Additionalproperties"
            },
            "defs": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "$ref": "#/$defs/Schema"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. A map of definitions for use by `ref` Only allowed at the root of the schema.",
               "title": "Defs"
            },
            "ref": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Allows indirect references between schema nodes. The value should be a valid reference to a child of the root `defs`. For example, the following schema defines a reference to a schema node named \"Pet\": type: object properties: pet: ref: #/defs/Pet defs: Pet: type: object properties: name: type: string The value of the \"pet\" property is a reference to the schema node named \"Pet\". See details in https://json-schema.org/understanding-json-schema/structuring",
               "title": "Ref"
            },
            "anyOf": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/Schema"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The value should be validated against any (one or more) of the subschemas in the list.",
               "title": "Anyof"
            },
            "default": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Default value of the data.",
               "title": "Default"
            },
            "description": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The description of the data.",
               "title": "Description"
            },
            "enum": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Possible values of the element of primitive type with enum format. Examples: 1. We can define direction as : {type:STRING, format:enum, enum:[\"EAST\", NORTH\", \"SOUTH\", \"WEST\"]} 2. We can define apartment number as : {type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}",
               "title": "Enum"
            },
            "example": {
               "anyOf": [
                  {},
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Example of the object. Will only populated when the object is the root.",
               "title": "Example"
            },
            "format": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The format of the data. Supported formats: for NUMBER type: \"float\", \"double\" for INTEGER type: \"int32\", \"int64\" for STRING type: \"email\", \"byte\", etc",
               "title": "Format"
            },
            "items": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Schema"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY."
            },
            "maxItems": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum number of the elements for Type.ARRAY.",
               "title": "Maxitems"
            },
            "maxLength": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum length of the Type.STRING",
               "title": "Maxlength"
            },
            "maxProperties": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum number of the properties for Type.OBJECT.",
               "title": "Maxproperties"
            },
            "maximum": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Maximum value of the Type.INTEGER and Type.NUMBER",
               "title": "Maximum"
            },
            "minItems": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Minimum number of the elements for Type.ARRAY.",
               "title": "Minitems"
            },
            "minLength": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING",
               "title": "Minlength"
            },
            "minProperties": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Minimum number of the properties for Type.OBJECT.",
               "title": "Minproperties"
            },
            "minimum": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER",
               "title": "Minimum"
            },
            "nullable": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Indicates if the value may be null.",
               "title": "Nullable"
            },
            "pattern": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Pattern of the Type.STRING to restrict a string to a regular expression.",
               "title": "Pattern"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "$ref": "#/$defs/Schema"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT.",
               "title": "Properties"
            },
            "propertyOrdering": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The order of the properties. Not a standard field in open api spec. Only used to support the order of the properties.",
               "title": "Propertyordering"
            },
            "required": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Required properties of Type.OBJECT.",
               "title": "Required"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The title of the Schema.",
               "title": "Title"
            },
            "type": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Type"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The type of the data."
            }
         },
         "title": "Schema",
         "type": "object"
      },
      "SpeakerVoiceConfig": {
         "additionalProperties": false,
         "description": "Configuration for a single speaker in a multi speaker setup.",
         "properties": {
            "speaker": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The name of the speaker. This should be the same as the speaker name used in the prompt.",
               "title": "Speaker"
            },
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The configuration for the voice of this speaker."
            }
         },
         "title": "SpeakerVoiceConfig",
         "type": "object"
      },
      "SpeechConfig": {
         "additionalProperties": false,
         "properties": {
            "voiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Configuration for the voice of the response."
            },
            "languageCode": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization.",
               "title": "Languagecode"
            },
            "multiSpeakerVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/MultiSpeakerVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for a multi-speaker text-to-speech request. This field is mutually exclusive with `voice_config`."
            }
         },
         "title": "SpeechConfig",
         "type": "object"
      },
      "ThinkingConfig": {
         "additionalProperties": false,
         "description": "The thinking features configuration.",
         "properties": {
            "includeThoughts": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.\n      ",
               "title": "Includethoughts"
            },
            "thinkingBudget": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.\n      ",
               "title": "Thinkingbudget"
            },
            "thinkingLevel": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ThinkingLevel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The number of thoughts tokens that the model should generate."
            }
         },
         "title": "ThinkingConfig",
         "type": "object"
      },
      "ThinkingLevel": {
         "description": "The number of thoughts tokens that the model should generate.",
         "enum": [
            "THINKING_LEVEL_UNSPECIFIED",
            "LOW",
            "MEDIUM",
            "HIGH",
            "MINIMAL"
         ],
         "title": "ThinkingLevel",
         "type": "string"
      },
      "Type": {
         "description": "The type of the data.",
         "enum": [
            "TYPE_UNSPECIFIED",
            "STRING",
            "NUMBER",
            "INTEGER",
            "BOOLEAN",
            "ARRAY",
            "OBJECT",
            "NULL"
         ],
         "title": "Type",
         "type": "string"
      },
      "VoiceConfig": {
         "additionalProperties": false,
         "properties": {
            "replicatedVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ReplicatedVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "If true, the model will use a replicated voice for the response."
            },
            "prebuiltVoiceConfig": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PrebuiltVoiceConfig"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The configuration for the prebuilt voice to use."
            }
         },
         "title": "VoiceConfig",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field autorater_model: Optional[str] = None (alias 'autoraterModel')

The fully qualified name of the publisher model or tuned autorater endpoint to use.

Publisher model format: projects/{project}/locations/{location}/publishers/{publisher}/models/{model}

Tuned model endpoint format: projects/{project}/locations/{location}/endpoints/{endpoint}

Validated by:
  • _check_field_type_mismatches

field flip_enabled: Optional[bool] = None (alias 'flipEnabled')

Optional. Default is true. Whether to flip the candidate and baseline responses. This is only applicable to the pairwise metric. If enabled, also provide PairwiseMetricSpec.candidate_response_field_name and PairwiseMetricSpec.baseline_response_field_name. When rendering PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped for half of the samples to reduce bias.

Validated by:
  • _check_field_type_mismatches

field generation_config: Optional[GenerationConfig] = None (alias 'generationConfig')

Configuration options for model generation and outputs.

Validated by:
  • _check_field_type_mismatches

field sampling_count: Optional[int] = None (alias 'samplingCount')

Number of samples for each instance in the dataset. If not specified, the default is 4. Minimum value is 1, maximum value is 32.

Validated by:
  • _check_field_type_mismatches

class genai.types.AutoraterConfigDict

Bases: TypedDict

Autorater config used for evaluation.

autorater_model: Optional[str]

The fully qualified name of the publisher model or tuned autorater endpoint to use.

Publisher model format: projects/{project}/locations/{location}/publishers/{publisher}/models/{model}

Tuned model endpoint format: projects/{project}/locations/{location}/endpoints/{endpoint}

flip_enabled: Optional[bool]

Optional. Default is true. Whether to flip the candidate and baseline responses. This is only applicable to the pairwise metric. If enabled, also provide PairwiseMetricSpec.candidate_response_field_name and PairwiseMetricSpec.baseline_response_field_name. When rendering PairwiseMetricSpec.metric_prompt_template, the candidate and baseline fields will be flipped for half of the samples to reduce bias.

generation_config: Optional[GenerationConfigDict]

Configuration options for model generation and outputs.

sampling_count: Optional[int]

Number of samples for each instance in the dataset. If not specified, the default is 4. Minimum value is 1, maximum value is 32.

pydantic model genai.types.BatchJob

Bases: BaseModel

Config for batches.create return value.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "BatchJob",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The resource name of the BatchJob. Output only.\".\n      ",
         "title": "Name"
      },
      "displayName": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The display name of the BatchJob.\n      ",
         "title": "Displayname"
      },
      "state": {
         "anyOf": [
            {
               "$ref": "#/$defs/JobState"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The state of the BatchJob.\n      "
      },
      "error": {
         "anyOf": [
            {
               "$ref": "#/$defs/JobError"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Output only. Only populated when the job's state is JOB_STATE_FAILED or JOB_STATE_CANCELLED."
      },
      "createTime": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The time when the BatchJob was created.\n      ",
         "title": "Createtime"
      },
      "startTime": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Output only. Time when the Job for the first time entered the `JOB_STATE_RUNNING` state.",
         "title": "Starttime"
      },
      "endTime": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The time when the BatchJob was completed. This field is for Vertex AI only.\n      ",
         "title": "Endtime"
      },
      "updateTime": {
         "anyOf": [
            {
               "format": "date-time",
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The time when the BatchJob was last updated.\n      ",
         "title": "Updatetime"
      },
      "model": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The name of the model that produces the predictions via the BatchJob.\n      ",
         "title": "Model"
      },
      "src": {
         "default": null,
         "title": "Src"
      },
      "dest": {
         "anyOf": [
            {
               "$ref": "#/$defs/BatchJobDestination"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Configuration for the output data.\n      "
      },
      "completionStats": {
         "anyOf": [
            {
               "$ref": "#/$defs/CompletionStats"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Statistics on completed and failed prediction instances. This field is for Vertex AI only.\n      "
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "BatchJobDestination": {
         "additionalProperties": false,
         "description": "Config for `des` parameter.",
         "properties": {
            "format": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Storage format of the output files. Must be one of:\n      'jsonl', 'bigquery'.\n      ",
               "title": "Format"
            },
            "gcsUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The Google Cloud Storage URI to the output file.\n      ",
               "title": "Gcsuri"
            },
            "bigqueryUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The BigQuery URI to the output table.\n      ",
               "title": "Bigqueryuri"
            },
            "fileName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The Gemini Developer API's file resource name of the output data\n      (e.g. \"files/12345\"). The file will be a JSONL file with a single response\n      per line. The responses will be GenerateContentResponse messages formatted\n      as JSON. The responses will be written in the same order as the input\n      requests.\n      ",
               "title": "Filename"
            },
            "inlinedResponses": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/InlinedResponse"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The responses to the requests in the batch. Returned when the batch was\n      built using inlined requests. The responses will be in the same order as\n      the input requests.\n      ",
               "title": "Inlinedresponses"
            },
            "inlinedEmbedContentResponses": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/InlinedEmbedContentResponse"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The responses to the requests in the batch. Returned when the batch was\n      built using inlined requests. The responses will be in the same order as\n      the input requests.\n      ",
               "title": "Inlinedembedcontentresponses"
            }
         },
         "title": "BatchJobDestination",
         "type": "object"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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 only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.",
               "title": "Displayname"
            },
            "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. The reason why the prompt was blocked.",
         "enum": [
            "BLOCKED_REASON_UNSPECIFIED",
            "SAFETY",
            "OTHER",
            "BLOCKLIST",
            "PROHIBITED_CONTENT",
            "IMAGE_SAFETY",
            "MODEL_ARMOR",
            "JAILBREAK"
         ],
         "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      "
            },
            "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"
            },
            "urlContextMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UrlContextMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Metadata related to url context retrieval tool."
            }
         },
         "title": "Candidate",
         "type": "object"
      },
      "Citation": {
         "additionalProperties": false,
         "description": "Source attributions for content.\n\nThis data type is not supported in Gemini API.",
         "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`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"
      },
      "CompletionStats": {
         "additionalProperties": false,
         "description": "Success and error statistics of processing multiple entities (for example, DataItems or structured data rows) in batch.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "failedCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of entities for which any error was encountered.",
               "title": "Failedcount"
            },
            "incompleteCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. In cases when enough errors are encountered a job, pipeline, or operation may be failed as a whole. Below is the number of entities for which the processing had not been finished (either in successful or failed state). Set to -1 if the number is unknown (for example, the operation failed before the total entity number could be collected).",
               "title": "Incompletecount"
            },
            "successfulCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of entities that had been processed successfully.",
               "title": "Successfulcount"
            },
            "successfulForecastPointCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of the successful forecast points that are generated by the forecasting model. This is ONLY used by the forecasting batch prediction.",
               "title": "Successfulforecastpointcount"
            }
         },
         "title": "CompletionStats",
         "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 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "ContentEmbedding": {
         "additionalProperties": false,
         "description": "The embedding generated from an input content.",
         "properties": {
            "values": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of floats representing an embedding.\n      ",
               "title": "Values"
            },
            "statistics": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ContentEmbeddingStatistics"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. Statistics of the input text associated with this\n      embedding.\n      "
            }
         },
         "title": "ContentEmbedding",
         "type": "object"
      },
      "ContentEmbeddingStatistics": {
         "additionalProperties": false,
         "description": "Statistics of the input text associated with the result of content embedding.",
         "properties": {
            "truncated": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. If the input text was truncated due to having\n      a length longer than the allowed maximum input.\n      ",
               "title": "Truncated"
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. Number of tokens of the input text.\n      ",
               "title": "Tokencount"
            }
         },
         "title": "ContentEmbeddingStatistics",
         "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 [CodeExecution] tool, in which the code will be\nautomatically executed, and a corresponding [CodeExecutionResult] will also be\ngenerated.",
         "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. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.",
               "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",
            "IMAGE_PROHIBITED_CONTENT",
            "NO_IMAGE",
            "IMAGE_RECITATION",
            "IMAGE_OTHER"
         ],
         "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": "Optional. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            },
            "partialArgs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/PartialArg"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.",
               "title": "Partialargs"
            },
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.",
               "title": "Willcontinue"
            }
         },
         "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."
            },
            "parts": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/FunctionResponsePart"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of parts that constitute a function response. Each part may\n      have a different IANA MIME type.",
               "title": "Parts"
            },
            "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"
      },
      "FunctionResponseBlob": {
         "additionalProperties": false,
         "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the FunctionResponse.response\nfield.",
         "properties": {
            "mimeType": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The IANA standard MIME type of the source data.",
               "title": "Mimetype"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Inline media bytes.",
               "title": "Data"
            },
            "displayName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Display name of the blob.\n      Used to provide a label or filename to distinguish blobs.",
               "title": "Displayname"
            }
         },
         "title": "FunctionResponseBlob",
         "type": "object"
      },
      "FunctionResponseFileData": {
         "additionalProperties": false,
         "description": "URI based data for function response.",
         "properties": {
            "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"
            },
            "displayName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Display name of the file.\n      Used to provide a label or filename to distinguish files.",
               "title": "Displayname"
            }
         },
         "title": "FunctionResponseFileData",
         "type": "object"
      },
      "FunctionResponsePart": {
         "additionalProperties": false,
         "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`.\n\nA `FunctionResponsePart` must have a fixed IANA MIME type identifying the\ntype and subtype of the media if the `inline_data` field is filled with raw\nbytes.",
         "properties": {
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseBlob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inline media bytes."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseFileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            }
         },
         "title": "FunctionResponsePart",
         "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"
      },
      "GenerateContentResponse": {
         "additionalProperties": false,
         "description": "Response message for PredictionService.GenerateContent.",
         "properties": {
            "sdkHttpResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HttpResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Used to retain the full HTTP response."
            },
            "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"
            },
            "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."
            },
            "responseId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. response_id is used to identify each response. It is the encoding of the event_id.",
               "title": "Responseid"
            },
            "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"
      },
      "GenerateContentResponsePromptFeedback": {
         "additionalProperties": false,
         "description": "Content filter results for a prompt sent in the request.\n\nNote: This is sent only in the first stream chunk and only if no candidates\nwere generated due to content violations.",
         "properties": {
            "blockReason": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BlockedReason"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The reason why the prompt was blocked."
            },
            "blockReasonMessage": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A readable message that explains the reason why the prompt was blocked. This field is not supported in Gemini API.",
               "title": "Blockreasonmessage"
            },
            "safetyRatings": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SafetyRating"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A list of safety ratings for the prompt. There is one rating per category.",
               "title": "Safetyratings"
            }
         },
         "title": "GenerateContentResponsePromptFeedback",
         "type": "object"
      },
      "GenerateContentResponseUsageMetadata": {
         "additionalProperties": false,
         "description": "Usage metadata about the content generation request and response.\n\nThis message provides a detailed breakdown of token usage and other relevant\nmetrics. This data type is not supported in Gemini API.",
         "properties": {
            "cacheTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown of the token count for each modality in the cached content.",
               "title": "Cachetokensdetails"
            },
            "cachedContentTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens in the cached content that was used for this request.",
               "title": "Cachedcontenttokencount"
            },
            "candidatesTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens in the generated candidates.",
               "title": "Candidatestokencount"
            },
            "candidatesTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown of the token count for each modality in the generated candidates.",
               "title": "Candidatestokensdetails"
            },
            "promptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When `cached_content` is set, this also 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. A detailed breakdown of the token count for each modality in the prompt.",
               "title": "Prompttokensdetails"
            },
            "thoughtsTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens that were part of the model's generated \"thoughts\" output, if applicable.",
               "title": "Thoughtstokencount"
            },
            "toolUsePromptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.",
               "title": "Tooluseprompttokencount"
            },
            "toolUsePromptTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input.",
               "title": "Tooluseprompttokensdetails"
            },
            "totalTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens for the entire request. This is the sum of `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`.",
               "title": "Totaltokencount"
            },
            "trafficType": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TrafficType"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The traffic type for this request."
            }
         },
         "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. This\ndata type is not supported in Gemini API.",
         "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": {
            "maps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from Google Maps. This field is not supported in Gemini API."
            },
            "retrievedContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkRetrievedContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from context retrieved by the retrieval tools. This field is not supported in Gemini API."
            },
            "web": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkWeb"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from the web."
            }
         },
         "title": "GroundingChunk",
         "type": "object"
      },
      "GroundingChunkMaps": {
         "additionalProperties": false,
         "description": "Chunk from Google Maps. This data type is not supported in Gemini API.",
         "properties": {
            "placeAnswerSources": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Sources used to generate the place answer. This includes review snippets and photos that were used to generate the answer, as well as uris to flag content."
            },
            "placeId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place.",
               "title": "Placeid"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the place answer.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the place.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the place.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMaps",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSources": {
         "additionalProperties": false,
         "description": "Sources used to generate the place answer.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "flagContentUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A link where users can flag a problem with the generated answer.",
               "title": "Flagcontenturi"
            },
            "reviewSnippets": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Snippets of reviews that are used to generate the answer.",
               "title": "Reviewsnippets"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSources",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution": {
         "additionalProperties": false,
         "description": "Author attribution for a photo or review.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "displayName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Name of the author of the Photo or Review.",
               "title": "Displayname"
            },
            "photoUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Profile photo URI of the author of the Photo or Review.",
               "title": "Photouri"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI of the author of the Photo or Review.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet": {
         "additionalProperties": false,
         "description": "Encapsulates a review snippet.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "authorAttribution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "This review's author."
            },
            "flagContentUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A link where users can flag a problem with the review.",
               "title": "Flagcontenturi"
            },
            "googleMapsUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A link to show the review on Google Maps.",
               "title": "Googlemapsuri"
            },
            "relativePublishTimeDescription": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A string of formatted recent time, expressing the review time relative to the current time in a form appropriate for the language and country.",
               "title": "Relativepublishtimedescription"
            },
            "review": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A reference representing this place review which may be used to look up this place review again.",
               "title": "Review"
            },
            "reviewId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Id of the review referencing the place.",
               "title": "Reviewid"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the review.",
               "title": "Title"
            }
         },
         "title": "GroundingChunkMapsPlaceAnswerSourcesReviewSnippet",
         "type": "object"
      },
      "GroundingChunkRetrievedContext": {
         "additionalProperties": false,
         "description": "Chunk from context retrieved by the retrieval tools.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "documentName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The full document name for the referenced Vertex AI Search document.",
               "title": "Documentname"
            },
            "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. This field is not supported in Gemini API.",
               "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": {
            "googleMapsWidgetContextToken": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. Resource name of the Google Maps widget context token to be used with the PlacesContextElement widget to render contextual data. This is populated only for Google Maps grounding. This field is not supported in Gemini API.",
               "title": "Googlemapswidgetcontexttoken"
            },
            "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. This field is not supported in Gemini API.",
               "title": "Retrievalqueries"
            },
            "searchEntryPoint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SearchEntryPoint"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Google search entry for the following-up web searches."
            },
            "sourceFlaggingUris": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/GroundingMetadataSourceFlaggingUri"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. This field is not supported in Gemini API.",
               "title": "Sourceflagginguris"
            },
            "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"
      },
      "GroundingMetadataSourceFlaggingUri": {
         "additionalProperties": false,
         "description": "Source content flagging uri for a place or review.\n\nThis is currently populated only for Google Maps grounding. This data type is\nnot supported in Gemini API.",
         "properties": {
            "flagContentUri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A link where users can flag a problem with the source (place or review).",
               "title": "Flagcontenturi"
            },
            "sourceId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Id of the place or review.",
               "title": "Sourceid"
            }
         },
         "title": "GroundingMetadataSourceFlaggingUri",
         "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. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored.",
               "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"
      },
      "HarmBlockThreshold": {
         "description": "The harm block threshold.",
         "enum": [
            "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
            "BLOCK_LOW_AND_ABOVE",
            "BLOCK_MEDIUM_AND_ABOVE",
            "BLOCK_ONLY_HIGH",
            "BLOCK_NONE",
            "OFF"
         ],
         "title": "HarmBlockThreshold",
         "type": "string"
      },
      "HarmCategory": {
         "description": "Harm category.",
         "enum": [
            "HARM_CATEGORY_UNSPECIFIED",
            "HARM_CATEGORY_HARASSMENT",
            "HARM_CATEGORY_HATE_SPEECH",
            "HARM_CATEGORY_SEXUALLY_EXPLICIT",
            "HARM_CATEGORY_DANGEROUS_CONTENT",
            "HARM_CATEGORY_CIVIC_INTEGRITY",
            "HARM_CATEGORY_IMAGE_HATE",
            "HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT",
            "HARM_CATEGORY_IMAGE_HARASSMENT",
            "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",
            "HARM_CATEGORY_JAILBREAK"
         ],
         "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.\n\nHarm severity levels in the content. This enum is not supported in Gemini API.",
         "enum": [
            "HARM_SEVERITY_UNSPECIFIED",
            "HARM_SEVERITY_NEGLIGIBLE",
            "HARM_SEVERITY_LOW",
            "HARM_SEVERITY_MEDIUM",
            "HARM_SEVERITY_HIGH"
         ],
         "title": "HarmSeverity",
         "type": "string"
      },
      "HttpResponse": {
         "additionalProperties": false,
         "description": "A wrapper class for the http response.",
         "properties": {
            "headers": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Used to retain the processed HTTP headers in the response.",
               "title": "Headers"
            },
            "body": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The raw HTTP response body, in JSON format.",
               "title": "Body"
            }
         },
         "title": "HttpResponse",
         "type": "object"
      },
      "InlinedEmbedContentResponse": {
         "additionalProperties": false,
         "description": "Config for `inlined_embedding_responses` parameter.",
         "properties": {
            "response": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SingleEmbedContentResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The response to the request.\n      "
            },
            "error": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/JobError"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The error encountered while processing the request.\n      "
            }
         },
         "title": "InlinedEmbedContentResponse",
         "type": "object"
      },
      "InlinedResponse": {
         "additionalProperties": false,
         "description": "Config for `inlined_responses` parameter.",
         "properties": {
            "response": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GenerateContentResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The response to the request.\n      "
            },
            "error": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/JobError"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The error encountered while processing the request.\n      "
            }
         },
         "title": "InlinedResponse",
         "type": "object"
      },
      "JobError": {
         "additionalProperties": false,
         "description": "Job error.",
         "properties": {
            "details": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.",
               "title": "Details"
            },
            "code": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The status code.",
               "title": "Code"
            },
            "message": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the `details` field.",
               "title": "Message"
            }
         },
         "title": "JobError",
         "type": "object"
      },
      "JobState": {
         "description": "Job state.",
         "enum": [
            "JOB_STATE_UNSPECIFIED",
            "JOB_STATE_QUEUED",
            "JOB_STATE_PENDING",
            "JOB_STATE_RUNNING",
            "JOB_STATE_SUCCEEDED",
            "JOB_STATE_FAILED",
            "JOB_STATE_CANCELLING",
            "JOB_STATE_CANCELLED",
            "JOB_STATE_PAUSED",
            "JOB_STATE_EXPIRED",
            "JOB_STATE_UPDATING",
            "JOB_STATE_PARTIALLY_SUCCEEDED"
         ],
         "title": "JobState",
         "type": "string"
      },
      "Language": {
         "description": "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": "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": {
            "mediaResolution": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PartMediaResolution"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Media resolution for the input media.\n    "
            },
            "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."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            },
            "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."
            },
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Blob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inlined bytes data."
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Text part (can be code).",
               "title": "Text"
            },
            "thought": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Indicates if the part is thought from the model.",
               "title": "Thought"
            },
            "thoughtSignature": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. An opaque signature for the thought so it can be reused in subsequent requests.",
               "title": "Thoughtsignature"
            },
            "videoMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/VideoMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data."
            }
         },
         "title": "Part",
         "type": "object"
      },
      "PartMediaResolution": {
         "additionalProperties": false,
         "description": "Media resolution for the input media.",
         "properties": {
            "level": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/PartMediaResolutionLevel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The tokenization quality used for given media.\n    "
            },
            "numTokens": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Specifies the required sequence length for media tokenization.\n    ",
               "title": "Numtokens"
            }
         },
         "title": "PartMediaResolution",
         "type": "object"
      },
      "PartMediaResolutionLevel": {
         "description": "The tokenization quality used for given media.",
         "enum": [
            "MEDIA_RESOLUTION_UNSPECIFIED",
            "MEDIA_RESOLUTION_LOW",
            "MEDIA_RESOLUTION_MEDIUM",
            "MEDIA_RESOLUTION_HIGH",
            "MEDIA_RESOLUTION_ULTRA_HIGH"
         ],
         "title": "PartMediaResolutionLevel",
         "type": "string"
      },
      "PartialArg": {
         "additionalProperties": false,
         "description": "Partial argument value of the function call.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "nullValue": {
               "anyOf": [
                  {
                     "const": "NULL_VALUE",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Represents a null value.",
               "title": "Nullvalue"
            },
            "numberValue": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Represents a double value.",
               "title": "Numbervalue"
            },
            "stringValue": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Represents a string value.",
               "title": "Stringvalue"
            },
            "boolValue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Represents a boolean value.",
               "title": "Boolvalue"
            },
            "jsonPath": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. \"$.foo.bar[0].data\".",
               "title": "Jsonpath"
            },
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow.",
               "title": "Willcontinue"
            }
         },
         "title": "PartialArg",
         "type": "object"
      },
      "RagChunk": {
         "additionalProperties": false,
         "description": "A RagChunk includes the content of a chunk of a RagFile, and associated metadata.\n\nThis data type is not supported in Gemini API.",
         "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.\n\nThis data type is not supported in Gemini API.",
         "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."
            },
            "overwrittenThreshold": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HarmBlockThreshold"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The overwritten threshold for the safety category of Gemini 2.0 image out. If minors are detected in the output image, the threshold of each safety category will be overwritten if user sets a lower threshold. This field is not supported in Gemini API."
            },
            "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. This field is not supported in Gemini API.",
               "title": "Probabilityscore"
            },
            "severity": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HarmSeverity"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Harm severity levels in the content. This field is not supported in Gemini API."
            },
            "severityScore": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Harm severity score. This field is not supported in Gemini API.",
               "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"
      },
      "SingleEmbedContentResponse": {
         "additionalProperties": false,
         "description": "Config for `response` parameter.",
         "properties": {
            "embedding": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ContentEmbedding"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The response to the request.\n      "
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The error encountered while processing the request.\n      ",
               "title": "Tokencount"
            }
         },
         "title": "SingleEmbedContentResponse",
         "type": "object"
      },
      "TrafficType": {
         "description": "Output only.\n\nThe traffic type for this request. This enum is not supported in Gemini API.",
         "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": "Output only. List of url context.",
               "title": "Urlmetadata"
            }
         },
         "title": "UrlContextMetadata",
         "type": "object"
      },
      "UrlMetadata": {
         "additionalProperties": false,
         "description": "Context of the a single url retrieval.",
         "properties": {
            "retrievedUrl": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Retrieved url 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",
            "URL_RETRIEVAL_STATUS_PAYWALL",
            "URL_RETRIEVAL_STATUS_UNSAFE"
         ],
         "title": "UrlRetrievalStatus",
         "type": "string"
      },
      "VideoMetadata": {
         "additionalProperties": false,
         "description": "Metadata describes the input video content.",
         "properties": {
            "endOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The end offset of the video.",
               "title": "Endoffset"
            },
            "fps": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "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].",
               "title": "Fps"
            },
            "startOffset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The start offset of the video.",
               "title": "Startoffset"
            }
         },
         "title": "VideoMetadata",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
Validators:

field completion_stats: Optional[CompletionStats] = None (alias 'completionStats')

Statistics on completed and failed prediction instances. This field is for Vertex AI only.

Validated by:
  • _check_field_type_mismatches

field create_time: Optional[datetime] = None (alias 'createTime')

The time when the BatchJob was created.

Validated by:
  • _check_field_type_mismatches

field dest: Optional[BatchJobDestination] = None

Configuration for the output data.

Validated by:
  • _check_field_type_mismatches

field display_name: Optional[str] = None (alias 'displayName')

The display name of the BatchJob.

Validated by:
  • _check_field_type_mismatches

field end_time: Optional[datetime] = None (alias 'endTime')

The time when the BatchJob was completed. This field is for Vertex AI only.

Validated by:
  • _check_field_type_mismatches

field error: Optional[JobError] = None

Output only. Only populated when the job’s state is JOB_STATE_FAILED or JOB_STATE_CANCELLED.

Validated by:
  • _check_field_type_mismatches

field model: Optional[str] = None

The name of the model that produces the predictions via the BatchJob.

Validated by:
  • _check_field_type_mismatches

field name: Optional[str] = None

The resource name of the BatchJob. Output only.”.

Validated by:
  • _check_field_type_mismatches

field src: Optional[BatchJobSource] = None

Configuration for the input data. This field is for Vertex AI only.

Validated by:
  • _check_field_type_mismatches

field start_time: Optional[datetime] = None (alias 'startTime')

Output only. Time when the Job for the first time entered the JOB_STATE_RUNNING state.

Validated by:
  • _check_field_type_mismatches

field state: Optional[JobState] = None

The state of the BatchJob.

Validated by:
  • _check_field_type_mismatches

field update_time: Optional[datetime] = None (alias 'updateTime')

The time when the BatchJob was last updated.

Validated by:
  • _check_field_type_mismatches

property done: bool

Returns True if the batch job has ended.

pydantic model genai.types.BatchJobDestination

Bases: BaseModel

Config for des parameter.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Show JSON schema
{
   "title": "BatchJobDestination",
   "description": "Config for `des` parameter.",
   "type": "object",
   "properties": {
      "format": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Storage format of the output files. Must be one of:\n      'jsonl', 'bigquery'.\n      ",
         "title": "Format"
      },
      "gcsUri": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Google Cloud Storage URI to the output file.\n      ",
         "title": "Gcsuri"
      },
      "bigqueryUri": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The BigQuery URI to the output table.\n      ",
         "title": "Bigqueryuri"
      },
      "fileName": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The Gemini Developer API's file resource name of the output data\n      (e.g. \"files/12345\"). The file will be a JSONL file with a single response\n      per line. The responses will be GenerateContentResponse messages formatted\n      as JSON. The responses will be written in the same order as the input\n      requests.\n      ",
         "title": "Filename"
      },
      "inlinedResponses": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/InlinedResponse"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The responses to the requests in the batch. Returned when the batch was\n      built using inlined requests. The responses will be in the same order as\n      the input requests.\n      ",
         "title": "Inlinedresponses"
      },
      "inlinedEmbedContentResponses": {
         "anyOf": [
            {
               "items": {
                  "$ref": "#/$defs/InlinedEmbedContentResponse"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The responses to the requests in the batch. Returned when the batch was\n      built using inlined requests. The responses will be in the same order as\n      the input requests.\n      ",
         "title": "Inlinedembedcontentresponses"
      }
   },
   "$defs": {
      "BaseModel": {
         "properties": {},
         "title": "BaseModel",
         "type": "object"
      },
      "Blob": {
         "additionalProperties": false,
         "description": "Content blob.",
         "properties": {
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Raw bytes.",
               "title": "Data"
            },
            "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 only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.",
               "title": "Displayname"
            },
            "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. The reason why the prompt was blocked.",
         "enum": [
            "BLOCKED_REASON_UNSPECIFIED",
            "SAFETY",
            "OTHER",
            "BLOCKLIST",
            "PROHIBITED_CONTENT",
            "IMAGE_SAFETY",
            "MODEL_ARMOR",
            "JAILBREAK"
         ],
         "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      "
            },
            "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"
            },
            "urlContextMetadata": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/UrlContextMetadata"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. Metadata related to url context retrieval tool."
            }
         },
         "title": "Candidate",
         "type": "object"
      },
      "Citation": {
         "additionalProperties": false,
         "description": "Source attributions for content.\n\nThis data type is not supported in Gemini API.",
         "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\nOnly generated when using the [CodeExecution] tool, and always follows a\n`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 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.",
               "title": "Role"
            }
         },
         "title": "Content",
         "type": "object"
      },
      "ContentEmbedding": {
         "additionalProperties": false,
         "description": "The embedding generated from an input content.",
         "properties": {
            "values": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "A list of floats representing an embedding.\n      ",
               "title": "Values"
            },
            "statistics": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ContentEmbeddingStatistics"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. Statistics of the input text associated with this\n      embedding.\n      "
            }
         },
         "title": "ContentEmbedding",
         "type": "object"
      },
      "ContentEmbeddingStatistics": {
         "additionalProperties": false,
         "description": "Statistics of the input text associated with the result of content embedding.",
         "properties": {
            "truncated": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. If the input text was truncated due to having\n      a length longer than the allowed maximum input.\n      ",
               "title": "Truncated"
            },
            "tokenCount": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Vertex API only. Number of tokens of the input text.\n      ",
               "title": "Tokencount"
            }
         },
         "title": "ContentEmbeddingStatistics",
         "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 [CodeExecution] tool, in which the code will be\nautomatically executed, and a corresponding [CodeExecutionResult] will also be\ngenerated.",
         "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. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.",
               "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",
            "IMAGE_PROHIBITED_CONTENT",
            "NO_IMAGE",
            "IMAGE_RECITATION",
            "IMAGE_OTHER"
         ],
         "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": "Optional. The name of the function to call. Matches [FunctionDeclaration.name].",
               "title": "Name"
            },
            "partialArgs": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/PartialArg"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API.",
               "title": "Partialargs"
            },
            "willContinue": {
               "anyOf": [
                  {
                     "type": "boolean"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API.",
               "title": "Willcontinue"
            }
         },
         "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."
            },
            "parts": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/FunctionResponsePart"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "List of parts that constitute a function response. Each part may\n      have a different IANA MIME type.",
               "title": "Parts"
            },
            "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"
      },
      "FunctionResponseBlob": {
         "additionalProperties": false,
         "description": "Raw media bytes for function response.\n\nText should not be sent as raw bytes, use the FunctionResponse.response\nfield.",
         "properties": {
            "mimeType": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. The IANA standard MIME type of the source data.",
               "title": "Mimetype"
            },
            "data": {
               "anyOf": [
                  {
                     "format": "base64url",
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Required. Inline media bytes.",
               "title": "Data"
            },
            "displayName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Display name of the blob.\n      Used to provide a label or filename to distinguish blobs.",
               "title": "Displayname"
            }
         },
         "title": "FunctionResponseBlob",
         "type": "object"
      },
      "FunctionResponseFileData": {
         "additionalProperties": false,
         "description": "URI based data for function response.",
         "properties": {
            "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"
            },
            "displayName": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Display name of the file.\n      Used to provide a label or filename to distinguish files.",
               "title": "Displayname"
            }
         },
         "title": "FunctionResponseFileData",
         "type": "object"
      },
      "FunctionResponsePart": {
         "additionalProperties": false,
         "description": "A datatype containing media that is part of a `FunctionResponse` message.\n\nA `FunctionResponsePart` consists of data which has an associated datatype. A\n`FunctionResponsePart` can only contain one of the accepted types in\n`FunctionResponsePart.data`.\n\nA `FunctionResponsePart` must have a fixed IANA MIME type identifying the\ntype and subtype of the media if the `inline_data` field is filled with raw\nbytes.",
         "properties": {
            "inlineData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseBlob"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. Inline media bytes."
            },
            "fileData": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunctionResponseFileData"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional. URI based data."
            }
         },
         "title": "FunctionResponsePart",
         "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"
      },
      "GenerateContentResponse": {
         "additionalProperties": false,
         "description": "Response message for PredictionService.GenerateContent.",
         "properties": {
            "sdkHttpResponse": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/HttpResponse"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Used to retain the full HTTP response."
            },
            "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"
            },
            "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."
            },
            "responseId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. response_id is used to identify each response. It is the encoding of the event_id.",
               "title": "Responseid"
            },
            "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"
      },
      "GenerateContentResponsePromptFeedback": {
         "additionalProperties": false,
         "description": "Content filter results for a prompt sent in the request.\n\nNote: This is sent only in the first stream chunk and only if no candidates\nwere generated due to content violations.",
         "properties": {
            "blockReason": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BlockedReason"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The reason why the prompt was blocked."
            },
            "blockReasonMessage": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A readable message that explains the reason why the prompt was blocked. This field is not supported in Gemini API.",
               "title": "Blockreasonmessage"
            },
            "safetyRatings": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/SafetyRating"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A list of safety ratings for the prompt. There is one rating per category.",
               "title": "Safetyratings"
            }
         },
         "title": "GenerateContentResponsePromptFeedback",
         "type": "object"
      },
      "GenerateContentResponseUsageMetadata": {
         "additionalProperties": false,
         "description": "Usage metadata about the content generation request and response.\n\nThis message provides a detailed breakdown of token usage and other relevant\nmetrics. This data type is not supported in Gemini API.",
         "properties": {
            "cacheTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown of the token count for each modality in the cached content.",
               "title": "Cachetokensdetails"
            },
            "cachedContentTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens in the cached content that was used for this request.",
               "title": "Cachedcontenttokencount"
            },
            "candidatesTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens in the generated candidates.",
               "title": "Candidatestokencount"
            },
            "candidatesTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown of the token count for each modality in the generated candidates.",
               "title": "Candidatestokensdetails"
            },
            "promptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When `cached_content` is set, this also 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. A detailed breakdown of the token count for each modality in the prompt.",
               "title": "Prompttokensdetails"
            },
            "thoughtsTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens that were part of the model's generated \"thoughts\" output, if applicable.",
               "title": "Thoughtstokencount"
            },
            "toolUsePromptTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.",
               "title": "Tooluseprompttokencount"
            },
            "toolUsePromptTokensDetails": {
               "anyOf": [
                  {
                     "items": {
                        "$ref": "#/$defs/ModalityTokenCount"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input.",
               "title": "Tooluseprompttokensdetails"
            },
            "totalTokenCount": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The total number of tokens for the entire request. This is the sum of `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`.",
               "title": "Totaltokencount"
            },
            "trafficType": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/TrafficType"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Output only. The traffic type for this request."
            }
         },
         "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. This\ndata type is not supported in Gemini API.",
         "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": {
            "maps": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMaps"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from Google Maps. This field is not supported in Gemini API."
            },
            "retrievedContext": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkRetrievedContext"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from context retrieved by the retrieval tools. This field is not supported in Gemini API."
            },
            "web": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkWeb"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Grounding chunk from the web."
            }
         },
         "title": "GroundingChunk",
         "type": "object"
      },
      "GroundingChunkMaps": {
         "additionalProperties": false,
         "description": "Chunk from Google Maps. This data type is not supported in Gemini API.",
         "properties": {
            "placeAnswerSources": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Sources used to generate the place answer. This includes review snippets and photos that were used to generate the answer, as well as uris to flag content."
            },
            "placeId": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place.",
               "title": "Placeid"
            },
            "text": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Text of the place answer.",
               "title": "Text"
            },
            "title": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Title of the place.",
               "title": "Title"
            },
            "uri": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "URI reference of the place.",
               "title": "Uri"
            }
         },
         "title": "GroundingChunkMaps",
         "type": "object"
      },
      "GroundingChunkMapsPlaceAnswerSources": {
         "additionalProperties": false,
         "description": "Sources used to generate the place answer.\n\nThis data type is not supported in Gemini API.",
         "properties": {
            "flagContentUri": {
               "anyOf":