Submodules¶
genai.client module¶
- class genai.client.AsyncClient(api_client)¶
Bases:
objectClient 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 models: AsyncModels¶
- property operations: AsyncOperations¶
- property tunings: AsyncTunings¶
- property webhooks: AsyncWebhooksResource¶
- class genai.client.AsyncGeminiNextGenAPIClientAdapter(api_client)¶
Bases:
AsyncGeminiNextGenAPIClientAdapterAdapter for the Gemini NextGen API Client.
- async async_get_auth_headers()¶
- Return type:
dict[str,str]
- get_location()¶
- Return type:
str|None
- get_project()¶
- Return type:
str|None
- is_vertex_ai()¶
- Return type:
bool
- class genai.client.Client(*, enterprise=None, vertexai=None, api_key=None, credentials=None, project=None, location=None, debug_config=None, http_options=None)¶
Bases:
objectClient for making synchronous requests.
Use this client to make a request to the Gemini Developer API or Gemini Enterprise Agent Platform (previously 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 api_key=”your-api-key” or by defining GOOGLE_API_KEY=”your-api-key” as an environment variable
Gemini Enterprise Agent Platform API users can provide inputs argument as enterprise=True, project=”your-project-id”, location=”us-central1” or by defining GOOGLE_GENAI_USE_ENTERPRISE=true, GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.
- enterprise¶
Indicates whether the client should use the Gemini Enterprise Agent Platform endpoints (previously Vertex AI API). Defaults to False (uses Gemini Developer API endpoints). When enterprise and vertexai are both set, and they have conflicting values, a ValueError will be raised.
- Type:
bool
- vertexai¶
Legacy flag for enterprise.
- Type:
bool
- credentials¶
The credentials to use for authentication when calling the Gemini Enterprise Agent Platform 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 Gemini Enterprise Agent Platform API:
from google import genai client = genai.Client( enterprise=True, project='my-project-id', location='us-central1' )
Initializes the client.
- Parameters:
enterprise (bool) – Indicates whether the client should use the Gemini Enterprise Agent Platform endpoints (previously Vertex AI API). Defaults to False (uses Gemini Developer API endpoints). When enterprise and vertexai are both set, and they have conflicting values, a ValueError will be raised.
vertexai (bool) – Legacy flag for enterprise.
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¶
- 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 interactions: InteractionsResource¶
- property operations: Operations¶
- property vertexai: bool¶
Returns whether the client is using the Vertex AI API.
- property webhooks: WebhooksResource¶
- pydantic model genai.client.DebugConfig¶
Bases:
BaseModelConfiguration 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" } } }
-
field client_mode:
Optional[str] [Optional]¶
-
field replay_id:
Optional[str] [Optional]¶
-
field replays_directory:
Optional[str] [Optional]¶
-
field client_mode:
- class genai.client.GeminiNextGenAPIClientAdapter(api_client)¶
Bases:
GeminiNextGenAPIClientAdapterAdapter for the Gemini NextGen API Client.
- get_auth_headers()¶
- Return type:
dict[str,str]
- get_location()¶
- Return type:
str|None
- get_project()¶
- Return type:
str|None
- is_vertex_ai()¶
- Return type:
bool
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:
- Parameters:
model (str) – The model to use for the batch job.
src – The source of the batch job. Currently Gemini Enterprise Agent Platform 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:
- 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:
- 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:
- 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 Gemini Enterprise Agent Platform 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:
- Parameters:
model (str) – The model to use for the batch job.
src – The source of the batch job. Currently Gemini Enterprise Agent Platform 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:
- 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:
- 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:
- 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 Gemini Enterprise Agent Platform 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:
- async delete(*, name, config=None)¶
Deletes cached content.
Usage:
await client.aio.caches.delete(name= ... ) // The server-generated resource name.
- Return type:
- async get(*, name, config=None)¶
Gets cached content configurations.
await client.aio.caches.get(name= ... ) // The server-generated resource name.
- Return type:
- 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:
- 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:
- delete(*, name, config=None)¶
Deletes cached content.
Usage:
client.caches.delete(name= ... ) // The server-generated resource name.
- Return type:
- get(*, name, config=None)¶
Gets cached content configurations.
client.caches.get(name= ... ) // The server-generated resource name.
- Return type:
- 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:
genai.chats module¶
- class genai.chats.AsyncChat(*, modules, model, config=None, history)¶
Bases:
_BaseChatAsync chat session.
- async send_message(message, config=None)¶
Sends the conversation history with the additional message and returns model’s response.
- Return type:
- 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:
objectA util class to create async chat sessions.
- class genai.chats.Chat(*, modules, model, config=None, history)¶
Bases:
_BaseChatChat session.
- send_message(message, config=None)¶
Sends the conversation history with the additional message and returns the model’s response.
- Return type:
- 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:
objectA util class to create chat sessions.
genai.file_search_stores module¶
- class genai.file_search_stores.AsyncFileSearchStores(api_client_)¶
Bases:
BaseModule- async create(*, config=None)¶
Creates a File Search Store.
- Return type:
- Parameters:
config (CreateFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
FileSearchStore
- async delete(*, name, config=None)¶
Deletes a FileSearchStore.
- Return type:
None- Parameters:
name (str) – The resource name of the FileSearchStore. Example: FileSearchStores/my-file-search-store-123
config (DeleteFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
None
- property documents: AsyncDocuments¶
- async download_media(*, media_id, config=None)¶
Downloads media using a Media ID.
- Return type:
bytes
- The media_id has the format:
fileSearchStores/<store>/media/<blob_id>
- This is mapped to the DownloadMedia RPC which expects:
GET /{name=fileSearchStores//media/}
- Parameters:
media_id – The Media ID from grounding metadata.
config – Optional configuration for the download.
- Returns:
The media data.
- Return type:
bytes
- async get(*, name, config=None)¶
Gets metadata about a FileSearchStore.
- Return type:
- Parameters:
name (str) – The resource name of the FileSearchStore. Example: FileSearchStores/my-file-search-store-123
config (GetFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
A FileSearchStore object containing the metadata.
- async import_file(*, file_search_store_name, file_name, config=None)¶
Imports a File from File Service to a FileSearchStore.
This is a long-running operation, see aip.dev/151
- Return type:
- Parameters:
file_search_store_name (str) – The resource name of the FileSearchStore. Example: fileSearchStores/my-file-search-store-123
file_name (str) – The resource name of the File to import. Example: files/abc-123
config (ImportFileConfig | None) – Optional parameters for the request.
- Returns:
ImportFileOperation.
- async list(*, config=None)¶
Lists FileSearchStores asynchronously.
- Return type:
AsyncPager[FileSearchStore]- Parameters:
config (ListFileSearchStoresConfig) – Optional parameters for the request, such as page_size.
- Returns:
A Pager object that contains one page of FileSearchStores. When iterating over the pager, it automatically fetches the next page if there are more.
Usage:
- async upload_to_file_search_store(*, file_search_store_name, file, config=None)¶
Calls the API to upload a file to the given file search store.
- Return type:
- Parameters:
file_search_store_name – The resource name of the FileSearchStore. Example: fileSearchStores/file-search-store-123
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 others.
- class genai.file_search_stores.FileSearchStores(api_client_)¶
Bases:
BaseModule- create(*, config=None)¶
Creates a File Search Store.
- Return type:
- Parameters:
config (CreateFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
FileSearchStore
- delete(*, name, config=None)¶
Deletes a FileSearchStore.
- Return type:
None- Parameters:
name (str) – The resource name of the FileSearchStore. Example: FileSearchStores/my-file-search-store-123
config (DeleteFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
None
- property documents: Documents¶
- download_media(*, media_id, config=None)¶
Downloads media using a Media ID.
- Return type:
bytes
- The media_id has the format:
fileSearchStores/<store>/media/<blob_id>
- This is mapped to the DownloadMedia RPC which expects:
GET /{name=fileSearchStores//media/}
- Parameters:
media_id – The Media ID from grounding metadata.
config – Optional configuration for the download.
- Returns:
The media data.
- Return type:
bytes
- get(*, name, config=None)¶
Gets metadata about a FileSearchStore.
- Return type:
- Parameters:
name (str) – The resource name of the FileSearchStore. Example: FileSearchStores/my-file-search-store-123
config (GetFileSearchStoreConfig | None) – Optional parameters for the request.
- Returns:
A FileSearchStore object containing the metadata.
- import_file(*, file_search_store_name, file_name, config=None)¶
Imports a File from File Service to a FileSearchStore.
This is a long-running operation, see aip.dev/151
- Return type:
- Parameters:
file_search_store_name (str) – The resource name of the FileSearchStore. Example: fileSearchStores/my-file-search-store-123
file_name (str) – The resource name of the File to import. Example: files/abc-123
config (ImportFileConfig | None) – Optional parameters for the request.
- Returns:
ImportFileOperation.
- list(*, config=None)¶
Lists FileSearchStores.
- Return type:
Pager[FileSearchStore]- Parameters:
config (ListFileSearchStoresConfig) – Optional configuration for the list request.
- Returns:
A Pager object that contains one page of file search stores. When iterating over the pager, it automatically fetches the next page if there are more.
Usage:
- upload_to_file_search_store(*, file_search_store_name, file, config=None)¶
Calls the API to upload a file to the given file search store.
- Return type:
- Parameters:
file_search_store_name – The resource name of the FileSearchStore. Example: fileSearchStores/file-search-store-123
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 others.
genai.files module¶
- class genai.files.AsyncFiles(api_client_)¶
Bases:
BaseModule- async delete(*, name, config=None)¶
Deletes a remotely stored file.
- Return type:
- 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:
Usage:
await client.aio.files.delete(name='files/...')
- async download(*, file, config=None)¶
Downloads a file’s data from the file service.
The Gemini Enterprise Agent Platform 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:
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:
- 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:
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:
- async upload(*, file, config=None)¶
Calls the API to upload a file asynchronously using a supported file service.
- Return type:
- 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:
- 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:
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:
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:
- 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:
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:
- upload(*, file, config=None)¶
Calls the API to upload a file using a supported file service.
- Return type:
- 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.interactions module¶
- class genai._interactions.resources.interactions.AsyncInteractionsResource(client)¶
Bases:
AsyncAPIResource- async cancel(id, *, api_version=None, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Cancels an interaction by id.
This only applies to background interactions that are still running.
- Return type:
Interaction- Parameters:
extra_headers – Send extra headers
extra_query – Add additional query parameters to the request
extra_body – Add additional JSON properties to the request
timeout – Override the client-level default timeout for this request, in seconds
- create(*, api_version=None, input, model=<google.genai._interactions.Omit object>, background=<google.genai._interactions.Omit object>, generation_config=<google.genai._interactions.Omit object>, previous_interaction_id=<google.genai._interactions.Omit object>, response_format=<google.genai._interactions.Omit object>, response_mime_type=<google.genai._interactions.Omit object>, response_modalities=<google.genai._interactions.Omit object>, service_tier=<google.genai._interactions.Omit object>, store=<google.genai._interactions.Omit object>, stream=<google.genai._interactions.Omit object>, system_instruction=<google.genai._interactions.Omit object>, tools=<google.genai._interactions.Omit object>, webhook_config=<google.genai._interactions.Omit object>, agent=<google.genai._interactions.Omit object>, agent_config=<google.genai._interactions.Omit object>, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
Union[Interaction,AsyncStream[Union[InteractionStartEvent,InteractionCompleteEvent,InteractionStatusUpdate,ContentStart,ContentDelta,ContentStop,ErrorEvent]]]
- async delete(id, *, api_version=None, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Deletes the interaction by id.
- Return type:
object- Parameters:
extra_headers – Send extra headers
extra_query – Add additional query parameters to the request
extra_body – Add additional JSON properties to the request
timeout – Override the client-level default timeout for this request, in seconds
- async get(id, *, api_version=None, include_input=<google.genai._interactions.Omit object>, last_event_id=<google.genai._interactions.Omit object>, stream=<google.genai._interactions.Omit object>, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
Union[Interaction,AsyncStream[Union[InteractionStartEvent,InteractionCompleteEvent,InteractionStatusUpdate,ContentStart,ContentDelta,ContentStop,ErrorEvent]]]
- property with_raw_response: AsyncInteractionsResourceWithRawResponse¶
This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.
For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers
- property with_streaming_response: AsyncInteractionsResourceWithStreamingResponse¶
An alternative to .with_raw_response that doesn’t eagerly read the response body.
For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response
- class genai._interactions.resources.interactions.InteractionsResource(client)¶
Bases:
SyncAPIResource- cancel(id, *, api_version=None, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Cancels an interaction by id.
This only applies to background interactions that are still running.
- Return type:
Interaction- Parameters:
extra_headers – Send extra headers
extra_query – Add additional query parameters to the request
extra_body – Add additional JSON properties to the request
timeout – Override the client-level default timeout for this request, in seconds
- create(*, api_version=None, input, model=<google.genai._interactions.Omit object>, background=<google.genai._interactions.Omit object>, generation_config=<google.genai._interactions.Omit object>, previous_interaction_id=<google.genai._interactions.Omit object>, response_format=<google.genai._interactions.Omit object>, response_mime_type=<google.genai._interactions.Omit object>, response_modalities=<google.genai._interactions.Omit object>, service_tier=<google.genai._interactions.Omit object>, store=<google.genai._interactions.Omit object>, stream=<google.genai._interactions.Omit object>, system_instruction=<google.genai._interactions.Omit object>, tools=<google.genai._interactions.Omit object>, webhook_config=<google.genai._interactions.Omit object>, agent=<google.genai._interactions.Omit object>, agent_config=<google.genai._interactions.Omit object>, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
Union[Interaction,Stream[Union[InteractionStartEvent,InteractionCompleteEvent,InteractionStatusUpdate,ContentStart,ContentDelta,ContentStop,ErrorEvent]]]
- delete(id, *, api_version=None, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Deletes the interaction by id.
- Return type:
object- Parameters:
extra_headers – Send extra headers
extra_query – Add additional query parameters to the request
extra_body – Add additional JSON properties to the request
timeout – Override the client-level default timeout for this request, in seconds
- get(id, *, api_version=None, include_input=<google.genai._interactions.Omit object>, last_event_id=<google.genai._interactions.Omit object>, stream=<google.genai._interactions.Omit object>, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
Union[Interaction,Stream[Union[InteractionStartEvent,InteractionCompleteEvent,InteractionStatusUpdate,ContentStart,ContentDelta,ContentStop,ErrorEvent]]]
- property with_raw_response: InteractionsResourceWithRawResponse¶
This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.
For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#accessing-raw-response-data-eg-headers
- property with_streaming_response: InteractionsResourceWithStreamingResponse¶
An alternative to .with_raw_response that doesn’t eagerly read the response body.
For more information, see https://www.github.com/stainless-sdks/gemini-next-gen-api-python#with_streaming_response
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, setup_complete=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_ENTERPRISE'): 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_ENTERPRISE'): 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_ENTERPRISE'): 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:
- 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:
- 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:
- async edit_image(*, model, prompt, reference_images, config=None)¶
Edits an image based on a text description and configuration.
- Return type:
- 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(location=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.
- Return type:
- 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 }, ) multimodal_embeddings = await client.aio.models.embed_content( model='gemini-embedding-2-preview', contents=[ types.Part.from_uri( file_uri='gs://generativeai-downloads/images/scones.jpg', mime_type='image/jpeg', ), ], 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:
- 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 Gemini Enterprise Agent Platform 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:
- 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:
- 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)
- 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.
There is one type of recontextualization currently supported: 1) Virtual Try-On: Generate images of persons modeling fashion products.
- Return type:
- 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 behind an allowlist. person_image is required. product_images is required. Only one product image is supported currently.
config (RecontextImageConfig) – Configuration for recontextualization.
Usage:
``` virtual_try_on_response = await client.aio.models.recontext_image(
model=”virtual-try-on-001”, source=types.RecontextImageSource(
person_image=types.Image.from_file(location=IMAGE1_FILE_PATH), product_images=[types.ProductImage(product_image=
types.Image.from_file(location=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:
- 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:
- async upscale_image(*, model, image, upscale_factor, config=None)¶
Makes an API request to upscale a provided image.
- Return type:
- 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(location=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:
- 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:
- 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:
- edit_image(*, model, prompt, reference_images, config=None)¶
Edits an image based on a text description and configuration.
- Return type:
- 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(location=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.
- Return type:
- 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 }, ) multimodal_embeddings = client.models.embed_content( model='gemini-embedding-2-preview', contents=[ types.Part.from_uri( file_uri='gs://generativeai-downloads/images/scones.jpg', mime_type='image/jpeg', ), ], 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 Gemini Enterprise Agent Platform 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:
- 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 Gemini Enterprise Agent Platform 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:
- 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:
- 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)
- 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.
There is one type of recontextualization currently supported: 1) Virtual Try-On: Generate images of persons modeling fashion products.
- Return type:
- 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 behind an allowlist. person_image is required. product_images is required. Only one product image is supported currently.
config (RecontextImageConfig) – Configuration for recontextualization.
Usage:
``` virtual_try_on_response = client.models.recontext_image(
model=”virtual-try-on-001”, source=types.RecontextImageSource(
person_image=types.Image.from_file(location=IMAGE1_FILE_PATH), product_images=[types.ProductImage(product_image=
types.Image.from_file(location=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:
- 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:
- upscale_image(*, model, image, upscale_factor, config=None)¶
Makes an API request to upscale a provided image.
- Return type:
- 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(location=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:
- 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:
- 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:
- Parameters:
name (str) – A TuningJob resource name.
- 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:
- class genai.tunings.Tunings(api_client_)¶
Bases:
BaseModule- cancel(*, name, config=None)¶
Cancels a tuning job.
- Return type:
- Parameters:
name (str) – TuningJob resource name.
genai.types module¶
- pydantic model genai.types.ActivityEnd¶
Bases:
BaseModelMarks 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:
TypedDictMarks 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:
CaseInSensitiveEnumThe 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:
BaseModelMarks 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:
TypedDictMarks 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:
CaseInSensitiveEnumAdapter 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.
- class genai.types.AggregationMetric(*values)¶
Bases:
CaseInSensitiveEnumAggregation metric. This enum is not supported in Gemini API.
- AGGREGATION_METRIC_UNSPECIFIED = 'AGGREGATION_METRIC_UNSPECIFIED'¶
Unspecified aggregation metric.
- AVERAGE = 'AVERAGE'¶
Average aggregation metric. Not supported for Pairwise metric.
- MAXIMUM = 'MAXIMUM'¶
Maximum aggregation metric. Not supported for pairwise metric.
- MEDIAN = 'MEDIAN'¶
Median aggregation metric. Not supported for pairwise metric.
- MINIMUM = 'MINIMUM'¶
Minimum aggregation metric. Not supported for pairwise metric.
- MODE = 'MODE'¶
Mode aggregation metric.
- PERCENTILE_P90 = 'PERCENTILE_P90'¶
90th percentile aggregation metric. Not supported for pairwise metric.
- PERCENTILE_P95 = 'PERCENTILE_P95'¶
95th percentile aggregation metric. Not supported for pairwise metric.
- PERCENTILE_P99 = 'PERCENTILE_P99'¶
99th percentile aggregation metric. Not supported for pairwise metric.
- STANDARD_DEVIATION = 'STANDARD_DEVIATION'¶
Standard deviation aggregation metric. Not supported for pairwise metric.
- VARIANCE = 'VARIANCE'¶
Variance aggregation metric. Not supported for pairwise metric.
- pydantic model genai.types.AggregationOutput¶
Bases:
BaseModelThe aggregation result for the entire dataset and all metrics.
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": "AggregationOutput", "description": "The aggregation result for the entire dataset and all metrics.\n\nThis data type is not supported in Gemini API.", "type": "object", "properties": { "aggregationResults": { "anyOf": [ { "items": { "$ref": "#/$defs/AggregationResult" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "One AggregationResult per metric.", "title": "Aggregationresults" }, "dataset": { "anyOf": [ { "$ref": "#/$defs/EvaluationDataset" }, { "type": "null" } ], "default": null, "description": "The dataset used for evaluation & aggregation." } }, "$defs": { "AggregationMetric": { "description": "Aggregation metric. This enum is not supported in Gemini API.", "enum": [ "AGGREGATION_METRIC_UNSPECIFIED", "AVERAGE", "MODE", "STANDARD_DEVIATION", "VARIANCE", "MINIMUM", "MAXIMUM", "MEDIAN", "PERCENTILE_P90", "PERCENTILE_P95", "PERCENTILE_P99" ], "title": "AggregationMetric", "type": "string" }, "AggregationResult": { "additionalProperties": false, "description": "The aggregation result for a single metric.\n\nThis data type is not supported in Gemini API.", "properties": { "aggregationMetric": { "anyOf": [ { "$ref": "#/$defs/AggregationMetric" }, { "type": "null" } ], "default": null, "description": "Aggregation metric." }, "bleuMetricValue": { "anyOf": [ { "$ref": "#/$defs/BleuMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for bleu metric." }, "customCodeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CustomCodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Result for code execution metric." }, "exactMatchMetricValue": { "anyOf": [ { "$ref": "#/$defs/ExactMatchMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for exact match metric." }, "pairwiseMetricResult": { "anyOf": [ { "$ref": "#/$defs/PairwiseMetricResult" }, { "type": "null" } ], "default": null, "description": "Result for pairwise metric." }, "pointwiseMetricResult": { "anyOf": [ { "$ref": "#/$defs/PointwiseMetricResult" }, { "type": "null" } ], "default": null, "description": "Result for pointwise metric." }, "rougeMetricValue": { "anyOf": [ { "$ref": "#/$defs/RougeMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for rouge metric." } }, "title": "AggregationResult", "type": "object" }, "BigQuerySource": { "additionalProperties": false, "description": "The BigQuery location for the input content.\n\nThis data type is not supported in Gemini API.", "properties": { "inputUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. For example: `bq://projectId.bqDatasetId.bqTableId`.", "title": "Inputuri" } }, "title": "BigQuerySource", "type": "object" }, "BleuMetricValue": { "additionalProperties": false, "description": "Bleu metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Bleu score.", "title": "Score" } }, "title": "BleuMetricValue", "type": "object" }, "CustomCodeExecutionResult": { "additionalProperties": false, "description": "Result for custom code execution metric.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Custom code execution score.", "title": "Score" } }, "title": "CustomCodeExecutionResult", "type": "object" }, "CustomOutput": { "additionalProperties": false, "description": "Spec for custom output. This data type is not supported in Gemini API.", "properties": { "rawOutputs": { "anyOf": [ { "$ref": "#/$defs/RawOutput" }, { "type": "null" } ], "default": null, "description": "Output only. List of raw output strings." } }, "title": "CustomOutput", "type": "object" }, "EvaluationDataset": { "additionalProperties": false, "description": "The dataset used for evaluation.\n\nThis data type is not supported in Gemini API.", "properties": { "bigquerySource": { "anyOf": [ { "$ref": "#/$defs/BigQuerySource" }, { "type": "null" } ], "default": null, "description": "BigQuery source holds the dataset." }, "gcsSource": { "anyOf": [ { "$ref": "#/$defs/GcsSource" }, { "type": "null" } ], "default": null, "description": "Cloud storage source holds the dataset. Currently only one Cloud Storage file path is supported." } }, "title": "EvaluationDataset", "type": "object" }, "ExactMatchMetricValue": { "additionalProperties": false, "description": "Exact match metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Exact match score.", "title": "Score" } }, "title": "ExactMatchMetricValue", "type": "object" }, "GcsSource": { "additionalProperties": false, "description": "The Google Cloud Storage location for the input content.\n\nThis data type is not supported in Gemini API.", "properties": { "uris": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards.", "title": "Uris" } }, "title": "GcsSource", "type": "object" }, "PairwiseChoice": { "description": "Output only.\n\nPairwise metric choice. This enum is not supported in Gemini API.", "enum": [ "PAIRWISE_CHOICE_UNSPECIFIED", "BASELINE", "CANDIDATE", "TIE" ], "title": "PairwiseChoice", "type": "string" }, "PairwiseMetricResult": { "additionalProperties": false, "description": "Spec for pairwise metric result.\n\nThis data type is not supported in Gemini API.", "properties": { "customOutput": { "anyOf": [ { "$ref": "#/$defs/CustomOutput" }, { "type": "null" } ], "default": null, "description": "Output only. Spec for custom output." }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. Explanation for pairwise metric score.", "title": "Explanation" }, "pairwiseChoice": { "anyOf": [ { "$ref": "#/$defs/PairwiseChoice" }, { "type": "null" } ], "default": null, "description": "Output only. Pairwise metric choice." } }, "title": "PairwiseMetricResult", "type": "object" }, "PointwiseMetricResult": { "additionalProperties": false, "description": "Spec for pointwise metric result.\n\nThis data type is not supported in Gemini API.", "properties": { "customOutput": { "anyOf": [ { "$ref": "#/$defs/CustomOutput" }, { "type": "null" } ], "default": null, "description": "Output only. Spec for custom output." }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. Explanation for pointwise metric score.", "title": "Explanation" }, "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Pointwise metric score.", "title": "Score" } }, "title": "PointwiseMetricResult", "type": "object" }, "RawOutput": { "additionalProperties": false, "description": "Raw output. This data type is not supported in Gemini API.", "properties": { "rawOutput": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. Raw output string.", "title": "Rawoutput" } }, "title": "RawOutput", "type": "object" }, "RougeMetricValue": { "additionalProperties": false, "description": "Rouge metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Rouge score.", "title": "Score" } }, "title": "RougeMetricValue", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field aggregation_results:
Optional[list[AggregationResult]] = None (alias 'aggregationResults')¶ One AggregationResult per metric.
- Validated by:
_check_field_type_mismatches
-
field dataset:
Optional[EvaluationDataset] = None¶ The dataset used for evaluation & aggregation.
- Validated by:
_check_field_type_mismatches
- class genai.types.AggregationOutputDict¶
Bases:
TypedDictThe aggregation result for the entire dataset and all metrics.
This data type is not supported in Gemini API.
-
aggregation_results:
Optional[list[AggregationResultDict]]¶ One AggregationResult per metric.
-
dataset:
Optional[EvaluationDatasetDict]¶ The dataset used for evaluation & aggregation.
-
aggregation_results:
- pydantic model genai.types.AggregationResult¶
Bases:
BaseModelThe aggregation result for a single metric.
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": "AggregationResult", "description": "The aggregation result for a single metric.\n\nThis data type is not supported in Gemini API.", "type": "object", "properties": { "aggregationMetric": { "anyOf": [ { "$ref": "#/$defs/AggregationMetric" }, { "type": "null" } ], "default": null, "description": "Aggregation metric." }, "bleuMetricValue": { "anyOf": [ { "$ref": "#/$defs/BleuMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for bleu metric." }, "customCodeExecutionResult": { "anyOf": [ { "$ref": "#/$defs/CustomCodeExecutionResult" }, { "type": "null" } ], "default": null, "description": "Result for code execution metric." }, "exactMatchMetricValue": { "anyOf": [ { "$ref": "#/$defs/ExactMatchMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for exact match metric." }, "pairwiseMetricResult": { "anyOf": [ { "$ref": "#/$defs/PairwiseMetricResult" }, { "type": "null" } ], "default": null, "description": "Result for pairwise metric." }, "pointwiseMetricResult": { "anyOf": [ { "$ref": "#/$defs/PointwiseMetricResult" }, { "type": "null" } ], "default": null, "description": "Result for pointwise metric." }, "rougeMetricValue": { "anyOf": [ { "$ref": "#/$defs/RougeMetricValue" }, { "type": "null" } ], "default": null, "description": "Results for rouge metric." } }, "$defs": { "AggregationMetric": { "description": "Aggregation metric. This enum is not supported in Gemini API.", "enum": [ "AGGREGATION_METRIC_UNSPECIFIED", "AVERAGE", "MODE", "STANDARD_DEVIATION", "VARIANCE", "MINIMUM", "MAXIMUM", "MEDIAN", "PERCENTILE_P90", "PERCENTILE_P95", "PERCENTILE_P99" ], "title": "AggregationMetric", "type": "string" }, "BleuMetricValue": { "additionalProperties": false, "description": "Bleu metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Bleu score.", "title": "Score" } }, "title": "BleuMetricValue", "type": "object" }, "CustomCodeExecutionResult": { "additionalProperties": false, "description": "Result for custom code execution metric.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Custom code execution score.", "title": "Score" } }, "title": "CustomCodeExecutionResult", "type": "object" }, "CustomOutput": { "additionalProperties": false, "description": "Spec for custom output. This data type is not supported in Gemini API.", "properties": { "rawOutputs": { "anyOf": [ { "$ref": "#/$defs/RawOutput" }, { "type": "null" } ], "default": null, "description": "Output only. List of raw output strings." } }, "title": "CustomOutput", "type": "object" }, "ExactMatchMetricValue": { "additionalProperties": false, "description": "Exact match metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Exact match score.", "title": "Score" } }, "title": "ExactMatchMetricValue", "type": "object" }, "PairwiseChoice": { "description": "Output only.\n\nPairwise metric choice. This enum is not supported in Gemini API.", "enum": [ "PAIRWISE_CHOICE_UNSPECIFIED", "BASELINE", "CANDIDATE", "TIE" ], "title": "PairwiseChoice", "type": "string" }, "PairwiseMetricResult": { "additionalProperties": false, "description": "Spec for pairwise metric result.\n\nThis data type is not supported in Gemini API.", "properties": { "customOutput": { "anyOf": [ { "$ref": "#/$defs/CustomOutput" }, { "type": "null" } ], "default": null, "description": "Output only. Spec for custom output." }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. Explanation for pairwise metric score.", "title": "Explanation" }, "pairwiseChoice": { "anyOf": [ { "$ref": "#/$defs/PairwiseChoice" }, { "type": "null" } ], "default": null, "description": "Output only. Pairwise metric choice." } }, "title": "PairwiseMetricResult", "type": "object" }, "PointwiseMetricResult": { "additionalProperties": false, "description": "Spec for pointwise metric result.\n\nThis data type is not supported in Gemini API.", "properties": { "customOutput": { "anyOf": [ { "$ref": "#/$defs/CustomOutput" }, { "type": "null" } ], "default": null, "description": "Output only. Spec for custom output." }, "explanation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. Explanation for pointwise metric score.", "title": "Explanation" }, "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Pointwise metric score.", "title": "Score" } }, "title": "PointwiseMetricResult", "type": "object" }, "RawOutput": { "additionalProperties": false, "description": "Raw output. This data type is not supported in Gemini API.", "properties": { "rawOutput": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. Raw output string.", "title": "Rawoutput" } }, "title": "RawOutput", "type": "object" }, "RougeMetricValue": { "additionalProperties": false, "description": "Rouge metric value for an instance.\n\nThis data type is not supported in Gemini API.", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Rouge score.", "title": "Score" } }, "title": "RougeMetricValue", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field aggregation_metric:
Optional[AggregationMetric] = None (alias 'aggregationMetric')¶ Aggregation metric.
- Validated by:
_check_field_type_mismatches
-
field bleu_metric_value:
Optional[BleuMetricValue] = None (alias 'bleuMetricValue')¶ Results for bleu metric.
- Validated by:
_check_field_type_mismatches
-
field custom_code_execution_result:
Optional[CustomCodeExecutionResult] = None (alias 'customCodeExecutionResult')¶ Result for code execution metric.
- Validated by:
_check_field_type_mismatches
-
field exact_match_metric_value:
Optional[ExactMatchMetricValue] = None (alias 'exactMatchMetricValue')¶ Results for exact match metric.
- Validated by:
_check_field_type_mismatches
-
field pairwise_metric_result:
Optional[PairwiseMetricResult] = None (alias 'pairwiseMetricResult')¶ Result for pairwise metric.
- Validated by:
_check_field_type_mismatches
-
field pointwise_metric_result:
Optional[PointwiseMetricResult] = None (alias 'pointwiseMetricResult')¶ Result for pointwise metric.
- Validated by:
_check_field_type_mismatches
-
field rouge_metric_value:
Optional[RougeMetricValue] = None (alias 'rougeMetricValue')¶ Results for rouge metric.
- Validated by:
_check_field_type_mismatches
- class genai.types.AggregationResultDict¶
Bases:
TypedDictThe aggregation result for a single metric.
This data type is not supported in Gemini API.
-
aggregation_metric:
Optional[AggregationMetric]¶ Aggregation metric.
-
bleu_metric_value:
Optional[BleuMetricValueDict]¶ Results for bleu metric.
-
custom_code_execution_result:
Optional[CustomCodeExecutionResultDict]¶ Result for code execution metric.
-
exact_match_metric_value:
Optional[ExactMatchMetricValueDict]¶ Results for exact match metric.
-
pairwise_metric_result:
Optional[PairwiseMetricResultDict]¶ Result for pairwise metric.
-
pointwise_metric_result:
Optional[PointwiseMetricResultDict]¶ Result for pointwise metric.
-
rouge_metric_value:
Optional[RougeMetricValueDict]¶ Results for rouge metric.
-
aggregation_metric:
- pydantic model genai.types.ApiAuth¶
Bases:
BaseModelThe 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:
BaseModelThe 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:
TypedDictThe 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.
-
api_key_secret_version:
- class genai.types.ApiAuthDict¶
Bases:
TypedDictThe 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.
-
api_key_config:
- pydantic model genai.types.ApiKeyConfig¶
Bases:
BaseModelConfig 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:
TypedDictConfig 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
-
api_key_secret:
- class genai.types.ApiSpec(*values)¶
Bases:
CaseInSensitiveEnumThe 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 = 'ELASTIC_SEARCH'¶
Elastic search API spec.
- SIMPLE_SEARCH = 'SIMPLE_SEARCH'¶
Simple search API spec.
- pydantic model genai.types.AudioChunk¶
Bases:
BaseModelRepresentation 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:
TypedDictRepresentation 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.
-
data:
- pydantic model genai.types.AudioTranscriptionConfig¶
Bases:
BaseModelThe 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": { "languageCodes": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The language codes of the audio. BCP-47 language code. If not set, the transcription will be in the language detected by the model. If set, the server will use the language code specified in the model config as a hint for the language of the audio\n ", "title": "Languagecodes" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field language_codes:
Optional[list[str]] = None (alias 'languageCodes')¶ The language codes of the audio. BCP-47 language code. If not set, the transcription will be in the language detected by the model. If set, the server will use the language code specified in the model config as a hint for the language of the audio
- Validated by:
_check_field_type_mismatches
- class genai.types.AudioTranscriptionConfigDict¶
Bases:
TypedDictThe audio transcription configuration in Setup.
-
language_codes:
Optional[list[str]]¶ The language codes of the audio. BCP-47 language code. If not set, the transcription will be in the language detected by the model. If set, the server will use the language code specified in the model config as a hint for the language of the audio
-
language_codes:
- pydantic model genai.types.AuthConfig¶
Bases:
BaseModelThe authentication config to access the 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": "The authentication config to access the API.", "type": "object", "properties": { "apiKey": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API.", "title": "Apikey" }, "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:
Optional[str] = None (alias 'apiKey')¶ The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
-
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:
TypedDictThe authentication config to access the API.
-
api_key:
Optional[str]¶ The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API.
-
api_key_config:
Optional[ApiKeyConfigDict]¶ Config for API key auth.
-
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.
-
api_key:
- pydantic model genai.types.AuthConfigGoogleServiceAccountConfig¶
Bases:
BaseModelConfig 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:
TypedDictConfig 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
-
service_account:
- pydantic model genai.types.AuthConfigHttpBasicAuthConfig¶
Bases:
BaseModelConfig 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:
TypedDictConfig 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
-
credential_secret:
- pydantic model genai.types.AuthConfigOauthConfig¶
Bases:
BaseModelConfig 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:
TypedDictConfig 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
-
access_token:
- pydantic model genai.types.AuthConfigOidcConfig¶
Bases:
BaseModelConfig 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:
TypedDictConfig 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
-
id_token:
- pydantic model genai.types.AuthToken¶
Bases:
BaseModelConfig 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:
TypedDictConfig for auth_tokens.create parameters.
-
name:
Optional[str]¶ The name of the auth token.
-
name:
- class genai.types.AuthType(*values)¶
Bases:
CaseInSensitiveEnumType 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:
BaseModelConfigures 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:
TypedDictConfigures 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.
-
disabled:
- pydantic model genai.types.AutomaticFunctionCallingConfig¶
Bases:
BaseModelThe 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:
TypedDictThe 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.
-
disable:
- pydantic model genai.types.AutoraterConfig¶
Bases:
BaseModelAutorater 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 timestamps will be included in the request to the model. This can be useful for synchronizing audio with other modalities in the response. This field is not supported in Gemini API.", "title": "Audiotimestamp" }, "candidateCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. The number of candidate responses to generate. A higher `candidate_count` can provide more options to choose from, but it also consumes more resources. This can be useful for generating a variety of responses and selecting the best one.", "title": "Candidatecount" }, "enableAffectiveDialog": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. If enabled, the model will detect emotions and adapt its responses accordingly. For example, if the model detects that the user is frustrated, it may provide a more empathetic response. This field is not supported in Gemini API.", "title": "Enableaffectivedialog" }, "frequencyPenalty": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Penalizes tokens based on their frequency in the generated text. A positive value helps to reduce the repetition of words and phrases. Valid values can range from [-2.0, 2.0].", "title": "Frequencypenalty" }, "logprobs": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. The number of top log probabilities to return for each token. This can be used to see which other tokens were considered likely candidates for a given position. A higher value will return more options, but it will also increase the size of the response.", "title": "Logprobs" }, "maxOutputTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. The maximum number of tokens to generate in the response. A token is approximately four characters. The default value varies by model. This parameter can be used to control the length of the generated text and prevent overly long responses.", "title": "Maxoutputtokens" }, "mediaResolution": { "anyOf": [ { "$ref": "#/$defs/MediaResolution" }, { "type": "null" } ], "default": null, "description": "Optional. The token resolution at which input media content is sampled. This is used to control the trade-off between the quality of the response and the number of tokens used to represent the media. A higher resolution allows the model to perceive more detail, which can lead to a more nuanced response, but it will also use more tokens. This does not affect the image dimensions sent to the model." }, "presencePenalty": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Penalizes tokens that have already appeared in the generated text. A positive value encourages the model to generate more diverse and less repetitive text. Valid values can range from [-2.0, 2.0].", "title": "Presencepenalty" }, "responseLogprobs": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. If set to true, the log probabilities of the output tokens are returned. Log probabilities are the logarithm of the probability of a token appearing in the output. A higher log probability means the token is more likely to be generated. This can be useful for analyzing the model's confidence in its own output and for debugging.", "title": "Responselogprobs" }, "responseMimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. 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. The model will generate a response that includes all the specified modalities. For example, if this is set to `[TEXT, IMAGE]`, the response will include both text and an image.", "title": "Responsemodalities" }, "responseSchema": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. Lets you to specify a schema for the model's response, ensuring that the output conforms to a particular structure. This is useful for generating structured data such as JSON. The schema is a subset of the [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must also set the `response_mime_type` to `application/json`." }, "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. A seed for the random number generator. By setting a seed, you can make the model's output mostly deterministic. For a given prompt and parameters (like temperature, top_p, etc.), the model will produce the same response every time. However, it's not a guaranteed absolute deterministic behavior. This is different from parameters like `temperature`, which control the *level* of randomness. `seed` ensures that the \"random\" choices the model makes are the same on every run, making it essential for testing and ensuring reproducible results.", "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. A list of character sequences that will stop the model from generating further tokens. If a stop sequence is generated, the output will end at that point. This is useful for controlling the length and structure of the output. For example, you can use [\"\n\", \"###\"] to stop generation at a new line or a specific marker.", "title": "Stopsequences" }, "temperature": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Controls the randomness of the output. A higher temperature results in more creative and diverse responses, while a lower temperature makes the output more predictable and focused. The valid range is (0.0, 2.0].", "title": "Temperature" }, "thinkingConfig": { "anyOf": [ { "$ref": "#/$defs/ThinkingConfig" }, { "type": "null" } ], "default": null, "description": "Optional. Configuration 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. Specifies the top-k sampling threshold. The model considers only the top k most probable tokens for the next token. This can be useful for generating more coherent and less random text. For example, a `top_k` of 40 means the model will choose the next word from the 40 most likely words.", "title": "Topk" }, "topP": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Specifies the nucleus sampling threshold. The model considers only the smallest set of tokens whose cumulative probability is at least `top_p`. This helps generate more diverse and less repetitive responses. For example, a `top_p` of 0.9 means the model considers tokens until the cumulative probability of the tokens to select from reaches 0.9. It's recommended to adjust either temperature or `top_p`, but not both.", "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 can be used to control which model is used for the generation, either\nautomatically or by specifying a model name. This data type is not supported\nin Gemini API.", "properties": { "autoMode": { "anyOf": [ { "$ref": "#/$defs/GenerationConfigRoutingConfigAutoRoutingMode" }, { "type": "null" } ], "default": null, "description": "In this mode, the model is selected automatically based on the content of the request." }, "manualMode": { "anyOf": [ { "$ref": "#/$defs/GenerationConfigRoutingConfigManualRoutingMode" }, { "type": "null" } ], "default": null, "description": "In this mode, the model is specified manually." } }, "title": "GenerationConfigRoutingConfig", "type": "object" }, "GenerationConfigRoutingConfigAutoRoutingMode": { "additionalProperties": false, "description": "The configuration for automated routing.\n\nWhen automated routing is specified, the routing will be determined by the\npretrained routing model and customer provided model routing preference. This\ndata 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": "The configuration for manual routing.\n\nWhen manual routing is specified, the model will be selected based on the\nmodel name provided. This data type is not supported in Gemini API.", "properties": { "modelName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the model to use. Only public LLM models are accepted.", "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", "VIDEO" ], "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": "Configuration for a prebuilt voice.", "properties": { "voiceName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the prebuilt voice to use.", "title": "Voicename" } }, "title": "PrebuiltVoiceConfig", "type": "object" }, "ReplicatedVoiceConfig": { "additionalProperties": false, "description": "The configuration for the replicated voice to use.", "properties": { "mimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The mimetype of the voice sample. The only currently supported\n value is `audio/wav`. This represents 16-bit signed little-endian wav\n data, with a 24kHz sampling rate.\n ", "title": "Mimetype" }, "voiceSampleAudio": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "The sample of the custom voice.\n ", "title": "Voicesampleaudio" }, "consentAudio": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Recorded consent verifying ownership of the voice. This\n represents 16-bit signed little-endian wav data, with a 24kHz sampling\n rate.", "title": "Consentaudio" }, "voiceConsentSignature": { "anyOf": [ { "$ref": "#/$defs/VoiceConsentSignature" }, { "type": "null" } ], "default": null, "description": "Signature of a previously verified consent audio. This should be\n populated with a signature generated by the server for a previous\n request containing the consent_audio field. When provided, the\n signature is verified instead of the consent_audio field to reduce\n latency. Requests will fail if the signature is invalid or expired." } }, "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 instance must be valid against any (one or more) of the subschemas listed in `any_of`.", "title": "Anyof" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Default value to use if the field is not specified.", "title": "Default" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Describes the data. The model uses this field to understand the purpose of the schema and how to use it. It is a best practice to provide a clear and descriptive explanation for the schema and its properties here, rather than in the prompt.", "title": "Description" }, "enum": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Possible values of the field. This field can be used to restrict a value to a fixed set of values. To mark a field as an enum, set `format` to `enum` and provide the list of possible values in `enum`. For example: 1. To define directions: `{type:STRING, format:enum, enum:[\"EAST\", \"NORTH\", \"SOUTH\", \"WEST\"]}` 2. To define apartment numbers: `{type:INTEGER, format:enum, enum:[\"101\", \"201\", \"301\"]}`", "title": "Enum" }, "example": { "anyOf": [ {}, { "type": "null" } ], "default": null, "description": "Optional. Example of an instance of this schema.", "title": "Example" }, "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The format of the data. For `NUMBER` type, format can be `float` or `double`. For `INTEGER` type, format can be `int32` or `int64`. For `STRING` type, format can be `email`, `byte`, `date`, `date-time`, `password`, and other formats to further refine the data type.", "title": "Format" }, "items": { "anyOf": [ { "$ref": "#/$defs/Schema" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `items` specifies the schema of elements in the array." }, "maxItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `max_items` specifies the maximum number of items in an array.", "title": "Maxitems" }, "maxLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `max_length` specifies the maximum length of the string.", "title": "Maxlength" }, "maxProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `max_properties` specifies the maximum number of properties that can be provided.", "title": "Maxproperties" }, "maximum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `maximum` specifies the maximum allowed value.", "title": "Maximum" }, "minItems": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `ARRAY`, `min_items` specifies the minimum number of items in an array.", "title": "Minitems" }, "minLength": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `min_length` specifies the minimum length of the string.", "title": "Minlength" }, "minProperties": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `min_properties` specifies the minimum number of properties that can be provided.", "title": "Minproperties" }, "minimum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `INTEGER` or `NUMBER`, `minimum` specifies the minimum allowed value.", "title": "Minimum" }, "nullable": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates if the value of this field can be null.", "title": "Nullable" }, "pattern": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `STRING`, `pattern` specifies a regular expression that the string must match.", "title": "Pattern" }, "properties": { "anyOf": [ { "additionalProperties": { "$ref": "#/$defs/Schema" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `properties` is a map of property names to schema definitions for each property of the object.", "title": "Properties" }, "propertyOrdering": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Order of properties displayed or used where order matters. This is not a standard field in OpenAPI specification, but can be used to control the order of properties.", "title": "Propertyordering" }, "required": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. If type is `OBJECT`, `required` lists the names of properties that must be present.", "title": "Required" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Title for the schema.", "title": "Title" }, "type": { "anyOf": [ { "$ref": "#/$defs/Type" }, { "type": "null" } ], "default": null, "description": "Optional. Data type of the schema field." } }, "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, "description": "Config for speech generation and transcription.", "properties": { "voiceConfig": { "anyOf": [ { "$ref": "#/$defs/VoiceConfig" }, { "type": "null" } ], "default": null, "description": "The configuration in case of single-voice output." }, "languageCode": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The language code (ISO 639-1) for the speech synthesis.", "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", "MINIMAL", "LOW", "MEDIUM", "HIGH" ], "title": "ThinkingLevel", "type": "string" }, "Type": { "description": "Data type of the schema field.", "enum": [ "TYPE_UNSPECIFIED", "STRING", "NUMBER", "INTEGER", "BOOLEAN", "ARRAY", "OBJECT", "NULL" ], "title": "Type", "type": "string" }, "VoiceConfig": { "additionalProperties": false, "description": "The configuration for the voice to use.", "properties": { "replicatedVoiceConfig": { "anyOf": [ { "$ref": "#/$defs/ReplicatedVoiceConfig" }, { "type": "null" } ], "default": null, "description": "The configuration for a replicated voice, which is a clone of a\n user's voice that can be used for speech synthesis. If this is unset, a\n default voice is used." }, "prebuiltVoiceConfig": { "anyOf": [ { "$ref": "#/$defs/PrebuiltVoiceConfig" }, { "type": "null" } ], "default": null, "description": "The configuration for a prebuilt voice." } }, "title": "VoiceConfig", "type": "object" }, "VoiceConsentSignature": { "additionalProperties": false, "description": "The signature of the voice consent check.", "properties": { "signature": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The signature string.\n ", "title": "Signature" } }, "title": "VoiceConsentSignature", "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:
TypedDictAutorater 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.
-
autorater_model:
- pydantic model genai.types.AvatarConfig¶
Bases:
BaseModelConfigures the avatar to be used in the session.
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": "AvatarConfig", "description": "Configures the avatar to be used in the session.", "type": "object", "properties": { "avatarName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Pre-built avatar id.", "title": "Avatarname" }, "customizedAvatar": { "anyOf": [ { "$ref": "#/$defs/CustomizedAvatar" }, { "type": "null" } ], "default": null, "description": "Customized avatar appearance with a reference image." }, "audioBitrateBps": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The bitrate of compressed audio.", "title": "Audiobitratebps" }, "videoBitrateBps": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The bitrate of compressed video output.", "title": "Videobitratebps" } }, "$defs": { "CustomizedAvatar": { "additionalProperties": false, "description": "Configures the customized avatar to be used in the session.", "properties": { "imageMimeType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The mime type of the reference image, e.g., \"image/jpeg\".", "title": "Imagemimetype" }, "imageData": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "The data of the reference image. The dimensions of the reference\n image should be 9:16 (portrait) with a minimum resolution of 704x1280.", "title": "Imagedata" } }, "title": "CustomizedAvatar", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field audio_bitrate_bps:
Optional[int] = None (alias 'audioBitrateBps')¶ The bitrate of compressed audio.
- Validated by:
_check_field_type_mismatches
-
field avatar_name:
Optional[str] = None (alias 'avatarName')¶ Pre-built avatar id.
- Validated by:
_check_field_type_mismatches
-
field customized_avatar:
Optional[CustomizedAvatar] = None (alias 'customizedAvatar')¶ Customized avatar appearance with a reference image.
- Validated by:
_check_field_type_mismatches
-
field video_bitrate_bps:
Optional[int] = None (alias 'videoBitrateBps')¶ The bitrate of compressed video output.
- Validated by:
_check_field_type_mismatches
- class genai.types.AvatarConfigDict¶
Bases:
TypedDictConfigures the avatar to be used in the session.
-
audio_bitrate_bps:
Optional[int]¶ The bitrate of compressed audio.
-
avatar_name:
Optional[str]¶ Pre-built avatar id.
-
customized_avatar:
Optional[CustomizedAvatarDict]¶ Customized avatar appearance with a reference image.
-
video_bitrate_bps:
Optional[int]¶ The bitrate of compressed video output.
-
audio_bitrate_bps:
- pydantic model genai.types.BatchJob¶
Bases:
BaseModelConfig 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 Gemini Enterprise Agent Platform 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 Gemini Enterprise Agent Platform only.\n " }, "outputInfo": { "anyOf": [ { "$ref": "#/$defs/BatchJobOutputInfo" }, { "type": "null" } ], "default": null, "description": "Information further describing the output of this job. Output 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', 'vertex-dataset'.\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" }, "vertexDataset": { "anyOf": [ { "$ref": "#/$defs/VertexMultimodalDatasetDestination" }, { "type": "null" } ], "default": null, "description": "This field is experimental and may change in future versions. The Vertex AI dataset destination.\n " } }, "title": "BatchJobDestination", "type": "object" }, "BatchJobOutputInfo": { "additionalProperties": false, "description": "Represents the `output_info` field in batch jobs.", "properties": { "vertexMultimodalDatasetName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data.", "title": "Vertexmultimodaldatasetname" }, "gcsOutputDirectory": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The full path of the Cloud Storage directory created, into which the prediction output is written.", "title": "Gcsoutputdirectory" }, "bigqueryOutputTable": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the BigQuery table created, in `predictions_<timestamp>` format, into which the prediction output is written.", "title": "Bigqueryoutputtable" } }, "title": "BatchJobOutputInfo", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The 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 used in the Gemini 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 " }, "groundingMetadata": { "anyOf": [ { "$ref": "#/$defs/GroundingMetadata" }, { "type": "null" } ], "default": null, "description": "Output only. Metadata returned when grounding is enabled. It\n contains the sources used to ground the generated content.\n " }, "avgLogprobs": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.", "title": "Avglogprobs" }, "index": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when `candidate_count` > 1.", "title": "Index" }, "logprobsResult": { "anyOf": [ { "$ref": "#/$defs/LogprobsResult" }, { "type": "null" } ], "default": null, "description": "Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential \"hallucinations\"." }, "safetyRatings": { "anyOf": [ { "items": { "$ref": "#/$defs/SafetyRating" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A 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 returned when the model uses the `url_context` tool to get information from a user-provided URL." } }, "title": "Candidate", "type": "object" }, "Citation": { "additionalProperties": false, "description": "A citation for a piece of generatedcontent.\n\nThis data type is not supported in Gemini API.", "properties": { "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The end index of the citation in the content.", "title": "Endindex" }, "license": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The license of the source of the citation.", "title": "License" }, "publicationDate": { "anyOf": [ { "$ref": "#/$defs/GoogleTypeDate" }, { "type": "null" } ], "default": null, "description": "Output only. The publication date of the source of the citation." }, "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The start index of the citation in the content.", "title": "Startindex" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The title of the source of the citation.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the source of the citation.", "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\nGenerated only when the `CodeExecution` tool is used.", "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" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.", "title": "Id" } }, "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'. If not set, the service will default to 'user'.", "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": "Gemini Enterprise Agent Platform 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": "Gemini Enterprise Agent Platform 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": "Gemini Enterprise Agent Platform only. Number of tokens of the input text.\n ", "title": "Tokencount" } }, "title": "ContentEmbeddingStatistics", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Model-generated code executed server-side, results returned to the model.\n\nOnly generated when using the `CodeExecution` tool, in which the code will\nbe automatically executed, and a corresponding `CodeExecutionResult` will\nalso be generated.", "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`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini 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. The URI of the file in Google Cloud Storage.", "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)." }, "modelStatus": { "anyOf": [ { "$ref": "#/$defs/ModelStatus" }, { "type": "null" } ], "default": null, "description": "Output only. The current model status of this model. This field is not supported in Vertex AI." }, "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": "A piece of evidence that supports a claim made by the model.\n\nThis is used to show a citation for a claim made by the model. When grounding\nis enabled, the model returns a `GroundingChunk` that contains a reference to\nthe source of the information.", "properties": { "image": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkImage" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from an image search result. See the `Image` message for details." }, "maps": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMaps" }, { "type": "null" } ], "default": null, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\n It contains information about a place, such as its name, address, and\n reviews. This is used to provide the user with rich, location-based\n information." }, "retrievedContext": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkRetrievedContext" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the `RetrievedContext` message for details" }, "web": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkWeb" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a web page, typically from Google Search. See the `Web` message for details." } }, "title": "GroundingChunk", "type": "object" }, "GroundingChunkCustomMetadata": { "additionalProperties": false, "description": "User provided metadata about the GroundingFact.\n\nThis data type is not supported in Vertex AI.", "properties": { "key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The key of the metadata.", "title": "Key" }, "numericValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The numeric value of the metadata. The expected range for this value depends on the specific `key` used.", "title": "Numericvalue" }, "stringListValue": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkStringList" }, { "type": "null" } ], "default": null, "description": "Optional. A list of string values for the metadata." }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The string value of the metadata.", "title": "Stringvalue" } }, "title": "GroundingChunkCustomMetadata", "type": "object" }, "GroundingChunkImage": { "additionalProperties": false, "description": "An `Image` chunk is a piece of evidence that comes from an image search result.\n\nIt contains the URI of the image search result and the URI of the image. This\nis used to provide the user with a link to the source of the information.", "properties": { "sourceUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image search result page.", "title": "Sourceuri" }, "imageUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image.", "title": "Imageuri" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the image search result page.", "title": "Title" }, "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the image search result page.", "title": "Domain" } }, "title": "GroundingChunkImage", "type": "object" }, "GroundingChunkMaps": { "additionalProperties": false, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\nIt contains information about a place, such as its name, address, and reviews.\nThis is used to provide the user with rich, location-based information.", "properties": { "placeAnswerSources": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources" }, { "type": "null" } ], "default": null, "description": "The sources that were used to generate the place answer.\n\n This includes review snippets and photos that were used to generate the\n 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.\n\n This can be used to look up the place in the Google Maps API.", "title": "Placeid" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The text of the place answer.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the place.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the place.", "title": "Uri" }, "route": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsRoute" }, { "type": "null" } ], "default": null, "description": "Output only. Route information." } }, "title": "GroundingChunkMaps", "type": "object" }, "GroundingChunkMapsPlaceAnswerSources": { "additionalProperties": false, "description": "The sources that were used to generate the place answer.\n\nThis includes review snippets and photos that were used to generate the\nanswer, as well as URIs to flag content.", "properties": { "reviewSnippet": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Snippets of reviews that were used to generate the answer.", "title": "Reviewsnippet" }, "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 were used to generate the answer.", "title": "Reviewsnippets" } }, "title": "GroundingChunkMapsPlaceAnswerSources", "type": "object" }, "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution": { "additionalProperties": false, "description": "Author attribution for a photo or review.", "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.", "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" }, "GroundingChunkMapsRoute": { "additionalProperties": false, "description": "Route information from Google Maps.\n\nThis data type is not supported in Gemini API.", "properties": { "distanceMeters": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total distance of the route, in meters.", "title": "Distancemeters" }, "duration": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The total duration of the route.", "title": "Duration" }, "encodedPolyline": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "An encoded polyline of the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm", "title": "Encodedpolyline" } }, "title": "GroundingChunkMapsRoute", "type": "object" }, "GroundingChunkRetrievedContext": { "additionalProperties": false, "description": "Context retrieved from a data source to ground the model's response.\n\nThis is used when a retrieval tool fetches information from a user-provided\ncorpus or a public dataset.", "properties": { "documentName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. This field is not supported in Gemini API.", "title": "Documentname" }, "ragChunk": { "anyOf": [ { "$ref": "#/$defs/RagChunk" }, { "type": "null" } ], "default": null, "description": "Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. This field is not supported in Gemini API." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The content of the retrieved data source.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the retrieved data source.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the retrieved data source.", "title": "Uri" }, "customMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkCustomMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. User-provided metadata about the retrieved context. This field is not supported in Vertex AI.", "title": "Custommetadata" }, "fileSearchStore": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI.", "title": "Filesearchstore" }, "pageNumber": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. Page number of the retrieved context. This field is not supported in Vertex AI.", "title": "Pagenumber" }, "mediaId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Media ID. This field is not supported in Vertex AI.", "title": "Mediaid" } }, "title": "GroundingChunkRetrievedContext", "type": "object" }, "GroundingChunkStringList": { "additionalProperties": false, "description": "A list of string values. This data type is not supported in Vertex AI.", "properties": { "values": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The string values of the list.", "title": "Values" } }, "title": "GroundingChunkStringList", "type": "object" }, "GroundingChunkWeb": { "additionalProperties": false, "description": "A `Web` chunk is a piece of evidence that comes from a web page.\n\nIt contains the URI of the web page, the title of the page, and the domain of\nthe page. This is used to provide the user with a link to the source of the\ninformation.", "properties": { "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the web page that contains the evidence. This can be used to filter out low-quality sources. This field is not supported in Gemini API.", "title": "Domain" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the web page that contains the evidence.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the web page that contains the evidence.", "title": "Uri" } }, "title": "GroundingChunkWeb", "type": "object" }, "GroundingMetadata": { "additionalProperties": false, "description": "Information for various kinds of grounding.", "properties": { "imageSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The image search queries that were used to generate the content. This field is populated only when the grounding source is Google Search with the Image Search search_type enabled.", "title": "Imagesearchqueries" }, "groundingChunks": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunk" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of supporting references retrieved from the grounding\n source. This field is populated when the grounding source is Google\n Search, Vertex AI Search, or Google Maps.\n ", "title": "Groundingchunks" }, "groundingSupports": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingSupport" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of grounding support.", "title": "Groundingsupports" }, "retrievalMetadata": { "anyOf": [ { "$ref": "#/$defs/RetrievalMetadata" }, { "type": "null" } ], "default": null, "description": "Metadata related to retrieval in the grounding flow." }, "searchEntryPoint": { "anyOf": [ { "$ref": "#/$defs/SearchEntryPoint" }, { "type": "null" } ], "default": null, "description": "Optional. Google search entry for the following-up web\n searches." }, "webSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Web search queries for the following-up web search.", "title": "Websearchqueries" }, "googleMapsWidgetContextToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps.", "title": "Googlemapswidgetcontexttoken" }, "retrievalQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search. This field is not supported in Gemini API.", "title": "Retrievalqueries" }, "sourceFlaggingUris": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingMetadataSourceFlaggingUri" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps. This field is not supported in Gemini API.", "title": "Sourceflagginguris" } }, "title": "GroundingMetadata", "type": "object" }, "GroundingMetadataSourceFlaggingUri": { "additionalProperties": false, "description": "A URI that can be used to flag a place or review for inappropriate content.\n\nThis is populated only when the grounding source is Google Maps. This data\ntype is not supported in Gemini API.", "properties": { "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI that can be used to flag the content.", "title": "Flagcontenturi" }, "sourceId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The 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.\n\n Ranges from 0 to 1. 1 is the most confident. This list must have the\n same size as the grounding_chunk_indices.", "title": "Confidencescores" }, "groundingChunkIndices": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of indices (into 'grounding_chunk') specifying the\n citations associated with the claim. For instance [1,3,4] means that\n grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the\n 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." }, "renderedParts": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Indices into the `rendered_parts` field of the `GroundingMetadata` message. These indices specify which rendered parts are associated with this support message.", "title": "Renderedparts" } }, "title": "GroundingSupport", "type": "object" }, "HarmBlockThreshold": { "description": "The threshold for blocking content.\n\nIf the harm probability exceeds this threshold, the content will be blocked.", "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": "The harm category to be blocked.", "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. The probability of harm for this category.", "enum": [ "HARM_PROBABILITY_UNSPECIFIED", "NEGLIGIBLE", "LOW", "MEDIUM", "HIGH" ], "title": "HarmProbability", "type": "string" }, "HarmSeverity": { "description": "Output only.\n\nThe severity of harm for this category. This enum is not supported in Gemini\nAPI.", "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": "Output only. The response to the request." }, "error": { "anyOf": [ { "$ref": "#/$defs/JobError" }, { "type": "null" } ], "default": null, "description": "Output only. The error encountered while processing the request." }, "metadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Output only. The metadata associated with the request.", "title": "Metadata" } }, "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 " }, "metadata": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "The metadata to be associated with the request.", "title": "Metadata" }, "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": "The log probabilities of the tokens generated by the model.\n\nThis is useful for understanding the model's confidence in its predictions and\nfor debugging. For example, you can use log probabilities to identify when the\nmodel is making a less confident prediction or to explore alternative\nresponses that the model considered. A low log probability can also indicate\nthat the model is \"hallucinating\" or generating factually incorrect\ninformation.", "properties": { "chosenCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in `top_candidates`.", "title": "Chosencandidates" }, "topCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultTopCandidates" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps.", "title": "Topcandidates" }, "logProbabilitySum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Sum of log probabilities for all tokens. This field is not supported in Vertex AI.", "title": "Logprobabilitysum" } }, "title": "LogprobsResult", "type": "object" }, "LogprobsResultCandidate": { "additionalProperties": false, "description": "A single token and its associated log probability.", "properties": { "logProbability": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain.", "title": "Logprobability" }, "token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The token's string representation.", "title": "Token" }, "tokenId": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The token's numerical ID. While the `token` field provides the string representation of the token, the `token_id` is the numerical representation that the model uses internally. This can be useful for developers who want to build custom logic based on the model's vocabulary.", "title": "Tokenid" } }, "title": "LogprobsResultCandidate", "type": "object" }, "LogprobsResultTopCandidates": { "additionalProperties": false, "description": "A list of the top candidate tokens and their log probabilities at each decoding step.\n\nThis can be used to see what other tokens the model considered.", "properties": { "candidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The list of candidate tokens, 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": "The number of tokens counted for this modality.", "title": "Tokencount" } }, "title": "ModalityTokenCount", "type": "object" }, "ModelStage": { "description": "The stage of the underlying model.\n\nThis enum is not supported in Vertex AI.", "enum": [ "MODEL_STAGE_UNSPECIFIED", "UNSTABLE_EXPERIMENTAL", "EXPERIMENTAL", "PREVIEW", "STABLE", "LEGACY", "DEPRECATED", "RETIRED" ], "title": "ModelStage", "type": "string" }, "ModelStatus": { "additionalProperties": false, "description": "The status of the underlying model.\n\nThis is used to indicate the stage of the underlying model and the retirement\ntime if applicable. This data type is not supported in Vertex AI.", "properties": { "message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A message explaining the model status.", "title": "Message" }, "modelStage": { "anyOf": [ { "$ref": "#/$defs/ModelStage" }, { "type": "null" } ], "default": null, "description": "The stage of the underlying model." }, "retirementTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "The time at which the model will be retired.", "title": "Retirementtime" } }, "title": "ModelStatus", "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. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "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." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" } }, "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": { "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" }, "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" }, "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 returned to client when grounding is enabled.", "properties": { "googleSearchDynamicRetrievalScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Score indicating how likely information from google\n search could help answer the prompt. The score is in the range [0, 1],\n where 0 is the least likely and 1 is the most likely. This score is only\n populated when google search grounding and dynamic retrieval is enabled.\n It will be compared to the threshold to determine whether to trigger\n Google search.", "title": "Googlesearchdynamicretrievalscore" } }, "title": "RetrievalMetadata", "type": "object" }, "SafetyRating": { "additionalProperties": false, "description": "A safety rating for a piece of content.\n\nThe safety rating contains the harm category and the harm probability level.", "properties": { "blocked": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Output only. Indicates whether the content was blocked because of this rating.", "title": "Blocked" }, "category": { "anyOf": [ { "$ref": "#/$defs/HarmCategory" }, { "type": "null" } ], "default": null, "description": "Output only. The harm category of this rating." }, "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. The probability of harm for this category." }, "probabilityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The probability score of harm for this category. This field is not supported in Gemini API.", "title": "Probabilityscore" }, "severity": { "anyOf": [ { "$ref": "#/$defs/HarmSeverity" }, { "type": "null" } ], "default": null, "description": "Output only. The severity of harm for this category. This field is not supported in Gemini API." }, "severityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The severity score of harm for this category. This field is not supported in Gemini API.", "title": "Severityscore" } }, "title": "SafetyRating", "type": "object" }, "SearchEntryPoint": { "additionalProperties": false, "description": "The entry point used to search for grounding sources.", "properties": { "renderedContent": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Web content snippet that can be embedded in a web page\n or an app webview.", "title": "Renderedcontent" }, "sdkBlob": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. JSON representing array of tuples.", "title": "Sdkblob" } }, "title": "SearchEntryPoint", "type": "object" }, "Segment": { "additionalProperties": false, "description": "Segment of the content this support belongs to.", "properties": { "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Start index in the given Part, measured in bytes.\n\n Offset from the start of the Part, inclusive, starting at zero.", "title": "Startindex" }, "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. End index in the given Part, measured in bytes.\n\n 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\n Content object.", "title": "Partindex" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The text corresponding to the segment from the\n 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" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "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", "ON_DEMAND_PRIORITY", "ON_DEMAND_FLEX", "PROVISIONED_THROUGHPUT" ], "title": "TrafficType", "type": "string" }, "UrlContextMetadata": { "additionalProperties": false, "description": "Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL.", "properties": { "urlMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/UrlMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A list of URL metadata, with one entry for each URL retrieved by the tool.", "title": "Urlmetadata" } }, "title": "UrlContextMetadata", "type": "object" }, "UrlMetadata": { "additionalProperties": false, "description": "The metadata for a single URL retrieval.", "properties": { "retrievedUrl": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URL retrieved by the tool.", "title": "Retrievedurl" }, "urlRetrievalStatus": { "anyOf": [ { "$ref": "#/$defs/UrlRetrievalStatus" }, { "type": "null" } ], "default": null, "description": "The status of the URL retrieval." } }, "title": "UrlMetadata", "type": "object" }, "UrlRetrievalStatus": { "description": "The 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" }, "VertexMultimodalDatasetDestination": { "additionalProperties": false, "description": "This class is experimental and may change in future versions.\n\nThe specification for an output Vertex AI multimodal dataset.", "properties": { "bigqueryDestination": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BigQuery destination for the multimodal dataset.", "title": "Bigquerydestination" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The display name of the multimodal dataset.", "title": "Displayname" } }, "title": "VertexMultimodalDatasetDestination", "type": "object" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "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 is 1.0. The valid 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 Gemini Enterprise Agent Platform 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 Gemini Enterprise Agent Platform 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 output_info:
Optional[BatchJobOutputInfo] = None (alias 'outputInfo')¶ Information further describing the output of this job. Output only.
- Validated by:
_check_field_type_mismatches
-
field src:
Optional[BatchJobSource] = None¶ Configuration for the input data. This field is for Gemini Enterprise Agent Platform 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:
BaseModelConfig 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', 'vertex-dataset'.\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" }, "vertexDataset": { "anyOf": [ { "$ref": "#/$defs/VertexMultimodalDatasetDestination" }, { "type": "null" } ], "default": null, "description": "This field is experimental and may change in future versions. The Vertex AI dataset destination.\n " } }, "$defs": { "BaseModel": { "properties": {}, "title": "BaseModel", "type": "object" }, "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The 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 used in the Gemini 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 " }, "groundingMetadata": { "anyOf": [ { "$ref": "#/$defs/GroundingMetadata" }, { "type": "null" } ], "default": null, "description": "Output only. Metadata returned when grounding is enabled. It\n contains the sources used to ground the generated content.\n " }, "avgLogprobs": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.", "title": "Avglogprobs" }, "index": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when `candidate_count` > 1.", "title": "Index" }, "logprobsResult": { "anyOf": [ { "$ref": "#/$defs/LogprobsResult" }, { "type": "null" } ], "default": null, "description": "Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential \"hallucinations\"." }, "safetyRatings": { "anyOf": [ { "items": { "$ref": "#/$defs/SafetyRating" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A 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 returned when the model uses the `url_context` tool to get information from a user-provided URL." } }, "title": "Candidate", "type": "object" }, "Citation": { "additionalProperties": false, "description": "A citation for a piece of generatedcontent.\n\nThis data type is not supported in Gemini API.", "properties": { "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The end index of the citation in the content.", "title": "Endindex" }, "license": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The license of the source of the citation.", "title": "License" }, "publicationDate": { "anyOf": [ { "$ref": "#/$defs/GoogleTypeDate" }, { "type": "null" } ], "default": null, "description": "Output only. The publication date of the source of the citation." }, "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The start index of the citation in the content.", "title": "Startindex" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The title of the source of the citation.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the source of the citation.", "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\nGenerated only when the `CodeExecution` tool is used.", "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" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.", "title": "Id" } }, "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'. If not set, the service will default to 'user'.", "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": "Gemini Enterprise Agent Platform 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": "Gemini Enterprise Agent Platform 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": "Gemini Enterprise Agent Platform only. Number of tokens of the input text.\n ", "title": "Tokencount" } }, "title": "ContentEmbeddingStatistics", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Model-generated code executed server-side, results returned to the model.\n\nOnly generated when using the `CodeExecution` tool, in which the code will\nbe automatically executed, and a corresponding `CodeExecutionResult` will\nalso be generated.", "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`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini 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. The URI of the file in Google Cloud Storage.", "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)." }, "modelStatus": { "anyOf": [ { "$ref": "#/$defs/ModelStatus" }, { "type": "null" } ], "default": null, "description": "Output only. The current model status of this model. This field is not supported in Vertex AI." }, "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": "A piece of evidence that supports a claim made by the model.\n\nThis is used to show a citation for a claim made by the model. When grounding\nis enabled, the model returns a `GroundingChunk` that contains a reference to\nthe source of the information.", "properties": { "image": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkImage" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from an image search result. See the `Image` message for details." }, "maps": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMaps" }, { "type": "null" } ], "default": null, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\n It contains information about a place, such as its name, address, and\n reviews. This is used to provide the user with rich, location-based\n information." }, "retrievedContext": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkRetrievedContext" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the `RetrievedContext` message for details" }, "web": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkWeb" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a web page, typically from Google Search. See the `Web` message for details." } }, "title": "GroundingChunk", "type": "object" }, "GroundingChunkCustomMetadata": { "additionalProperties": false, "description": "User provided metadata about the GroundingFact.\n\nThis data type is not supported in Vertex AI.", "properties": { "key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The key of the metadata.", "title": "Key" }, "numericValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The numeric value of the metadata. The expected range for this value depends on the specific `key` used.", "title": "Numericvalue" }, "stringListValue": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkStringList" }, { "type": "null" } ], "default": null, "description": "Optional. A list of string values for the metadata." }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The string value of the metadata.", "title": "Stringvalue" } }, "title": "GroundingChunkCustomMetadata", "type": "object" }, "GroundingChunkImage": { "additionalProperties": false, "description": "An `Image` chunk is a piece of evidence that comes from an image search result.\n\nIt contains the URI of the image search result and the URI of the image. This\nis used to provide the user with a link to the source of the information.", "properties": { "sourceUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image search result page.", "title": "Sourceuri" }, "imageUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image.", "title": "Imageuri" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the image search result page.", "title": "Title" }, "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the image search result page.", "title": "Domain" } }, "title": "GroundingChunkImage", "type": "object" }, "GroundingChunkMaps": { "additionalProperties": false, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\nIt contains information about a place, such as its name, address, and reviews.\nThis is used to provide the user with rich, location-based information.", "properties": { "placeAnswerSources": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources" }, { "type": "null" } ], "default": null, "description": "The sources that were used to generate the place answer.\n\n This includes review snippets and photos that were used to generate the\n 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.\n\n This can be used to look up the place in the Google Maps API.", "title": "Placeid" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The text of the place answer.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the place.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the place.", "title": "Uri" }, "route": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsRoute" }, { "type": "null" } ], "default": null, "description": "Output only. Route information." } }, "title": "GroundingChunkMaps", "type": "object" }, "GroundingChunkMapsPlaceAnswerSources": { "additionalProperties": false, "description": "The sources that were used to generate the place answer.\n\nThis includes review snippets and photos that were used to generate the\nanswer, as well as URIs to flag content.", "properties": { "reviewSnippet": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Snippets of reviews that were used to generate the answer.", "title": "Reviewsnippet" }, "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 were used to generate the answer.", "title": "Reviewsnippets" } }, "title": "GroundingChunkMapsPlaceAnswerSources", "type": "object" }, "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution": { "additionalProperties": false, "description": "Author attribution for a photo or review.", "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.", "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" }, "GroundingChunkMapsRoute": { "additionalProperties": false, "description": "Route information from Google Maps.\n\nThis data type is not supported in Gemini API.", "properties": { "distanceMeters": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total distance of the route, in meters.", "title": "Distancemeters" }, "duration": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The total duration of the route.", "title": "Duration" }, "encodedPolyline": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "An encoded polyline of the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm", "title": "Encodedpolyline" } }, "title": "GroundingChunkMapsRoute", "type": "object" }, "GroundingChunkRetrievedContext": { "additionalProperties": false, "description": "Context retrieved from a data source to ground the model's response.\n\nThis is used when a retrieval tool fetches information from a user-provided\ncorpus or a public dataset.", "properties": { "documentName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. This field is not supported in Gemini API.", "title": "Documentname" }, "ragChunk": { "anyOf": [ { "$ref": "#/$defs/RagChunk" }, { "type": "null" } ], "default": null, "description": "Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. This field is not supported in Gemini API." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The content of the retrieved data source.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the retrieved data source.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the retrieved data source.", "title": "Uri" }, "customMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkCustomMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. User-provided metadata about the retrieved context. This field is not supported in Vertex AI.", "title": "Custommetadata" }, "fileSearchStore": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI.", "title": "Filesearchstore" }, "pageNumber": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. Page number of the retrieved context. This field is not supported in Vertex AI.", "title": "Pagenumber" }, "mediaId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Media ID. This field is not supported in Vertex AI.", "title": "Mediaid" } }, "title": "GroundingChunkRetrievedContext", "type": "object" }, "GroundingChunkStringList": { "additionalProperties": false, "description": "A list of string values. This data type is not supported in Vertex AI.", "properties": { "values": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The string values of the list.", "title": "Values" } }, "title": "GroundingChunkStringList", "type": "object" }, "GroundingChunkWeb": { "additionalProperties": false, "description": "A `Web` chunk is a piece of evidence that comes from a web page.\n\nIt contains the URI of the web page, the title of the page, and the domain of\nthe page. This is used to provide the user with a link to the source of the\ninformation.", "properties": { "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the web page that contains the evidence. This can be used to filter out low-quality sources. This field is not supported in Gemini API.", "title": "Domain" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the web page that contains the evidence.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the web page that contains the evidence.", "title": "Uri" } }, "title": "GroundingChunkWeb", "type": "object" }, "GroundingMetadata": { "additionalProperties": false, "description": "Information for various kinds of grounding.", "properties": { "imageSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The image search queries that were used to generate the content. This field is populated only when the grounding source is Google Search with the Image Search search_type enabled.", "title": "Imagesearchqueries" }, "groundingChunks": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunk" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of supporting references retrieved from the grounding\n source. This field is populated when the grounding source is Google\n Search, Vertex AI Search, or Google Maps.\n ", "title": "Groundingchunks" }, "groundingSupports": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingSupport" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of grounding support.", "title": "Groundingsupports" }, "retrievalMetadata": { "anyOf": [ { "$ref": "#/$defs/RetrievalMetadata" }, { "type": "null" } ], "default": null, "description": "Metadata related to retrieval in the grounding flow." }, "searchEntryPoint": { "anyOf": [ { "$ref": "#/$defs/SearchEntryPoint" }, { "type": "null" } ], "default": null, "description": "Optional. Google search entry for the following-up web\n searches." }, "webSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Web search queries for the following-up web search.", "title": "Websearchqueries" }, "googleMapsWidgetContextToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps.", "title": "Googlemapswidgetcontexttoken" }, "retrievalQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search. This field is not supported in Gemini API.", "title": "Retrievalqueries" }, "sourceFlaggingUris": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingMetadataSourceFlaggingUri" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps. This field is not supported in Gemini API.", "title": "Sourceflagginguris" } }, "title": "GroundingMetadata", "type": "object" }, "GroundingMetadataSourceFlaggingUri": { "additionalProperties": false, "description": "A URI that can be used to flag a place or review for inappropriate content.\n\nThis is populated only when the grounding source is Google Maps. This data\ntype is not supported in Gemini API.", "properties": { "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI that can be used to flag the content.", "title": "Flagcontenturi" }, "sourceId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The 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.\n\n Ranges from 0 to 1. 1 is the most confident. This list must have the\n same size as the grounding_chunk_indices.", "title": "Confidencescores" }, "groundingChunkIndices": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of indices (into 'grounding_chunk') specifying the\n citations associated with the claim. For instance [1,3,4] means that\n grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the\n 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." }, "renderedParts": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Indices into the `rendered_parts` field of the `GroundingMetadata` message. These indices specify which rendered parts are associated with this support message.", "title": "Renderedparts" } }, "title": "GroundingSupport", "type": "object" }, "HarmBlockThreshold": { "description": "The threshold for blocking content.\n\nIf the harm probability exceeds this threshold, the content will be blocked.", "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": "The harm category to be blocked.", "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. The probability of harm for this category.", "enum": [ "HARM_PROBABILITY_UNSPECIFIED", "NEGLIGIBLE", "LOW", "MEDIUM", "HIGH" ], "title": "HarmProbability", "type": "string" }, "HarmSeverity": { "description": "Output only.\n\nThe severity of harm for this category. This enum is not supported in Gemini\nAPI.", "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": "Output only. The response to the request." }, "error": { "anyOf": [ { "$ref": "#/$defs/JobError" }, { "type": "null" } ], "default": null, "description": "Output only. The error encountered while processing the request." }, "metadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Output only. The metadata associated with the request.", "title": "Metadata" } }, "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 " }, "metadata": { "anyOf": [ { "additionalProperties": { "type": "string" }, "type": "object" }, { "type": "null" } ], "default": null, "description": "The metadata to be associated with the request.", "title": "Metadata" }, "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" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "LogprobsResult": { "additionalProperties": false, "description": "The log probabilities of the tokens generated by the model.\n\nThis is useful for understanding the model's confidence in its predictions and\nfor debugging. For example, you can use log probabilities to identify when the\nmodel is making a less confident prediction or to explore alternative\nresponses that the model considered. A low log probability can also indicate\nthat the model is \"hallucinating\" or generating factually incorrect\ninformation.", "properties": { "chosenCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in `top_candidates`.", "title": "Chosencandidates" }, "topCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultTopCandidates" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps.", "title": "Topcandidates" }, "logProbabilitySum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Sum of log probabilities for all tokens. This field is not supported in Vertex AI.", "title": "Logprobabilitysum" } }, "title": "LogprobsResult", "type": "object" }, "LogprobsResultCandidate": { "additionalProperties": false, "description": "A single token and its associated log probability.", "properties": { "logProbability": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain.", "title": "Logprobability" }, "token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The token's string representation.", "title": "Token" }, "tokenId": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The token's numerical ID. While the `token` field provides the string representation of the token, the `token_id` is the numerical representation that the model uses internally. This can be useful for developers who want to build custom logic based on the model's vocabulary.", "title": "Tokenid" } }, "title": "LogprobsResultCandidate", "type": "object" }, "LogprobsResultTopCandidates": { "additionalProperties": false, "description": "A list of the top candidate tokens and their log probabilities at each decoding step.\n\nThis can be used to see what other tokens the model considered.", "properties": { "candidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The list of candidate tokens, 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": "The number of tokens counted for this modality.", "title": "Tokencount" } }, "title": "ModalityTokenCount", "type": "object" }, "ModelStage": { "description": "The stage of the underlying model.\n\nThis enum is not supported in Vertex AI.", "enum": [ "MODEL_STAGE_UNSPECIFIED", "UNSTABLE_EXPERIMENTAL", "EXPERIMENTAL", "PREVIEW", "STABLE", "LEGACY", "DEPRECATED", "RETIRED" ], "title": "ModelStage", "type": "string" }, "ModelStatus": { "additionalProperties": false, "description": "The status of the underlying model.\n\nThis is used to indicate the stage of the underlying model and the retirement\ntime if applicable. This data type is not supported in Vertex AI.", "properties": { "message": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A message explaining the model status.", "title": "Message" }, "modelStage": { "anyOf": [ { "$ref": "#/$defs/ModelStage" }, { "type": "null" } ], "default": null, "description": "The stage of the underlying model." }, "retirementTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "The time at which the model will be retired.", "title": "Retirementtime" } }, "title": "ModelStatus", "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. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "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." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" } }, "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": { "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" }, "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" }, "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 returned to client when grounding is enabled.", "properties": { "googleSearchDynamicRetrievalScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Score indicating how likely information from google\n search could help answer the prompt. The score is in the range [0, 1],\n where 0 is the least likely and 1 is the most likely. This score is only\n populated when google search grounding and dynamic retrieval is enabled.\n It will be compared to the threshold to determine whether to trigger\n Google search.", "title": "Googlesearchdynamicretrievalscore" } }, "title": "RetrievalMetadata", "type": "object" }, "SafetyRating": { "additionalProperties": false, "description": "A safety rating for a piece of content.\n\nThe safety rating contains the harm category and the harm probability level.", "properties": { "blocked": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Output only. Indicates whether the content was blocked because of this rating.", "title": "Blocked" }, "category": { "anyOf": [ { "$ref": "#/$defs/HarmCategory" }, { "type": "null" } ], "default": null, "description": "Output only. The harm category of this rating." }, "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. The probability of harm for this category." }, "probabilityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The probability score of harm for this category. This field is not supported in Gemini API.", "title": "Probabilityscore" }, "severity": { "anyOf": [ { "$ref": "#/$defs/HarmSeverity" }, { "type": "null" } ], "default": null, "description": "Output only. The severity of harm for this category. This field is not supported in Gemini API." }, "severityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The severity score of harm for this category. This field is not supported in Gemini API.", "title": "Severityscore" } }, "title": "SafetyRating", "type": "object" }, "SearchEntryPoint": { "additionalProperties": false, "description": "The entry point used to search for grounding sources.", "properties": { "renderedContent": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Web content snippet that can be embedded in a web page\n or an app webview.", "title": "Renderedcontent" }, "sdkBlob": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. JSON representing array of tuples.", "title": "Sdkblob" } }, "title": "SearchEntryPoint", "type": "object" }, "Segment": { "additionalProperties": false, "description": "Segment of the content this support belongs to.", "properties": { "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Start index in the given Part, measured in bytes.\n\n Offset from the start of the Part, inclusive, starting at zero.", "title": "Startindex" }, "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. End index in the given Part, measured in bytes.\n\n 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\n Content object.", "title": "Partindex" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The text corresponding to the segment from the\n 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" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "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", "ON_DEMAND_PRIORITY", "ON_DEMAND_FLEX", "PROVISIONED_THROUGHPUT" ], "title": "TrafficType", "type": "string" }, "UrlContextMetadata": { "additionalProperties": false, "description": "Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL.", "properties": { "urlMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/UrlMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A list of URL metadata, with one entry for each URL retrieved by the tool.", "title": "Urlmetadata" } }, "title": "UrlContextMetadata", "type": "object" }, "UrlMetadata": { "additionalProperties": false, "description": "The metadata for a single URL retrieval.", "properties": { "retrievedUrl": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URL retrieved by the tool.", "title": "Retrievedurl" }, "urlRetrievalStatus": { "anyOf": [ { "$ref": "#/$defs/UrlRetrievalStatus" }, { "type": "null" } ], "default": null, "description": "The status of the URL retrieval." } }, "title": "UrlMetadata", "type": "object" }, "UrlRetrievalStatus": { "description": "The 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" }, "VertexMultimodalDatasetDestination": { "additionalProperties": false, "description": "This class is experimental and may change in future versions.\n\nThe specification for an output Vertex AI multimodal dataset.", "properties": { "bigqueryDestination": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BigQuery destination for the multimodal dataset.", "title": "Bigquerydestination" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The display name of the multimodal dataset.", "title": "Displayname" } }, "title": "VertexMultimodalDatasetDestination", "type": "object" }, "VideoMetadata": { "additionalProperties": false, "description": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "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 is 1.0. The valid 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 bigquery_uri:
Optional[str] = None (alias 'bigqueryUri')¶ The BigQuery URI to the output table.
- Validated by:
_check_field_type_mismatches
-
field file_name:
Optional[str] = None (alias 'fileName')¶ The Gemini Developer API’s file resource name of the output data (e.g. “files/12345”). The file will be a JSONL file with a single response per line. The responses will be GenerateContentResponse messages formatted as JSON. The responses will be written in the same order as the input requests.
- Validated by:
_check_field_type_mismatches
-
field format:
Optional[str] = None¶ Storage format of the output files. Must be one of: ‘jsonl’, ‘bigquery’, ‘vertex-dataset’.
- Validated by:
_check_field_type_mismatches
-
field gcs_uri:
Optional[str] = None (alias 'gcsUri')¶ The Google Cloud Storage URI to the output file.
- Validated by:
_check_field_type_mismatches
-
field inlined_embed_content_responses:
Optional[list[InlinedEmbedContentResponse]] = None (alias 'inlinedEmbedContentResponses')¶ The responses to the requests in the batch. Returned when the batch was built using inlined requests. The responses will be in the same order as the input requests.
- Validated by:
_check_field_type_mismatches
-
field inlined_responses:
Optional[list[InlinedResponse]] = None (alias 'inlinedResponses')¶ The responses to the requests in the batch. Returned when the batch was built using inlined requests. The responses will be in the same order as the input requests.
- Validated by:
_check_field_type_mismatches
-
field vertex_dataset:
Optional[VertexMultimodalDatasetDestination] = None (alias 'vertexDataset')¶ This field is experimental and may change in future versions. The Vertex AI dataset destination.
- Validated by:
_check_field_type_mismatches
- class genai.types.BatchJobDestinationDict¶
Bases:
TypedDictConfig for des parameter.
-
bigquery_uri:
Optional[str]¶ The BigQuery URI to the output table.
-
file_name:
Optional[str]¶ The Gemini Developer API’s file resource name of the output data (e.g. “files/12345”). The file will be a JSONL file with a single response per line. The responses will be GenerateContentResponse messages formatted as JSON. The responses will be written in the same order as the input requests.
-
format:
Optional[str]¶ Storage format of the output files. Must be one of: ‘jsonl’, ‘bigquery’, ‘vertex-dataset’.
-
gcs_uri:
Optional[str]¶ The Google Cloud Storage URI to the output file.
-
inlined_embed_content_responses:
Optional[list[InlinedEmbedContentResponseDict]]¶ The responses to the requests in the batch. Returned when the batch was built using inlined requests. The responses will be in the same order as the input requests.
-
inlined_responses:
Optional[list[InlinedResponseDict]]¶ The responses to the requests in the batch. Returned when the batch was built using inlined requests. The responses will be in the same order as the input requests.
-
vertex_dataset:
Optional[VertexMultimodalDatasetDestinationDict]¶ This field is experimental and may change in future versions. The Vertex AI dataset destination.
-
bigquery_uri:
- class genai.types.BatchJobDict¶
Bases:
TypedDictConfig for batches.create return value.
-
completion_stats:
Optional[CompletionStatsDict]¶ Statistics on completed and failed prediction instances. This field is for Gemini Enterprise Agent Platform only.
-
create_time:
Optional[datetime]¶ The time when the BatchJob was created.
-
dest:
Optional[BatchJobDestinationDict]¶ Configuration for the output data.
-
display_name:
Optional[str]¶ The display name of the BatchJob.
-
end_time:
Optional[datetime]¶ The time when the BatchJob was completed. This field is for Gemini Enterprise Agent Platform only.
-
error:
Optional[JobErrorDict]¶ Output only. Only populated when the job’s state is JOB_STATE_FAILED or JOB_STATE_CANCELLED.
-
model:
Optional[str]¶ The name of the model that produces the predictions via the BatchJob.
-
name:
Optional[str]¶ The resource name of the BatchJob. Output only.”.
-
output_info:
Optional[BatchJobOutputInfoDict]¶ Information further describing the output of this job. Output only.
-
src:
Optional[BatchJobSourceDict]¶ Configuration for the input data. This field is for Gemini Enterprise Agent Platform only.
-
start_time:
Optional[datetime]¶ Output only. Time when the Job for the first time entered the JOB_STATE_RUNNING state.
-
update_time:
Optional[datetime]¶ The time when the BatchJob was last updated.
-
completion_stats:
- pydantic model genai.types.BatchJobOutputInfo¶
Bases:
BaseModelRepresents the output_info field in batch jobs.
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": "BatchJobOutputInfo", "description": "Represents the `output_info` field in batch jobs.", "type": "object", "properties": { "vertexMultimodalDatasetName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data.", "title": "Vertexmultimodaldatasetname" }, "gcsOutputDirectory": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The full path of the Cloud Storage directory created, into which the prediction output is written.", "title": "Gcsoutputdirectory" }, "bigqueryOutputTable": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the BigQuery table created, in `predictions_<timestamp>` format, into which the prediction output is written.", "title": "Bigqueryoutputtable" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field bigquery_output_table:
Optional[str] = None (alias 'bigqueryOutputTable')¶ The name of the BigQuery table created, in predictions_<timestamp> format, into which the prediction output is written.
- Validated by:
_check_field_type_mismatches
-
field gcs_output_directory:
Optional[str] = None (alias 'gcsOutputDirectory')¶ The full path of the Cloud Storage directory created, into which the prediction output is written.
- Validated by:
_check_field_type_mismatches
-
field vertex_multimodal_dataset_name:
Optional[str] = None (alias 'vertexMultimodalDatasetName')¶ This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data.
- Validated by:
_check_field_type_mismatches
- class genai.types.BatchJobOutputInfoDict¶
Bases:
TypedDictRepresents the output_info field in batch jobs.
-
bigquery_output_table:
Optional[str]¶ The name of the BigQuery table created, in predictions_<timestamp> format, into which the prediction output is written.
-
gcs_output_directory:
Optional[str]¶ The full path of the Cloud Storage directory created, into which the prediction output is written.
-
vertex_multimodal_dataset_name:
Optional[str]¶ This field is experimental and may change in future versions. The Vertex AI dataset name containing the output data.
-
bigquery_output_table:
- pydantic model genai.types.BatchJobSource¶
Bases:
BaseModelConfig for src 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": "BatchJobSource", "type": "object", "properties": { "format": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Storage format of the input files. Must be one of:\n 'jsonl', 'bigquery', 'vertex-dataset'.\n ", "title": "Format" }, "gcsUri": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The Google Cloud Storage URIs to input files.\n ", "title": "Gcsuri" }, "bigqueryUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The BigQuery URI to input table.\n ", "title": "Bigqueryuri" }, "fileName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The Gemini Developer API's file resource name of the input data\n (e.g. \"files/12345\").\n ", "title": "Filename" }, "inlinedRequests": { "default": null, "title": "Inlinedrequests" }, "vertexDatasetName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "This field is experimental and may change in future versions. The Vertex AI dataset resource name to use as input. Must be of type multimodal.\n ", "title": "Vertexdatasetname" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field bigquery_uri:
Optional[str] = None (alias 'bigqueryUri')¶ The BigQuery URI to input table.
- Validated by:
_check_field_type_mismatches
-
field file_name:
Optional[str] = None (alias 'fileName')¶ The Gemini Developer API’s file resource name of the input data (e.g. “files/12345”).
- Validated by:
_check_field_type_mismatches
-
field format:
Optional[str] = None¶ Storage format of the input files. Must be one of: ‘jsonl’, ‘bigquery’, ‘vertex-dataset’.
- Validated by:
_check_field_type_mismatches
-
field gcs_uri:
Optional[list[str]] = None (alias 'gcsUri')¶ The Google Cloud Storage URIs to input files.
- Validated by:
_check_field_type_mismatches
-
field inlined_requests:
Optional[list[InlinedRequest]] = None (alias 'inlinedRequests')¶ The Gemini Developer API’s inlined input data to run batch job.
- Validated by:
_check_field_type_mismatches
-
field vertex_dataset_name:
Optional[str] = None (alias 'vertexDatasetName')¶ This field is experimental and may change in future versions. The Vertex AI dataset resource name to use as input. Must be of type multimodal.
- Validated by:
_check_field_type_mismatches
- class genai.types.BatchJobSourceDict¶
Bases:
TypedDictConfig for src parameter.
-
bigquery_uri:
Optional[str]¶ The BigQuery URI to input table.
-
file_name:
Optional[str]¶ The Gemini Developer API’s file resource name of the input data (e.g. “files/12345”).
-
format:
Optional[str]¶ Storage format of the input files. Must be one of: ‘jsonl’, ‘bigquery’, ‘vertex-dataset’.
-
gcs_uri:
Optional[list[str]]¶ The Google Cloud Storage URIs to input files.
-
inlined_requests:
Optional[list[InlinedRequestDict]]¶ The Gemini Developer API’s inlined input data to run batch job.
-
vertex_dataset_name:
Optional[str]¶ This field is experimental and may change in future versions. The Vertex AI dataset resource name to use as input. Must be of type multimodal.
-
bigquery_uri:
- class genai.types.Behavior(*values)¶
Bases:
CaseInSensitiveEnumSpecifies the function Behavior.
Currently only supported by the BidiGenerateContent method. This enum is not supported in Vertex AI.
- BLOCKING = 'BLOCKING'¶
If set, the system will wait to receive the function response before continuing the conversation.
- NON_BLOCKING = 'NON_BLOCKING'¶
If set, the system will not wait to receive the function response. Instead, it will attempt to handle function responses as they become available while maintaining the conversation between the user and the model.
- UNSPECIFIED = 'UNSPECIFIED'¶
This value is unused.
- pydantic model genai.types.BigQuerySource¶
Bases:
BaseModelThe BigQuery location for the input content.
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": "BigQuerySource", "description": "The BigQuery location for the input content.\n\nThis data type is not supported in Gemini API.", "type": "object", "properties": { "inputUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. For example: `bq://projectId.bqDatasetId.bqTableId`.", "title": "Inputuri" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field input_uri:
Optional[str] = None (alias 'inputUri')¶ Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. For example: bq://projectId.bqDatasetId.bqTableId.
- Validated by:
_check_field_type_mismatches
- class genai.types.BigQuerySourceDict¶
Bases:
TypedDictThe BigQuery location for the input content.
This data type is not supported in Gemini API.
-
input_uri:
Optional[str]¶ bq://projectId.bqDatasetId.bqTableId.
- Type:
Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms
- Type:
BigQuery path. For example
-
input_uri:
- pydantic model genai.types.BleuMetricValue¶
Bases:
BaseModelBleu metric value for an instance.
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": "BleuMetricValue", "description": "Bleu metric value for an instance.\n\nThis data type is not supported in Gemini API.", "type": "object", "properties": { "score": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. Bleu score.", "title": "Score" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field score:
Optional[float] = None¶ Output only. Bleu score.
- Validated by:
_check_field_type_mismatches
- class genai.types.BleuMetricValueDict¶
Bases:
TypedDictBleu metric value for an instance.
This data type is not supported in Gemini API.
-
score:
Optional[float]¶ Output only. Bleu score.
-
score:
- pydantic model genai.types.BleuSpec¶
Bases:
BaseModelSpec for bleu metric.
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": "BleuSpec", "description": "Spec for bleu metric.", "type": "object", "properties": { "useEffectiveOrder": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Whether to use_effective_order to compute bleu score.", "title": "Useeffectiveorder" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field use_effective_order:
Optional[bool] = None (alias 'useEffectiveOrder')¶ Optional. Whether to use_effective_order to compute bleu score.
- Validated by:
_check_field_type_mismatches
- class genai.types.BleuSpecDict¶
Bases:
TypedDictSpec for bleu metric.
-
use_effective_order:
Optional[bool]¶ Optional. Whether to use_effective_order to compute bleu score.
-
use_effective_order:
- pydantic model genai.types.Blob¶
Bases:
BaseModelA content blob.
A Blob contains data of a specific media type. It is used to represent images, audio, and video.
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": "Blob", "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "type": "object", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The 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 used in the Gemini 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" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field data:
Optional[bytes] = None¶ Required. The raw bytes of the data.
- Validated by:
_check_field_type_mismatches
-
field display_name:
Optional[str] = None (alias 'displayName')¶ Optional. The 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 used in the Gemini calls only when server-side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
-
field mime_type:
Optional[str] = None (alias 'mimeType')¶ Required. The IANA standard MIME type of the source data.
- Validated by:
_check_field_type_mismatches
- class genai.types.BlobDict¶
Bases:
TypedDictA content blob.
A Blob contains data of a specific media type. It is used to represent images, audio, and video.
-
data:
Optional[bytes]¶ Required. The raw bytes of the data.
-
display_name:
Optional[str]¶ Optional. The 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 used in the Gemini calls only when server-side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API.
-
mime_type:
Optional[str]¶ Required. The IANA standard MIME type of the source data.
-
data:
- class genai.types.BlockedReason(*values)¶
Bases:
CaseInSensitiveEnumOutput only. The reason why the prompt was blocked.
- BLOCKED_REASON_UNSPECIFIED = 'BLOCKED_REASON_UNSPECIFIED'¶
The blocked reason is unspecified.
- BLOCKLIST = 'BLOCKLIST'¶
The prompt was blocked because it contains a term from the terminology blocklist.
- IMAGE_SAFETY = 'IMAGE_SAFETY'¶
The prompt was blocked because it contains content that is unsafe for image generation.
- JAILBREAK = 'JAILBREAK'¶
The prompt was blocked as a jailbreak attempt. This enum value is not supported in Gemini API.
- MODEL_ARMOR = 'MODEL_ARMOR'¶
The prompt was blocked by Model Armor. This enum value is not supported in Gemini API.
- OTHER = 'OTHER'¶
The prompt was blocked for other reasons. For example, it may be due to the prompt’s language, or because it contains other harmful content.
- PROHIBITED_CONTENT = 'PROHIBITED_CONTENT'¶
The prompt was blocked because it contains prohibited content.
- SAFETY = 'SAFETY'¶
The prompt was blocked for safety reasons.
- pydantic model genai.types.CachedContent¶
Bases:
BaseModelA resource used in LLM queries for users to explicitly specify what to cache.
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": "CachedContent", "description": "A resource used in LLM queries for users to explicitly specify what to cache.", "type": "object", "properties": { "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The server-generated resource name of the cached content.", "title": "Name" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The user-generated meaningful display name of the cached content.", "title": "Displayname" }, "model": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The name of the publisher model to use for cached content.", "title": "Model" }, "createTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Creation time of the cache entry.", "title": "Createtime" }, "updateTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "When the cache entry was last updated in UTC time.", "title": "Updatetime" }, "expireTime": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "description": "Expiration time of the cached content.", "title": "Expiretime" }, "usageMetadata": { "anyOf": [ { "$ref": "#/$defs/CachedContentUsageMetadata" }, { "type": "null" } ], "default": null, "description": "Metadata on the usage of the cached content." } }, "$defs": { "CachedContentUsageMetadata": { "additionalProperties": false, "description": "Metadata on the usage of the cached content.", "properties": { "audioDurationSeconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Duration of audio in seconds. This field is not supported in Gemini API.", "title": "Audiodurationseconds" }, "imageCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of images. This field is not supported in Gemini API.", "title": "Imagecount" }, "textCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of text characters. This field is not supported in Gemini API.", "title": "Textcount" }, "totalTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Total number of tokens that the cached content consumes.", "title": "Totaltokencount" }, "videoDurationSeconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Duration of video in seconds. This field is not supported in Gemini API.", "title": "Videodurationseconds" } }, "title": "CachedContentUsageMetadata", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field create_time:
Optional[datetime] = None (alias 'createTime')¶ Creation time of the cache entry.
- Validated by:
_check_field_type_mismatches
-
field display_name:
Optional[str] = None (alias 'displayName')¶ The user-generated meaningful display name of the cached content.
- Validated by:
_check_field_type_mismatches
-
field expire_time:
Optional[datetime] = None (alias 'expireTime')¶ Expiration time of the cached content.
- Validated by:
_check_field_type_mismatches
-
field model:
Optional[str] = None¶ The name of the publisher model to use for cached content.
- Validated by:
_check_field_type_mismatches
-
field name:
Optional[str] = None¶ The server-generated resource name of the cached content.
- Validated by:
_check_field_type_mismatches
-
field update_time:
Optional[datetime] = None (alias 'updateTime')¶ When the cache entry was last updated in UTC time.
- Validated by:
_check_field_type_mismatches
-
field usage_metadata:
Optional[CachedContentUsageMetadata] = None (alias 'usageMetadata')¶ Metadata on the usage of the cached content.
- Validated by:
_check_field_type_mismatches
- class genai.types.CachedContentDict¶
Bases:
TypedDictA resource used in LLM queries for users to explicitly specify what to cache.
-
create_time:
Optional[datetime]¶ Creation time of the cache entry.
-
display_name:
Optional[str]¶ The user-generated meaningful display name of the cached content.
-
expire_time:
Optional[datetime]¶ Expiration time of the cached content.
-
model:
Optional[str]¶ The name of the publisher model to use for cached content.
-
name:
Optional[str]¶ The server-generated resource name of the cached content.
-
update_time:
Optional[datetime]¶ When the cache entry was last updated in UTC time.
-
usage_metadata:
Optional[CachedContentUsageMetadataDict]¶ Metadata on the usage of the cached content.
-
create_time:
- pydantic model genai.types.CachedContentUsageMetadata¶
Bases:
BaseModelMetadata on the usage of the cached content.
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": "CachedContentUsageMetadata", "description": "Metadata on the usage of the cached content.", "type": "object", "properties": { "audioDurationSeconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Duration of audio in seconds. This field is not supported in Gemini API.", "title": "Audiodurationseconds" }, "imageCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of images. This field is not supported in Gemini API.", "title": "Imagecount" }, "textCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Number of text characters. This field is not supported in Gemini API.", "title": "Textcount" }, "totalTokenCount": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Total number of tokens that the cached content consumes.", "title": "Totaltokencount" }, "videoDurationSeconds": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Duration of video in seconds. This field is not supported in Gemini API.", "title": "Videodurationseconds" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field audio_duration_seconds:
Optional[int] = None (alias 'audioDurationSeconds')¶ Duration of audio in seconds. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
-
field image_count:
Optional[int] = None (alias 'imageCount')¶ Number of images. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
-
field text_count:
Optional[int] = None (alias 'textCount')¶ Number of text characters. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
-
field total_token_count:
Optional[int] = None (alias 'totalTokenCount')¶ Total number of tokens that the cached content consumes.
- Validated by:
_check_field_type_mismatches
-
field video_duration_seconds:
Optional[int] = None (alias 'videoDurationSeconds')¶ Duration of video in seconds. This field is not supported in Gemini API.
- Validated by:
_check_field_type_mismatches
- class genai.types.CachedContentUsageMetadataDict¶
Bases:
TypedDictMetadata on the usage of the cached content.
-
audio_duration_seconds:
Optional[int]¶ Duration of audio in seconds. This field is not supported in Gemini API.
-
image_count:
Optional[int]¶ Number of images. This field is not supported in Gemini API.
-
text_count:
Optional[int]¶ Number of text characters. This field is not supported in Gemini API.
-
total_token_count:
Optional[int]¶ Total number of tokens that the cached content consumes.
-
video_duration_seconds:
Optional[int]¶ Duration of video in seconds. This field is not supported in Gemini API.
-
audio_duration_seconds:
- pydantic model genai.types.CancelBatchJobConfig¶
Bases:
BaseModelOptional 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": "CancelBatchJobConfig", "type": "object", "properties": { "httpOptions": { "default": null, "title": "Httpoptions" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field http_options:
Optional[HttpOptions] = None (alias 'httpOptions')¶ Used to override HTTP request options.
- Validated by:
_check_field_type_mismatches
- class genai.types.CancelBatchJobConfigDict¶
Bases:
TypedDictOptional parameters.
-
http_options:
Optional[HttpOptionsDict]¶ Used to override HTTP request options.
-
http_options:
- pydantic model genai.types.CancelTuningJobConfig¶
Bases:
BaseModelOptional parameters for tunings.cancel method.
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": "CancelTuningJobConfig", "type": "object", "properties": { "httpOptions": { "default": null, "title": "Httpoptions" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field http_options:
Optional[HttpOptions] = None (alias 'httpOptions')¶ Used to override HTTP request options.
- Validated by:
_check_field_type_mismatches
- class genai.types.CancelTuningJobConfigDict¶
Bases:
TypedDictOptional parameters for tunings.cancel method.
-
http_options:
Optional[HttpOptionsDict]¶ Used to override HTTP request options.
-
http_options:
- pydantic model genai.types.CancelTuningJobResponse¶
Bases:
BaseModelEmpty response for tunings.cancel method.
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": "CancelTuningJobResponse", "description": "Empty response for tunings.cancel method.", "type": "object", "properties": { "sdkHttpResponse": { "anyOf": [ { "$ref": "#/$defs/HttpResponse" }, { "type": "null" } ], "default": null, "description": "Used to retain the full HTTP response." } }, "$defs": { "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" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field sdk_http_response:
Optional[HttpResponse] = None (alias 'sdkHttpResponse')¶ Used to retain the full HTTP response.
- Validated by:
_check_field_type_mismatches
- class genai.types.CancelTuningJobResponseDict¶
Bases:
TypedDictEmpty response for tunings.cancel method.
-
sdk_http_response:
Optional[HttpResponseDict]¶ Used to retain the full HTTP response.
-
sdk_http_response:
- pydantic model genai.types.Candidate¶
Bases:
BaseModelA response candidate generated from the model.
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": "Candidate", "description": "A response candidate generated from the model.", "type": "object", "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 " }, "groundingMetadata": { "anyOf": [ { "$ref": "#/$defs/GroundingMetadata" }, { "type": "null" } ], "default": null, "description": "Output only. Metadata returned when grounding is enabled. It\n contains the sources used to ground the generated content.\n " }, "avgLogprobs": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.", "title": "Avglogprobs" }, "index": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when `candidate_count` > 1.", "title": "Index" }, "logprobsResult": { "anyOf": [ { "$ref": "#/$defs/LogprobsResult" }, { "type": "null" } ], "default": null, "description": "Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential \"hallucinations\"." }, "safetyRatings": { "anyOf": [ { "items": { "$ref": "#/$defs/SafetyRating" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A 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 returned when the model uses the `url_context` tool to get information from a user-provided URL." } }, "$defs": { "Blob": { "additionalProperties": false, "description": "A content blob.\n\nA Blob contains data of a specific media type. It is used to represent images,\naudio, and video.", "properties": { "data": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Required. The raw bytes of the data.", "title": "Data" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The 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 used in the Gemini 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" }, "Citation": { "additionalProperties": false, "description": "A citation for a piece of generatedcontent.\n\nThis data type is not supported in Gemini API.", "properties": { "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The end index of the citation in the content.", "title": "Endindex" }, "license": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The license of the source of the citation.", "title": "License" }, "publicationDate": { "anyOf": [ { "$ref": "#/$defs/GoogleTypeDate" }, { "type": "null" } ], "default": null, "description": "Output only. The publication date of the source of the citation." }, "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The start index of the citation in the content.", "title": "Startindex" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The title of the source of the citation.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the source of the citation.", "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\nGenerated only when the `CodeExecution` tool is used.", "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" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.", "title": "Id" } }, "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'. If not set, the service will default to 'user'.", "title": "Role" } }, "title": "Content", "type": "object" }, "ExecutableCode": { "additionalProperties": false, "description": "Model-generated code executed server-side, results returned to the model.\n\nOnly generated when using the `CodeExecution` tool, in which the code will\nbe automatically executed, and a corresponding `CodeExecutionResult` will\nalso be generated.", "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`." }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.", "title": "Id" } }, "title": "ExecutableCode", "type": "object" }, "FileData": { "additionalProperties": false, "description": "URI-based data.\n\nA FileData message contains a URI pointing to data of a specific media type.\nIt is used to represent images, audio, and video stored in Google Cloud\nStorage.", "properties": { "displayName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini 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. The URI of the file in Google Cloud Storage.", "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" }, "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": "A piece of evidence that supports a claim made by the model.\n\nThis is used to show a citation for a claim made by the model. When grounding\nis enabled, the model returns a `GroundingChunk` that contains a reference to\nthe source of the information.", "properties": { "image": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkImage" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from an image search result. See the `Image` message for details." }, "maps": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMaps" }, { "type": "null" } ], "default": null, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\n It contains information about a place, such as its name, address, and\n reviews. This is used to provide the user with rich, location-based\n information." }, "retrievedContext": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkRetrievedContext" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the `RetrievedContext` message for details" }, "web": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkWeb" }, { "type": "null" } ], "default": null, "description": "A grounding chunk from a web page, typically from Google Search. See the `Web` message for details." } }, "title": "GroundingChunk", "type": "object" }, "GroundingChunkCustomMetadata": { "additionalProperties": false, "description": "User provided metadata about the GroundingFact.\n\nThis data type is not supported in Vertex AI.", "properties": { "key": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The key of the metadata.", "title": "Key" }, "numericValue": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. The numeric value of the metadata. The expected range for this value depends on the specific `key` used.", "title": "Numericvalue" }, "stringListValue": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkStringList" }, { "type": "null" } ], "default": null, "description": "Optional. A list of string values for the metadata." }, "stringValue": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The string value of the metadata.", "title": "Stringvalue" } }, "title": "GroundingChunkCustomMetadata", "type": "object" }, "GroundingChunkImage": { "additionalProperties": false, "description": "An `Image` chunk is a piece of evidence that comes from an image search result.\n\nIt contains the URI of the image search result and the URI of the image. This\nis used to provide the user with a link to the source of the information.", "properties": { "sourceUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image search result page.", "title": "Sourceuri" }, "imageUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the image.", "title": "Imageuri" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the image search result page.", "title": "Title" }, "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the image search result page.", "title": "Domain" } }, "title": "GroundingChunkImage", "type": "object" }, "GroundingChunkMaps": { "additionalProperties": false, "description": "A `Maps` chunk is a piece of evidence that comes from Google Maps.\n\nIt contains information about a place, such as its name, address, and reviews.\nThis is used to provide the user with rich, location-based information.", "properties": { "placeAnswerSources": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSources" }, { "type": "null" } ], "default": null, "description": "The sources that were used to generate the place answer.\n\n This includes review snippets and photos that were used to generate the\n 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.\n\n This can be used to look up the place in the Google Maps API.", "title": "Placeid" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The text of the place answer.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the place.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the place.", "title": "Uri" }, "route": { "anyOf": [ { "$ref": "#/$defs/GroundingChunkMapsRoute" }, { "type": "null" } ], "default": null, "description": "Output only. Route information." } }, "title": "GroundingChunkMaps", "type": "object" }, "GroundingChunkMapsPlaceAnswerSources": { "additionalProperties": false, "description": "The sources that were used to generate the place answer.\n\nThis includes review snippets and photos that were used to generate the\nanswer, as well as URIs to flag content.", "properties": { "reviewSnippet": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkMapsPlaceAnswerSourcesReviewSnippet" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Snippets of reviews that were used to generate the answer.", "title": "Reviewsnippet" }, "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 were used to generate the answer.", "title": "Reviewsnippets" } }, "title": "GroundingChunkMapsPlaceAnswerSources", "type": "object" }, "GroundingChunkMapsPlaceAnswerSourcesAuthorAttribution": { "additionalProperties": false, "description": "Author attribution for a photo or review.", "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.", "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" }, "GroundingChunkMapsRoute": { "additionalProperties": false, "description": "Route information from Google Maps.\n\nThis data type is not supported in Gemini API.", "properties": { "distanceMeters": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The total distance of the route, in meters.", "title": "Distancemeters" }, "duration": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The total duration of the route.", "title": "Duration" }, "encodedPolyline": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "An encoded polyline of the route. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm", "title": "Encodedpolyline" } }, "title": "GroundingChunkMapsRoute", "type": "object" }, "GroundingChunkRetrievedContext": { "additionalProperties": false, "description": "Context retrieved from a data source to ground the model's response.\n\nThis is used when a retrieval tool fetches information from a user-provided\ncorpus or a public dataset.", "properties": { "documentName": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`. This field is not supported in Gemini API.", "title": "Documentname" }, "ragChunk": { "anyOf": [ { "$ref": "#/$defs/RagChunk" }, { "type": "null" } ], "default": null, "description": "Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used. This field is not supported in Gemini API." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The content of the retrieved data source.", "title": "Text" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the retrieved data source.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the retrieved data source.", "title": "Uri" }, "customMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunkCustomMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. User-provided metadata about the retrieved context. This field is not supported in Vertex AI.", "title": "Custommetadata" }, "fileSearchStore": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Name of the `FileSearchStore` containing the document. Example: `fileSearchStores/123`. This field is not supported in Vertex AI.", "title": "Filesearchstore" }, "pageNumber": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Optional. Page number of the retrieved context. This field is not supported in Vertex AI.", "title": "Pagenumber" }, "mediaId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Media ID. This field is not supported in Vertex AI.", "title": "Mediaid" } }, "title": "GroundingChunkRetrievedContext", "type": "object" }, "GroundingChunkStringList": { "additionalProperties": false, "description": "A list of string values. This data type is not supported in Vertex AI.", "properties": { "values": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The string values of the list.", "title": "Values" } }, "title": "GroundingChunkStringList", "type": "object" }, "GroundingChunkWeb": { "additionalProperties": false, "description": "A `Web` chunk is a piece of evidence that comes from a web page.\n\nIt contains the URI of the web page, the title of the page, and the domain of\nthe page. This is used to provide the user with a link to the source of the\ninformation.", "properties": { "domain": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The domain of the web page that contains the evidence. This can be used to filter out low-quality sources. This field is not supported in Gemini API.", "title": "Domain" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The title of the web page that contains the evidence.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI of the web page that contains the evidence.", "title": "Uri" } }, "title": "GroundingChunkWeb", "type": "object" }, "GroundingMetadata": { "additionalProperties": false, "description": "Information for various kinds of grounding.", "properties": { "imageSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The image search queries that were used to generate the content. This field is populated only when the grounding source is Google Search with the Image Search search_type enabled.", "title": "Imagesearchqueries" }, "groundingChunks": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingChunk" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of supporting references retrieved from the grounding\n source. This field is populated when the grounding source is Google\n Search, Vertex AI Search, or Google Maps.\n ", "title": "Groundingchunks" }, "groundingSupports": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingSupport" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "List of grounding support.", "title": "Groundingsupports" }, "retrievalMetadata": { "anyOf": [ { "$ref": "#/$defs/RetrievalMetadata" }, { "type": "null" } ], "default": null, "description": "Metadata related to retrieval in the grounding flow." }, "searchEntryPoint": { "anyOf": [ { "$ref": "#/$defs/SearchEntryPoint" }, { "type": "null" } ], "default": null, "description": "Optional. Google search entry for the following-up web\n searches." }, "webSearchQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Web search queries for the following-up web search.", "title": "Websearchqueries" }, "googleMapsWidgetContextToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps.", "title": "Googlemapswidgetcontexttoken" }, "retrievalQueries": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search. This field is not supported in Gemini API.", "title": "Retrievalqueries" }, "sourceFlaggingUris": { "anyOf": [ { "items": { "$ref": "#/$defs/GroundingMetadataSourceFlaggingUri" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps. This field is not supported in Gemini API.", "title": "Sourceflagginguris" } }, "title": "GroundingMetadata", "type": "object" }, "GroundingMetadataSourceFlaggingUri": { "additionalProperties": false, "description": "A URI that can be used to flag a place or review for inappropriate content.\n\nThis is populated only when the grounding source is Google Maps. This data\ntype is not supported in Gemini API.", "properties": { "flagContentUri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URI that can be used to flag the content.", "title": "Flagcontenturi" }, "sourceId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The 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.\n\n Ranges from 0 to 1. 1 is the most confident. This list must have the\n same size as the grounding_chunk_indices.", "title": "Confidencescores" }, "groundingChunkIndices": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of indices (into 'grounding_chunk') specifying the\n citations associated with the claim. For instance [1,3,4] means that\n grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the\n 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." }, "renderedParts": { "anyOf": [ { "items": { "type": "integer" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Indices into the `rendered_parts` field of the `GroundingMetadata` message. These indices specify which rendered parts are associated with this support message.", "title": "Renderedparts" } }, "title": "GroundingSupport", "type": "object" }, "HarmBlockThreshold": { "description": "The threshold for blocking content.\n\nIf the harm probability exceeds this threshold, the content will be blocked.", "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": "The harm category to be blocked.", "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. The probability of harm for this category.", "enum": [ "HARM_PROBABILITY_UNSPECIFIED", "NEGLIGIBLE", "LOW", "MEDIUM", "HIGH" ], "title": "HarmProbability", "type": "string" }, "HarmSeverity": { "description": "Output only.\n\nThe severity of harm for this category. This enum is not supported in Gemini\nAPI.", "enum": [ "HARM_SEVERITY_UNSPECIFIED", "HARM_SEVERITY_NEGLIGIBLE", "HARM_SEVERITY_LOW", "HARM_SEVERITY_MEDIUM", "HARM_SEVERITY_HIGH" ], "title": "HarmSeverity", "type": "string" }, "Language": { "description": "Programming language of the `code`.", "enum": [ "LANGUAGE_UNSPECIFIED", "PYTHON" ], "title": "Language", "type": "string" }, "LogprobsResult": { "additionalProperties": false, "description": "The log probabilities of the tokens generated by the model.\n\nThis is useful for understanding the model's confidence in its predictions and\nfor debugging. For example, you can use log probabilities to identify when the\nmodel is making a less confident prediction or to explore alternative\nresponses that the model considered. A low log probability can also indicate\nthat the model is \"hallucinating\" or generating factually incorrect\ninformation.", "properties": { "chosenCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the chosen candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps. Note that the chosen candidate might not be in `top_candidates`.", "title": "Chosencandidates" }, "topCandidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultTopCandidates" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "A list of the top candidate tokens at each decoding step. The length of this list is equal to the total number of decoding steps.", "title": "Topcandidates" }, "logProbabilitySum": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Sum of log probabilities for all tokens. This field is not supported in Vertex AI.", "title": "Logprobabilitysum" } }, "title": "LogprobsResult", "type": "object" }, "LogprobsResultCandidate": { "additionalProperties": false, "description": "A single token and its associated log probability.", "properties": { "logProbability": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The log probability of this token. A higher value indicates that the model was more confident in this token. The log probability can be used to assess the relative likelihood of different tokens and to identify when the model is uncertain.", "title": "Logprobability" }, "token": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The token's string representation.", "title": "Token" }, "tokenId": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The token's numerical ID. While the `token` field provides the string representation of the token, the `token_id` is the numerical representation that the model uses internally. This can be useful for developers who want to build custom logic based on the model's vocabulary.", "title": "Tokenid" } }, "title": "LogprobsResultCandidate", "type": "object" }, "LogprobsResultTopCandidates": { "additionalProperties": false, "description": "A list of the top candidate tokens and their log probabilities at each decoding step.\n\nThis can be used to see what other tokens the model considered.", "properties": { "candidates": { "anyOf": [ { "items": { "$ref": "#/$defs/LogprobsResultCandidate" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "The list of candidate tokens, sorted by log probability in descending order.", "title": "Candidates" } }, "title": "LogprobsResultTopCandidates", "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. The result of executing the ExecutableCode." }, "executableCode": { "anyOf": [ { "$ref": "#/$defs/ExecutableCode" }, { "type": "null" } ], "default": null, "description": "Optional. Code generated by the model that is intended to be executed." }, "fileData": { "anyOf": [ { "$ref": "#/$defs/FileData" }, { "type": "null" } ], "default": null, "description": "Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage." }, "functionCall": { "anyOf": [ { "$ref": "#/$defs/FunctionCall" }, { "type": "null" } ], "default": null, "description": "Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function." }, "functionResponse": { "anyOf": [ { "$ref": "#/$defs/FunctionResponse" }, { "type": "null" } ], "default": null, "description": "Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted." }, "inlineData": { "anyOf": [ { "$ref": "#/$defs/Blob" }, { "type": "null" } ], "default": null, "description": "Optional. The inline data content of the part. This can be used to include images, audio, or video in a request." }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. The text content of the part. When sent from the VSCode Gemini Code Assist extension, references to @mentioned items will be converted to markdown boldface text. For example `@my-repo` will be converted to and sent as `**my-repo**` by the IDE agent.", "title": "Text" }, "thought": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Optional. Indicates whether the `part` represents the model's thought process or reasoning.", "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." }, "toolCall": { "anyOf": [ { "$ref": "#/$defs/ToolCall" }, { "type": "null" } ], "default": null, "description": "Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API." }, "toolResponse": { "anyOf": [ { "$ref": "#/$defs/ToolResponse" }, { "type": "null" } ], "default": null, "description": "The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall." }, "partMetadata": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "Custom metadata associated with the Part. Agents using genai.Part as content representation may need to keep track of the additional information. For example it can be name of a file/source from which the Part originates or a way to multiplex multiple Part streams. This field is not supported in Vertex AI.", "title": "Partmetadata" } }, "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": { "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" }, "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" }, "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 returned to client when grounding is enabled.", "properties": { "googleSearchDynamicRetrievalScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Optional. Score indicating how likely information from google\n search could help answer the prompt. The score is in the range [0, 1],\n where 0 is the least likely and 1 is the most likely. This score is only\n populated when google search grounding and dynamic retrieval is enabled.\n It will be compared to the threshold to determine whether to trigger\n Google search.", "title": "Googlesearchdynamicretrievalscore" } }, "title": "RetrievalMetadata", "type": "object" }, "SafetyRating": { "additionalProperties": false, "description": "A safety rating for a piece of content.\n\nThe safety rating contains the harm category and the harm probability level.", "properties": { "blocked": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "description": "Output only. Indicates whether the content was blocked because of this rating.", "title": "Blocked" }, "category": { "anyOf": [ { "$ref": "#/$defs/HarmCategory" }, { "type": "null" } ], "default": null, "description": "Output only. The harm category of this rating." }, "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. The probability of harm for this category." }, "probabilityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The probability score of harm for this category. This field is not supported in Gemini API.", "title": "Probabilityscore" }, "severity": { "anyOf": [ { "$ref": "#/$defs/HarmSeverity" }, { "type": "null" } ], "default": null, "description": "Output only. The severity of harm for this category. This field is not supported in Gemini API." }, "severityScore": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Output only. The severity score of harm for this category. This field is not supported in Gemini API.", "title": "Severityscore" } }, "title": "SafetyRating", "type": "object" }, "SearchEntryPoint": { "additionalProperties": false, "description": "The entry point used to search for grounding sources.", "properties": { "renderedContent": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. Web content snippet that can be embedded in a web page\n or an app webview.", "title": "Renderedcontent" }, "sdkBlob": { "anyOf": [ { "format": "base64url", "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional. JSON representing array of tuples.", "title": "Sdkblob" } }, "title": "SearchEntryPoint", "type": "object" }, "Segment": { "additionalProperties": false, "description": "Segment of the content this support belongs to.", "properties": { "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. Start index in the given Part, measured in bytes.\n\n Offset from the start of the Part, inclusive, starting at zero.", "title": "Startindex" }, "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. End index in the given Part, measured in bytes.\n\n 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\n Content object.", "title": "Partindex" }, "text": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The text corresponding to the segment from the\n response.", "title": "Text" } }, "title": "Segment", "type": "object" }, "ToolCall": { "additionalProperties": false, "description": "A predicted server-side `ToolCall` returned from the model.\n\nThis message contains information about a tool that the model wants to invoke.\nThe client is NOT expected to execute this `ToolCall`. Instead, the\nclient should pass this `ToolCall` back to the API in a subsequent turn\nwithin a `Content` message, along with the corresponding `ToolResponse`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Unique identifier of the tool call. The server returns the tool response with the matching `id`.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called." }, "args": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool call arguments. Example: {\"arg1\": \"value1\", \"arg2\": \"value2\"}.", "title": "Args" } }, "title": "ToolCall", "type": "object" }, "ToolResponse": { "additionalProperties": false, "description": "The output from a server-side `ToolCall` execution.\n\nThis message contains the results of a tool invocation that was initiated by a\n`ToolCall` from the model. The client should pass this `ToolResponse` back to\nthe API in a subsequent turn within a `Content` message, along with the\ncorresponding `ToolCall`.", "properties": { "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The identifier of the tool call this response is for.", "title": "Id" }, "toolType": { "anyOf": [ { "$ref": "#/$defs/ToolType" }, { "type": "null" } ], "default": null, "description": "The type of tool that was called, matching the tool_type in the corresponding ToolCall." }, "response": { "anyOf": [ { "additionalProperties": true, "type": "object" }, { "type": "null" } ], "default": null, "description": "The tool response.", "title": "Response" } }, "title": "ToolResponse", "type": "object" }, "ToolType": { "description": "The type of tool in the function call.", "enum": [ "TOOL_TYPE_UNSPECIFIED", "GOOGLE_SEARCH_WEB", "GOOGLE_SEARCH_IMAGE", "URL_CONTEXT", "GOOGLE_MAPS", "FILE_SEARCH" ], "title": "ToolType", "type": "string" }, "UrlContextMetadata": { "additionalProperties": false, "description": "Metadata returned when the model uses the `url_context` tool to get information from a user-provided URL.", "properties": { "urlMetadata": { "anyOf": [ { "items": { "$ref": "#/$defs/UrlMetadata" }, "type": "array" }, { "type": "null" } ], "default": null, "description": "Output only. A list of URL metadata, with one entry for each URL retrieved by the tool.", "title": "Urlmetadata" } }, "title": "UrlContextMetadata", "type": "object" }, "UrlMetadata": { "additionalProperties": false, "description": "The metadata for a single URL retrieval.", "properties": { "retrievedUrl": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The URL retrieved by the tool.", "title": "Retrievedurl" }, "urlRetrievalStatus": { "anyOf": [ { "$ref": "#/$defs/UrlRetrievalStatus" }, { "type": "null" } ], "default": null, "description": "The status of the URL retrieval." } }, "title": "UrlMetadata", "type": "object" }, "UrlRetrievalStatus": { "description": "The 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": "Provides metadata for a video, including the start and end offsets for clipping and the frame rate.", "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 is 1.0. The valid 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 avg_logprobs:
Optional[float] = None (alias 'avgLogprobs')¶ Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.
- Validated by:
_check_field_type_mismatches
-
field citation_metadata:
Optional[CitationMetadata] = None (alias 'citationMetadata')¶ Source attribution of the generated content.
- Validated by:
_check_field_type_mismatches
-
field content:
Optional[Content] = None¶ Contains the multi-part content of the response.
- Validated by:
_check_field_type_mismatches
-
field finish_message:
Optional[str] = None (alias 'finishMessage')¶ Describes the reason the model stopped generating tokens.
- Validated by:
_check_field_type_mismatches
-
field finish_reason:
Optional[FinishReason] = None (alias 'finishReason')¶ The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
- Validated by:
_check_field_type_mismatches
-
field grounding_metadata:
Optional[GroundingMetadata] = None (alias 'groundingMetadata')¶ Output only. Metadata returned when grounding is enabled. It contains the sources used to ground the generated content.
- Validated by:
_check_field_type_mismatches
-
field index:
Optional[int] = None¶ Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when candidate_count > 1.
- Validated by:
_check_field_type_mismatches
-
field logprobs_result:
Optional[LogprobsResult] = None (alias 'logprobsResult')¶ Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential “hallucinations”.
- Validated by:
_check_field_type_mismatches
-
field safety_ratings:
Optional[list[SafetyRating]] = None (alias 'safetyRatings')¶ Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category.
- Validated by:
_check_field_type_mismatches
-
field token_count:
Optional[int] = None (alias 'tokenCount')¶ Number of tokens for this candidate.
- Validated by:
_check_field_type_mismatches
-
field url_context_metadata:
Optional[UrlContextMetadata] = None (alias 'urlContextMetadata')¶ Output only. Metadata returned when the model uses the url_context tool to get information from a user-provided URL.
- Validated by:
_check_field_type_mismatches
- class genai.types.CandidateDict¶
Bases:
TypedDictA response candidate generated from the model.
-
avg_logprobs:
Optional[float]¶ Output only. The average log probability of the tokens in this candidate. This is a length-normalized score that can be used to compare the quality of candidates of different lengths. A higher average log probability suggests a more confident and coherent response.
-
citation_metadata:
Optional[CitationMetadataDict]¶ Source attribution of the generated content.
-
content:
Optional[ContentDict]¶ Contains the multi-part content of the response.
-
finish_message:
Optional[str]¶ Describes the reason the model stopped generating tokens.
-
finish_reason:
Optional[FinishReason]¶ The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
-
grounding_metadata:
Optional[GroundingMetadataDict]¶ Output only. Metadata returned when grounding is enabled. It contains the sources used to ground the generated content.
-
index:
Optional[int]¶ Output only. The 0-based index of this candidate in the list of generated responses. This is useful for distinguishing between multiple candidates when candidate_count > 1.
-
logprobs_result:
Optional[LogprobsResultDict]¶ Output only. The detailed log probability information for the tokens in this candidate. This is useful for debugging, understanding model uncertainty, and identifying potential “hallucinations”.
-
safety_ratings:
Optional[list[SafetyRatingDict]]¶ Output only. A list of ratings for the safety of a response candidate. There is at most one rating per category.
-
token_count:
Optional[int]¶ Number of tokens for this candidate.
-
url_context_metadata:
Optional[UrlContextMetadataDict]¶ Output only. Metadata returned when the model uses the url_context tool to get information from a user-provided URL.
-
avg_logprobs:
- pydantic model genai.types.Checkpoint¶
Bases:
BaseModelDescribes the machine learning model version checkpoint.
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": "Checkpoint", "description": "Describes the machine learning model version checkpoint.", "type": "object", "properties": { "checkpointId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "The ID of the checkpoint.\n ", "title": "Checkpointid" }, "epoch": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The epoch of the checkpoint.\n ", "title": "Epoch" }, "step": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "The step of the checkpoint.\n ", "title": "Step" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field checkpoint_id:
Optional[str] = None (alias 'checkpointId')¶ The ID of the checkpoint.
- Validated by:
_check_field_type_mismatches
-
field epoch:
Optional[int] = None¶ The epoch of the checkpoint.
- Validated by:
_check_field_type_mismatches
-
field step:
Optional[int] = None¶ The step of the checkpoint.
- Validated by:
_check_field_type_mismatches
- class genai.types.CheckpointDict¶
Bases:
TypedDictDescribes the machine learning model version checkpoint.
-
checkpoint_id:
Optional[str]¶ The ID of the checkpoint.
-
epoch:
Optional[int]¶ The epoch of the checkpoint.
-
step:
Optional[int]¶ The step of the checkpoint.
-
checkpoint_id:
- pydantic model genai.types.ChunkingConfig¶
Bases:
BaseModelConfig for telling the service how to chunk the file.
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": "ChunkingConfig", "description": "Config for telling the service how to chunk the file.", "type": "object", "properties": { "whiteSpaceConfig": { "anyOf": [ { "$ref": "#/$defs/WhiteSpaceConfig" }, { "type": "null" } ], "default": null, "description": "White space chunking configuration." } }, "$defs": { "WhiteSpaceConfig": { "additionalProperties": false, "description": "Configuration for a white space chunking algorithm.", "properties": { "maxTokensPerChunk": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of tokens per chunk.", "title": "Maxtokensperchunk" }, "maxOverlapTokens": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Maximum number of overlapping tokens between two adjacent chunks.", "title": "Maxoverlaptokens" } }, "title": "WhiteSpaceConfig", "type": "object" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field white_space_config:
Optional[WhiteSpaceConfig] = None (alias 'whiteSpaceConfig')¶ White space chunking configuration.
- Validated by:
_check_field_type_mismatches
- class genai.types.ChunkingConfigDict¶
Bases:
TypedDictConfig for telling the service how to chunk the file.
-
white_space_config:
Optional[WhiteSpaceConfigDict]¶ White space chunking configuration.
-
white_space_config:
- pydantic model genai.types.Citation¶
Bases:
BaseModelA citation for a piece of generatedcontent.
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": "Citation", "description": "A citation for a piece of generatedcontent.\n\nThis data type is not supported in Gemini API.", "type": "object", "properties": { "endIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The end index of the citation in the content.", "title": "Endindex" }, "license": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The license of the source of the citation.", "title": "License" }, "publicationDate": { "anyOf": [ { "$ref": "#/$defs/GoogleTypeDate" }, { "type": "null" } ], "default": null, "description": "Output only. The publication date of the source of the citation." }, "startIndex": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "description": "Output only. The start index of the citation in the content.", "title": "Startindex" }, "title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The title of the source of the citation.", "title": "Title" }, "uri": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Output only. The URI of the source of the citation.", "title": "Uri" } }, "$defs": { "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" } }, "additionalProperties": false }
- Fields:
- Validators:
-
field end_index:
Optional[int] = None (alias 'endIndex')¶ Output only. The end index of the citation in the content.
- Validated by:
_check_field_type_mismatches
-
field license:
Optional[str] = None¶ Output only. The license of the source of the citation.
- Validated by:
_check_field_type_mismatches
-
field publication_date:
Optional[GoogleTypeDate] = None (alias 'publicationDate')¶ Output only. The publication date of the source of the citation.
- Validated by:
_check_field_type_mismatches
-
field start_index:
Optional[int] = None (alias 'startIndex')¶ Output only. The start index of the citation in the content.
- Validated by:
_check_field_type_mismatches
-
field title:
Optional[str] = None¶ Output only. The title of the source of the citation.
- Validated by:
_check_field_type_mismatches
-
field uri:
Optional[str] = None¶ Output only. The URI of the source of the citation.
- Validated by:
_check_field_type_mismatches
- class genai.types.CitationDict¶
Bases:
TypedDictA citation for a piece of generatedcontent.
This data type is not supported in Gemini API.
-
end_index:
Optional[int]¶ Output only. The end index of the citation in the content.
-
license:
Optional[str]¶ Output only. The license of the source of the citation.
-
publication_date:
Optional[GoogleTypeDateDict]¶ Output only. The publication date of the source of the citation.
- start_index
-
end_index: