diff --git a/google/genai/caches.py b/google/genai/caches.py index 22516aa5..aa9542fb 100644 --- a/google/genai/caches.py +++ b/google/genai/caches.py @@ -39,9 +39,6 @@ def _Part_to_mldev( if getv(from_object, ['video_metadata']) is not None: raise ValueError('video_metadata parameter is not supported in Gemini API.') - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['code_execution_result']) is not None: setv( to_object, @@ -71,6 +68,9 @@ def _Part_to_mldev( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object @@ -261,9 +261,6 @@ def _Tool_to_mldev( ], ) - if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') - if getv(from_object, ['google_search']) is not None: setv( to_object, @@ -273,6 +270,9 @@ def _Tool_to_mldev( ), ) + if getv(from_object, ['retrieval']) is not None: + raise ValueError('retrieval parameter is not supported in Gemini API.') + if getv(from_object, ['google_search_retrieval']) is not None: setv( to_object, @@ -287,6 +287,13 @@ def _Tool_to_mldev( if getv(from_object, ['code_execution']) is not None: setv(to_object, ['codeExecution'], getv(from_object, ['code_execution'])) + if getv(from_object, ['enterprise_web_search']) is not None: + setv( + to_object, + ['enterpriseWebSearch'], + getv(from_object, ['enterprise_web_search']), + ) + return to_object @@ -326,6 +333,11 @@ def _ToolConfig_to_mldev( ), ) + if getv(from_object, ['retrieval_config']) is not None: + setv( + to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config']) + ) + return to_object @@ -543,9 +555,6 @@ def _Part_to_vertex( if getv(from_object, ['video_metadata']) is not None: setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata'])) - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['code_execution_result']) is not None: setv( to_object, @@ -575,6 +584,9 @@ def _Part_to_vertex( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object @@ -771,9 +783,6 @@ def _Tool_to_vertex( ], ) - if getv(from_object, ['retrieval']) is not None: - setv(to_object, ['retrieval'], getv(from_object, ['retrieval'])) - if getv(from_object, ['google_search']) is not None: setv( to_object, @@ -783,6 +792,9 @@ def _Tool_to_vertex( ), ) + if getv(from_object, ['retrieval']) is not None: + setv(to_object, ['retrieval'], getv(from_object, ['retrieval'])) + if getv(from_object, ['google_search_retrieval']) is not None: setv( to_object, @@ -797,6 +809,13 @@ def _Tool_to_vertex( if getv(from_object, ['code_execution']) is not None: setv(to_object, ['codeExecution'], getv(from_object, ['code_execution'])) + if getv(from_object, ['enterprise_web_search']) is not None: + setv( + to_object, + ['enterpriseWebSearch'], + getv(from_object, ['enterprise_web_search']), + ) + return to_object @@ -836,6 +855,11 @@ def _ToolConfig_to_vertex( ), ) + if getv(from_object, ['retrieval_config']) is not None: + setv( + to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config']) + ) + return to_object diff --git a/google/genai/models.py b/google/genai/models.py index fbb34604..bfd4344c 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -40,9 +40,6 @@ def _Part_to_mldev( if getv(from_object, ['video_metadata']) is not None: raise ValueError('video_metadata parameter is not supported in Gemini API.') - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['code_execution_result']) is not None: setv( to_object, @@ -72,6 +69,9 @@ def _Part_to_mldev( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object @@ -280,9 +280,6 @@ def _Tool_to_mldev( ], ) - if getv(from_object, ['retrieval']) is not None: - raise ValueError('retrieval parameter is not supported in Gemini API.') - if getv(from_object, ['google_search']) is not None: setv( to_object, @@ -292,6 +289,9 @@ def _Tool_to_mldev( ), ) + if getv(from_object, ['retrieval']) is not None: + raise ValueError('retrieval parameter is not supported in Gemini API.') + if getv(from_object, ['google_search_retrieval']) is not None: setv( to_object, @@ -306,6 +306,13 @@ def _Tool_to_mldev( if getv(from_object, ['code_execution']) is not None: setv(to_object, ['codeExecution'], getv(from_object, ['code_execution'])) + if getv(from_object, ['enterprise_web_search']) is not None: + setv( + to_object, + ['enterpriseWebSearch'], + getv(from_object, ['enterprise_web_search']), + ) + return to_object @@ -345,34 +352,9 @@ def _ToolConfig_to_mldev( ), ) - return to_object - - -def _PrebuiltVoiceConfig_to_mldev( - api_client: BaseApiClient, - from_object: Union[dict, object], - parent_object: Optional[dict] = None, -) -> dict: - to_object: dict[str, Any] = {} - if getv(from_object, ['voice_name']) is not None: - setv(to_object, ['voiceName'], getv(from_object, ['voice_name'])) - - return to_object - - -def _VoiceConfig_to_mldev( - api_client: BaseApiClient, - from_object: Union[dict, object], - parent_object: Optional[dict] = None, -) -> dict: - to_object: dict[str, Any] = {} - if getv(from_object, ['prebuilt_voice_config']) is not None: + if getv(from_object, ['retrieval_config']) is not None: setv( - to_object, - ['prebuiltVoiceConfig'], - _PrebuiltVoiceConfig_to_mldev( - api_client, getv(from_object, ['prebuilt_voice_config']), to_object - ), + to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config']) ) return to_object @@ -384,18 +366,12 @@ def _SpeechConfig_to_mldev( parent_object: Optional[dict] = None, ) -> dict: to_object: dict[str, Any] = {} - if getv(from_object, ['voice_config']) is not None: - setv( - to_object, - ['voiceConfig'], - _VoiceConfig_to_mldev( - api_client, getv(from_object, ['voice_config']), to_object - ), - ) - if getv(from_object, ['language_code']) is not None: setv(to_object, ['languageCode'], getv(from_object, ['language_code'])) + if getv(from_object, ['voice_config']) is not None: + setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config'])) + return to_object @@ -1137,9 +1113,6 @@ def _Part_to_vertex( if getv(from_object, ['video_metadata']) is not None: setv(to_object, ['videoMetadata'], getv(from_object, ['video_metadata'])) - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['code_execution_result']) is not None: setv( to_object, @@ -1169,6 +1142,9 @@ def _Part_to_vertex( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object @@ -1383,9 +1359,6 @@ def _Tool_to_vertex( ], ) - if getv(from_object, ['retrieval']) is not None: - setv(to_object, ['retrieval'], getv(from_object, ['retrieval'])) - if getv(from_object, ['google_search']) is not None: setv( to_object, @@ -1395,6 +1368,9 @@ def _Tool_to_vertex( ), ) + if getv(from_object, ['retrieval']) is not None: + setv(to_object, ['retrieval'], getv(from_object, ['retrieval'])) + if getv(from_object, ['google_search_retrieval']) is not None: setv( to_object, @@ -1409,6 +1385,13 @@ def _Tool_to_vertex( if getv(from_object, ['code_execution']) is not None: setv(to_object, ['codeExecution'], getv(from_object, ['code_execution'])) + if getv(from_object, ['enterprise_web_search']) is not None: + setv( + to_object, + ['enterpriseWebSearch'], + getv(from_object, ['enterprise_web_search']), + ) + return to_object @@ -1448,34 +1431,9 @@ def _ToolConfig_to_vertex( ), ) - return to_object - - -def _PrebuiltVoiceConfig_to_vertex( - api_client: BaseApiClient, - from_object: Union[dict, object], - parent_object: Optional[dict] = None, -) -> dict: - to_object: dict[str, Any] = {} - if getv(from_object, ['voice_name']) is not None: - setv(to_object, ['voiceName'], getv(from_object, ['voice_name'])) - - return to_object - - -def _VoiceConfig_to_vertex( - api_client: BaseApiClient, - from_object: Union[dict, object], - parent_object: Optional[dict] = None, -) -> dict: - to_object: dict[str, Any] = {} - if getv(from_object, ['prebuilt_voice_config']) is not None: + if getv(from_object, ['retrieval_config']) is not None: setv( - to_object, - ['prebuiltVoiceConfig'], - _PrebuiltVoiceConfig_to_vertex( - api_client, getv(from_object, ['prebuilt_voice_config']), to_object - ), + to_object, ['retrievalConfig'], getv(from_object, ['retrieval_config']) ) return to_object @@ -1487,18 +1445,12 @@ def _SpeechConfig_to_vertex( parent_object: Optional[dict] = None, ) -> dict: to_object: dict[str, Any] = {} - if getv(from_object, ['voice_config']) is not None: - setv( - to_object, - ['voiceConfig'], - _VoiceConfig_to_vertex( - api_client, getv(from_object, ['voice_config']), to_object - ), - ) - if getv(from_object, ['language_code']) is not None: setv(to_object, ['languageCode'], getv(from_object, ['language_code'])) + if getv(from_object, ['voice_config']) is not None: + setv(to_object, ['voiceConfig'], getv(from_object, ['voice_config'])) + return to_object @@ -2682,9 +2634,6 @@ def _Part_from_mldev( ) -> dict: to_object: dict[str, Any] = {} - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['codeExecutionResult']) is not None: setv( to_object, @@ -2714,6 +2663,9 @@ def _Part_from_mldev( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object @@ -3250,9 +3202,6 @@ def _Part_from_vertex( if getv(from_object, ['videoMetadata']) is not None: setv(to_object, ['video_metadata'], getv(from_object, ['videoMetadata'])) - if getv(from_object, ['thought']) is not None: - setv(to_object, ['thought'], getv(from_object, ['thought'])) - if getv(from_object, ['codeExecutionResult']) is not None: setv( to_object, @@ -3282,6 +3231,9 @@ def _Part_from_vertex( if getv(from_object, ['text']) is not None: setv(to_object, ['text'], getv(from_object, ['text'])) + if getv(from_object, ['thought']) is not None: + setv(to_object, ['thought'], getv(from_object, ['thought'])) + return to_object diff --git a/google/genai/tunings.py b/google/genai/tunings.py index 9dcf43e8..8033e654 100644 --- a/google/genai/tunings.py +++ b/google/genai/tunings.py @@ -495,6 +495,9 @@ def _TuningJob_from_mldev( if getv(from_object, ['pipelineJob']) is not None: setv(to_object, ['pipeline_job'], getv(from_object, ['pipelineJob'])) + if getv(from_object, ['serviceAccount']) is not None: + setv(to_object, ['service_account'], getv(from_object, ['serviceAccount'])) + if getv(from_object, ['tunedModelDisplayName']) is not None: setv( to_object, @@ -647,6 +650,9 @@ def _TuningJob_from_vertex( if getv(from_object, ['pipelineJob']) is not None: setv(to_object, ['pipeline_job'], getv(from_object, ['pipelineJob'])) + if getv(from_object, ['serviceAccount']) is not None: + setv(to_object, ['service_account'], getv(from_object, ['serviceAccount'])) + if getv(from_object, ['tunedModelDisplayName']) is not None: setv( to_object, diff --git a/google/genai/types.py b/google/genai/types.py index 1ec871e1..b2eb1588 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -471,6 +471,10 @@ class ExecutableCodeDict(TypedDict, total=False): class FileData(_common.BaseModel): """URI based data.""" + display_name: Optional[str] = Field( + default=None, + description="""Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is not currently used in the Gemini GenerateContent calls.""", + ) file_uri: Optional[str] = Field( default=None, description="""Required. URI.""" ) @@ -483,6 +487,9 @@ class FileData(_common.BaseModel): class FileDataDict(TypedDict, total=False): """URI based data.""" + display_name: Optional[str] + """Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is not currently used in the Gemini GenerateContent calls.""" + file_uri: Optional[str] """Required. URI.""" @@ -496,15 +503,14 @@ class FileDataDict(TypedDict, total=False): class FunctionCall(_common.BaseModel): """A function call.""" - id: Optional[str] = Field( - default=None, - description="""The unique id of the function call. If populated, the client to execute the - `function_call` and return the response with the matching `id`.""", - ) args: Optional[dict[str, Any]] = Field( default=None, description="""Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""", ) + id: Optional[str] = Field( + default=None, + description="""Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.""", + ) name: Optional[str] = Field( default=None, description="""Required. The name of the function to call. Matches [FunctionDeclaration.name].""", @@ -514,13 +520,12 @@ class FunctionCall(_common.BaseModel): class FunctionCallDict(TypedDict, total=False): """A function call.""" - id: Optional[str] - """The unique id of the function call. If populated, the client to execute the - `function_call` and return the response with the matching `id`.""" - args: Optional[dict[str, Any]] """Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.""" + id: Optional[str] + """Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.""" + name: Optional[str] """Required. The name of the function to call. Matches [FunctionDeclaration.name].""" @@ -533,8 +538,7 @@ class FunctionResponse(_common.BaseModel): id: Optional[str] = Field( default=None, - description="""The id of the function call this response is for. Populated by the client - to match the corresponding function call `id`.""", + description="""Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.""", ) name: Optional[str] = Field( default=None, @@ -550,8 +554,7 @@ class FunctionResponseDict(TypedDict, total=False): """A function response.""" id: Optional[str] - """The id of the function call this response is for. Populated by the client - to match the corresponding function call `id`.""" + """Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.""" name: Optional[str] """Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].""" @@ -569,6 +572,10 @@ class Blob(_common.BaseModel): data: Optional[bytes] = Field( default=None, description="""Required. Raw bytes.""" ) + display_name: Optional[str] = Field( + default=None, + description="""Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is not currently used in the Gemini GenerateContent calls.""", + ) mime_type: Optional[str] = Field( default=None, description="""Required. The IANA standard MIME type of the source data.""", @@ -581,6 +588,9 @@ class BlobDict(TypedDict, total=False): data: Optional[bytes] """Required. Raw bytes.""" + display_name: Optional[str] + """Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is not currently used in the Gemini GenerateContent calls.""" + mime_type: Optional[str] """Required. The IANA standard MIME type of the source data.""" @@ -599,10 +609,6 @@ class Part(_common.BaseModel): video_metadata: Optional[VideoMetadata] = Field( default=None, description="""Metadata for a given video.""" ) - thought: Optional[bool] = Field( - default=None, - description="""Indicates if the part is thought from the model.""", - ) code_execution_result: Optional[CodeExecutionResult] = Field( default=None, description="""Optional. Result of executing the [ExecutableCode].""", @@ -628,6 +634,10 @@ class Part(_common.BaseModel): text: Optional[str] = Field( default=None, description="""Optional. Text part (can be code).""" ) + thought: Optional[bool] = Field( + default=None, + description="""Output only. Indicates if the part is thought from the model.""", + ) @classmethod def from_uri(cls, *, file_uri: str, mime_type: str) -> 'Part': @@ -682,9 +692,6 @@ class PartDict(TypedDict, total=False): video_metadata: Optional[VideoMetadataDict] """Metadata for a given video.""" - thought: Optional[bool] - """Indicates if the part is thought from the model.""" - code_execution_result: Optional[CodeExecutionResultDict] """Optional. Result of executing the [ExecutableCode].""" @@ -706,6 +713,9 @@ class PartDict(TypedDict, total=False): text: Optional[str] """Optional. Text part (can be code).""" + thought: Optional[bool] + """Output only. Indicates if the part is thought from the model.""" + PartOrDict = Union[Part, PartDict] @@ -1783,6 +1793,21 @@ class ToolCodeExecutionDict(TypedDict, total=False): ToolCodeExecutionOrDict = Union[ToolCodeExecution, ToolCodeExecutionDict] +class EnterpriseWebSearch(_common.BaseModel): + """Tool to search public web data, powered by Vertex AI Search and Sec4 compliance.""" + + pass + + +class EnterpriseWebSearchDict(TypedDict, total=False): + """Tool to search public web data, powered by Vertex AI Search and Sec4 compliance.""" + + pass + + +EnterpriseWebSearchOrDict = Union[EnterpriseWebSearch, EnterpriseWebSearchDict] + + class Tool(_common.BaseModel): """Tool details of a tool that the model may use to generate a response.""" @@ -1790,22 +1815,26 @@ class Tool(_common.BaseModel): default=None, description="""List of function declarations that the tool supports.""", ) - retrieval: Optional[Retrieval] = Field( - default=None, - description="""Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.""", - ) google_search: Optional[GoogleSearch] = Field( default=None, description="""Optional. Google Search tool type. Specialized retrieval tool that is powered by Google Search.""", ) + retrieval: Optional[Retrieval] = Field( + default=None, + description="""Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.""", + ) google_search_retrieval: Optional[GoogleSearchRetrieval] = Field( default=None, description="""Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.""", ) code_execution: Optional[ToolCodeExecution] = Field( default=None, - description="""Optional. CodeExecution tool type. Enables the model to execute code as part of generation. This field is only used by the Gemini Developer API services.""", + description="""Optional. CodeExecution tool type. Enables the model to execute code as part of generation.""", + ) + enterprise_web_search: Optional[EnterpriseWebSearch] = Field( + default=None, + description="""Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance.""", ) @@ -1815,18 +1844,21 @@ class ToolDict(TypedDict, total=False): function_declarations: Optional[list[FunctionDeclarationDict]] """List of function declarations that the tool supports.""" - retrieval: Optional[RetrievalDict] - """Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.""" - google_search: Optional[GoogleSearchDict] """Optional. Google Search tool type. Specialized retrieval tool that is powered by Google Search.""" + retrieval: Optional[RetrievalDict] + """Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation.""" + google_search_retrieval: Optional[GoogleSearchRetrievalDict] """Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by Google search.""" code_execution: Optional[ToolCodeExecutionDict] - """Optional. CodeExecution tool type. Enables the model to execute code as part of generation. This field is only used by the Gemini Developer API services.""" + """Optional. CodeExecution tool type. Enables the model to execute code as part of generation.""" + + enterprise_web_search: Optional[EnterpriseWebSearchDict] + """Optional. Tool to support searching public web data, powered by Vertex AI Search and Sec4 compliance.""" ToolOrDict = Union[Tool, ToolDict] @@ -1866,6 +1898,66 @@ class FunctionCallingConfigDict(TypedDict, total=False): ] +class GoogleTypeLatLng(_common.BaseModel): + """An object that represents a latitude/longitude pair. + + This is expressed as a pair of doubles to represent degrees latitude and + degrees longitude. Unless specified otherwise, this object must conform to the + WGS84 standard. Values must be within normalized ranges. + """ + + latitude: Optional[float] = Field( + default=None, + description="""The latitude in degrees. It must be in the range [-90.0, +90.0].""", + ) + longitude: Optional[float] = Field( + default=None, + description="""The longitude in degrees. It must be in the range [-180.0, +180.0].""", + ) + + +class GoogleTypeLatLngDict(TypedDict, total=False): + """An object that represents a latitude/longitude pair. + + This is expressed as a pair of doubles to represent degrees latitude and + degrees longitude. Unless specified otherwise, this object must conform to the + WGS84 standard. Values must be within normalized ranges. + """ + + latitude: Optional[float] + """The latitude in degrees. It must be in the range [-90.0, +90.0].""" + + longitude: Optional[float] + """The longitude in degrees. It must be in the range [-180.0, +180.0].""" + + +GoogleTypeLatLngOrDict = Union[GoogleTypeLatLng, GoogleTypeLatLngDict] + + +class RetrievalConfig(_common.BaseModel): + """Retrieval config.""" + + language_code: Optional[str] = Field( + default=None, description="""The language code of the user.""" + ) + lat_lng: Optional[GoogleTypeLatLng] = Field( + default=None, description="""The location of the user.""" + ) + + +class RetrievalConfigDict(TypedDict, total=False): + """Retrieval config.""" + + language_code: Optional[str] + """The language code of the user.""" + + lat_lng: Optional[GoogleTypeLatLngDict] + """The location of the user.""" + + +RetrievalConfigOrDict = Union[RetrievalConfig, RetrievalConfigDict] + + class ToolConfig(_common.BaseModel): """Tool config. @@ -1875,6 +1967,9 @@ class ToolConfig(_common.BaseModel): function_calling_config: Optional[FunctionCallingConfig] = Field( default=None, description="""Optional. Function calling config.""" ) + retrieval_config: Optional[RetrievalConfig] = Field( + default=None, description="""Optional. Retrieval config.""" + ) class ToolConfigDict(TypedDict, total=False): @@ -1886,6 +1981,9 @@ class ToolConfigDict(TypedDict, total=False): function_calling_config: Optional[FunctionCallingConfigDict] """Optional. Function calling config.""" + retrieval_config: Optional[RetrievalConfigDict] + """Optional. Retrieval config.""" + ToolConfigOrDict = Union[ToolConfig, ToolConfigDict] @@ -1894,9 +1992,7 @@ class PrebuiltVoiceConfig(_common.BaseModel): """The configuration for the prebuilt speaker to use.""" voice_name: Optional[str] = Field( - default=None, - description="""The name of the prebuilt voice to use. - """, + default=None, description="""The name of the preset voice to use.""" ) @@ -1904,8 +2000,7 @@ class PrebuiltVoiceConfigDict(TypedDict, total=False): """The configuration for the prebuilt speaker to use.""" voice_name: Optional[str] - """The name of the prebuilt voice to use. - """ + """The name of the preset voice to use.""" PrebuiltVoiceConfigOrDict = Union[PrebuiltVoiceConfig, PrebuiltVoiceConfigDict] @@ -1916,8 +2011,7 @@ class VoiceConfig(_common.BaseModel): prebuilt_voice_config: Optional[PrebuiltVoiceConfig] = Field( default=None, - description="""The configuration for the speaker to use. - """, + description="""The configuration for the prebuilt voice to use.""", ) @@ -1925,8 +2019,7 @@ class VoiceConfigDict(TypedDict, total=False): """The configuration for the voice to use.""" prebuilt_voice_config: Optional[PrebuiltVoiceConfigDict] - """The configuration for the speaker to use. - """ + """The configuration for the prebuilt voice to use.""" VoiceConfigOrDict = Union[VoiceConfig, VoiceConfigDict] @@ -1935,31 +2028,28 @@ class VoiceConfigDict(TypedDict, total=False): class SpeechConfig(_common.BaseModel): """The speech generation configuration.""" - voice_config: Optional[VoiceConfig] = Field( - default=None, - description="""The configuration for the speaker to use. - """, - ) language_code: Optional[str] = Field( default=None, description="""Language code (ISO 639. e.g. en-US) for the speech synthesization. Only available for Live API. """, ) + voice_config: Optional[VoiceConfig] = Field( + default=None, description="""The configuration for the speaker to use.""" + ) class SpeechConfigDict(TypedDict, total=False): """The speech generation configuration.""" - voice_config: Optional[VoiceConfigDict] - """The configuration for the speaker to use. - """ - language_code: Optional[str] """Language code (ISO 639. e.g. en-US) for the speech synthesization. Only available for Live API. """ + voice_config: Optional[VoiceConfigDict] + """The configuration for the speaker to use.""" + SpeechConfigOrDict = Union[SpeechConfig, SpeechConfigDict] @@ -5323,6 +5413,9 @@ class GenerationConfig(_common.BaseModel): default=None, description="""Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.""", ) + response_modalities: Optional[list[Modality]] = Field( + default=None, description="""Optional. The modalities of the response.""" + ) response_schema: Optional[Schema] = Field( default=None, description="""Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response.""", @@ -5331,6 +5424,9 @@ class GenerationConfig(_common.BaseModel): default=None, description="""Optional. Routing configuration.""" ) seed: Optional[int] = Field(default=None, description="""Optional. Seed.""") + speech_config: Optional[SpeechConfig] = Field( + default=None, description="""Optional. The speech generation config.""" + ) stop_sequences: Optional[list[str]] = Field( default=None, description="""Optional. Stop sequences.""" ) @@ -5378,6 +5474,9 @@ class GenerationConfigDict(TypedDict, total=False): response_mime_type: Optional[str] """Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature.""" + response_modalities: Optional[list[Modality]] + """Optional. The modalities of the response.""" + response_schema: Optional[SchemaDict] """Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response.""" @@ -5387,6 +5486,9 @@ class GenerationConfigDict(TypedDict, total=False): seed: Optional[int] """Optional. Seed.""" + speech_config: Optional[SpeechConfigDict] + """Optional. The speech generation config.""" + stop_sequences: Optional[list[str]] """Optional. Stop sequences.""" @@ -6430,6 +6532,10 @@ class SupervisedTuningDatasetDistributionDict(TypedDict, total=False): class SupervisedTuningDataStats(_common.BaseModel): """Tuning data statistics for Supervised Tuning.""" + dropped_example_reasons: Optional[list[str]] = Field( + default=None, + description="""Output only. For each index in `truncated_example_indices`, the user-facing reason why the example was dropped. Must not include example itself.""", + ) total_billable_character_count: Optional[int] = Field( default=None, description="""Output only. Number of billable characters in the tuning dataset.""", @@ -6440,7 +6546,7 @@ class SupervisedTuningDataStats(_common.BaseModel): ) total_truncated_example_count: Optional[int] = Field( default=None, - description="""The number of examples in the dataset that have been truncated by any amount.""", + description="""Output only. The number of examples in the dataset that have been dropped. An example can be dropped for reasons including: too many tokens, contains an invalid image, contains too many images, etc.""", ) total_tuning_character_count: Optional[int] = Field( default=None, @@ -6448,7 +6554,7 @@ class SupervisedTuningDataStats(_common.BaseModel): ) truncated_example_indices: Optional[list[int]] = Field( default=None, - description="""A partial sample of the indices (starting from 1) of the truncated examples.""", + description="""Output only. A partial sample of the indices (starting from 1) of the dropped examples.""", ) tuning_dataset_example_count: Optional[int] = Field( default=None, @@ -6485,6 +6591,9 @@ class SupervisedTuningDataStats(_common.BaseModel): class SupervisedTuningDataStatsDict(TypedDict, total=False): """Tuning data statistics for Supervised Tuning.""" + dropped_example_reasons: Optional[list[str]] + """Output only. For each index in `truncated_example_indices`, the user-facing reason why the example was dropped. Must not include example itself.""" + total_billable_character_count: Optional[int] """Output only. Number of billable characters in the tuning dataset.""" @@ -6492,13 +6601,13 @@ class SupervisedTuningDataStatsDict(TypedDict, total=False): """Output only. Number of billable tokens in the tuning dataset.""" total_truncated_example_count: Optional[int] - """The number of examples in the dataset that have been truncated by any amount.""" + """Output only. The number of examples in the dataset that have been dropped. An example can be dropped for reasons including: too many tokens, contains an invalid image, contains too many images, etc.""" total_tuning_character_count: Optional[int] """Output only. Number of tuning characters in the tuning dataset.""" truncated_example_indices: Optional[list[int]] - """A partial sample of the indices (starting from 1) of the truncated examples.""" + """Output only. A partial sample of the indices (starting from 1) of the dropped examples.""" tuning_dataset_example_count: Optional[int] """Output only. Number of examples in the tuning dataset.""" @@ -6655,15 +6764,15 @@ class DistillationSpec(_common.BaseModel): ) pipeline_root_directory: Optional[str] = Field( default=None, - description="""Required. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts.""", + description="""Deprecated. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts.""", ) student_model: Optional[str] = Field( default=None, - description="""The student model that is being tuned, e.g., "google/gemma-2b-1.1-it".""", + description="""The student model that is being tuned, e.g., "google/gemma-2b-1.1-it". Deprecated. Use base_model instead.""", ) training_dataset_uri: Optional[str] = Field( default=None, - description="""Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""", + description="""Deprecated. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""", ) tuned_teacher_model_source: Optional[str] = Field( default=None, @@ -6685,13 +6794,13 @@ class DistillationSpecDict(TypedDict, total=False): """Optional. Hyperparameters for Distillation.""" pipeline_root_directory: Optional[str] - """Required. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts.""" + """Deprecated. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts.""" student_model: Optional[str] - """The student model that is being tuned, e.g., "google/gemma-2b-1.1-it".""" + """The student model that is being tuned, e.g., "google/gemma-2b-1.1-it". Deprecated. Use base_model instead.""" training_dataset_uri: Optional[str] - """Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""" + """Deprecated. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file.""" tuned_teacher_model_source: Optional[str] """The resource name of the Tuned teacher model. Format: `projects/{project}/locations/{location}/models/{model}`.""" @@ -6776,6 +6885,10 @@ class TuningJob(_common.BaseModel): default=None, description="""Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`.""", ) + service_account: Optional[str] = Field( + default=None, + description="""The service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent Users starting the pipeline must have the `iam.serviceAccounts.actAs` permission on this service account.""", + ) tuned_model_display_name: Optional[str] = Field( default=None, description="""Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters.""", @@ -6849,6 +6962,9 @@ class TuningJobDict(TypedDict, total=False): pipeline_job: Optional[str] """Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`.""" + service_account: Optional[str] + """The service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent Users starting the pipeline must have the `iam.serviceAccounts.actAs` permission on this service account.""" + tuned_model_display_name: Optional[str] """Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters."""