diff --git a/google/genai/_live_converters.py b/google/genai/_live_converters.py index 5512f3876..63130d80a 100644 --- a/google/genai/_live_converters.py +++ b/google/genai/_live_converters.py @@ -90,26 +90,6 @@ def _Blob_to_mldev( return to_object -def _CodeExecutionResult_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['outcome']) is not None: - setv(to_object, ['outcome'], getv(from_object, ['outcome'])) - - if getv(from_object, ['output']) is not None: - setv(to_object, ['output'], getv(from_object, ['output'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _ComputerUse_to_vertex( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -183,26 +163,6 @@ def _Content_to_vertex( return to_object -def _ExecutableCode_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['code']) is not None: - setv(to_object, ['code'], getv(from_object, ['code'])) - - if getv(from_object, ['language']) is not None: - setv(to_object, ['language'], getv(from_object, ['language'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _FileData_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -1691,19 +1651,11 @@ def _Part_to_vertex( setv( to_object, ['codeExecutionResult'], - _CodeExecutionResult_to_vertex( - getv(from_object, ['code_execution_result']), to_object - ), + getv(from_object, ['code_execution_result']), ) if getv(from_object, ['executable_code']) is not None: - setv( - to_object, - ['executableCode'], - _ExecutableCode_to_vertex( - getv(from_object, ['executable_code']), to_object - ), - ) + setv(to_object, ['executableCode'], getv(from_object, ['executable_code'])) if getv(from_object, ['file_data']) is not None: setv(to_object, ['fileData'], getv(from_object, ['file_data'])) diff --git a/google/genai/_tokens_converters.py b/google/genai/_tokens_converters.py index 8ece00fb5..f62cd4ba9 100644 --- a/google/genai/_tokens_converters.py +++ b/google/genai/_tokens_converters.py @@ -70,6 +70,113 @@ def _AuthConfig_to_mldev( return to_object +def _AuthToken_from_mldev( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ['name']) is not None: + setv(to_object, ['name'], getv(from_object, ['name'])) + + if getv(from_object, ['bidiGenerateContentSetup']) is not None: + setv( + to_object, + ['bidi_generate_content_setup'], + _BidiGenerateContentSetup_from_mldev( + getv(from_object, ['bidiGenerateContentSetup']), to_object + ), + ) + + if getv(from_object, ['expireTime']) is not None: + setv(to_object, ['expire_time'], getv(from_object, ['expireTime'])) + + if getv(from_object, ['fieldMask']) is not None: + setv(to_object, ['field_mask'], getv(from_object, ['fieldMask'])) + + if getv(from_object, ['interactionId']) is not None: + setv(to_object, ['interaction_id'], getv(from_object, ['interactionId'])) + + if getv(from_object, ['newSessionExpireTime']) is not None: + setv( + to_object, + ['new_session_expire_time'], + getv(from_object, ['newSessionExpireTime']), + ) + + if getv(from_object, ['uses']) is not None: + setv(to_object, ['uses'], getv(from_object, ['uses'])) + + return to_object + + +def _BidiGenerateContentSetup_from_mldev( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ['contextWindowCompression']) is not None: + setv( + to_object, + ['context_window_compression'], + getv(from_object, ['contextWindowCompression']), + ) + + if getv(from_object, ['generationConfig']) is not None: + setv( + to_object, + ['generation_config'], + _GenerationConfig_from_mldev( + getv(from_object, ['generationConfig']), to_object + ), + ) + + if getv(from_object, ['historyConfig']) is not None: + setv(to_object, ['history_config'], getv(from_object, ['historyConfig'])) + + if getv(from_object, ['inputAudioTranscription']) is not None: + setv( + to_object, + ['input_audio_transcription'], + getv(from_object, ['inputAudioTranscription']), + ) + + if getv(from_object, ['model']) is not None: + setv(to_object, ['model'], getv(from_object, ['model'])) + + if getv(from_object, ['outputAudioTranscription']) is not None: + setv( + to_object, + ['output_audio_transcription'], + getv(from_object, ['outputAudioTranscription']), + ) + + if getv(from_object, ['realtimeInputConfig']) is not None: + setv( + to_object, + ['realtime_input_config'], + getv(from_object, ['realtimeInputConfig']), + ) + + if getv(from_object, ['sessionResumption']) is not None: + setv( + to_object, + ['session_resumption'], + getv(from_object, ['sessionResumption']), + ) + + if getv(from_object, ['systemInstruction']) is not None: + setv( + to_object, + ['system_instruction'], + getv(from_object, ['systemInstruction']), + ) + + if getv(from_object, ['tools']) is not None: + setv(to_object, ['tools'], [item for item in getv(from_object, ['tools'])]) + + return to_object + + def _Blob_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -233,6 +340,130 @@ def _FunctionCall_to_mldev( return to_object +def _GenerationConfig_from_mldev( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + + if getv(from_object, ['responseJsonSchema']) is not None: + setv( + to_object, + ['response_json_schema'], + t.t_json_schema(getv(from_object, ['responseJsonSchema'])), + ) + + if getv(from_object, ['candidateCount']) is not None: + setv(to_object, ['candidate_count'], getv(from_object, ['candidateCount'])) + + if getv(from_object, ['enableAffectiveDialog']) is not None: + setv( + to_object, + ['enable_affective_dialog'], + getv(from_object, ['enableAffectiveDialog']), + ) + + if getv(from_object, ['frequencyPenalty']) is not None: + setv( + to_object, + ['frequency_penalty'], + getv(from_object, ['frequencyPenalty']), + ) + + if getv(from_object, ['logprobs']) is not None: + setv(to_object, ['logprobs'], getv(from_object, ['logprobs'])) + + if getv(from_object, ['maxOutputTokens']) is not None: + setv( + to_object, ['max_output_tokens'], getv(from_object, ['maxOutputTokens']) + ) + + if getv(from_object, ['mediaResolution']) is not None: + setv( + to_object, ['media_resolution'], getv(from_object, ['mediaResolution']) + ) + + if getv(from_object, ['presencePenalty']) is not None: + setv( + to_object, ['presence_penalty'], getv(from_object, ['presencePenalty']) + ) + + if getv(from_object, ['responseLogprobs']) is not None: + setv( + to_object, + ['response_logprobs'], + getv(from_object, ['responseLogprobs']), + ) + + if getv(from_object, ['responseMimeType']) is not None: + setv( + to_object, + ['response_mime_type'], + getv(from_object, ['responseMimeType']), + ) + + if getv(from_object, ['responseModalities']) is not None: + setv( + to_object, + ['response_modalities'], + getv(from_object, ['responseModalities']), + ) + + if getv(from_object, ['responseSchema']) is not None: + setv(to_object, ['response_schema'], getv(from_object, ['responseSchema'])) + + if getv(from_object, ['seed']) is not None: + setv(to_object, ['seed'], getv(from_object, ['seed'])) + + if getv(from_object, ['speechConfig']) is not None: + setv(to_object, ['speech_config'], getv(from_object, ['speechConfig'])) + + if getv(from_object, ['stopSequences']) is not None: + setv(to_object, ['stop_sequences'], getv(from_object, ['stopSequences'])) + + if getv(from_object, ['temperature']) is not None: + setv(to_object, ['temperature'], getv(from_object, ['temperature'])) + + if getv(from_object, ['thinkingConfig']) is not None: + setv(to_object, ['thinking_config'], getv(from_object, ['thinkingConfig'])) + + if getv(from_object, ['topK']) is not None: + setv(to_object, ['top_k'], getv(from_object, ['topK'])) + + if getv(from_object, ['topP']) is not None: + setv(to_object, ['top_p'], getv(from_object, ['topP'])) + + if getv(from_object, ['enableEnhancedCivicAnswers']) is not None: + setv( + to_object, + ['enable_enhanced_civic_answers'], + getv(from_object, ['enableEnhancedCivicAnswers']), + ) + + if getv(from_object, ['responseFormat']) is not None: + setv( + to_object, + ['response_format'], + [item for item in getv(from_object, ['responseFormat'])], + ) + + if getv(from_object, ['translationConfig']) is not None: + setv( + to_object, + ['translation_config'], + getv(from_object, ['translationConfig']), + ) + + if getv(from_object, ['audioTranscriptionConfig']) is not None: + setv( + to_object, + ['audio_transcription_config'], + getv(from_object, ['audioTranscriptionConfig']), + ) + + return to_object + + def _GoogleMaps_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, diff --git a/google/genai/caches.py b/google/genai/caches.py index 90c77e897..a8c4c2c46 100644 --- a/google/genai/caches.py +++ b/google/genai/caches.py @@ -99,26 +99,6 @@ def _Blob_to_mldev( return to_object -def _CodeExecutionResult_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['outcome']) is not None: - setv(to_object, ['outcome'], getv(from_object, ['outcome'])) - - if getv(from_object, ['output']) is not None: - setv(to_object, ['output'], getv(from_object, ['output'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _ComputerUse_to_vertex( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -413,26 +393,6 @@ def _DeleteCachedContentResponse_from_vertex( return to_object -def _ExecutableCode_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['code']) is not None: - setv(to_object, ['code'], getv(from_object, ['code'])) - - if getv(from_object, ['language']) is not None: - setv(to_object, ['language'], getv(from_object, ['language'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _FileData_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -819,19 +779,11 @@ def _Part_to_vertex( setv( to_object, ['codeExecutionResult'], - _CodeExecutionResult_to_vertex( - getv(from_object, ['code_execution_result']), to_object - ), + getv(from_object, ['code_execution_result']), ) if getv(from_object, ['executable_code']) is not None: - setv( - to_object, - ['executableCode'], - _ExecutableCode_to_vertex( - getv(from_object, ['executable_code']), to_object - ), - ) + setv(to_object, ['executableCode'], getv(from_object, ['executable_code'])) if getv(from_object, ['file_data']) is not None: setv(to_object, ['fileData'], getv(from_object, ['file_data'])) diff --git a/google/genai/models.py b/google/genai/models.py index 0bcb2f436..3fd30b702 100644 --- a/google/genai/models.py +++ b/google/genai/models.py @@ -207,27 +207,6 @@ def _CitationMetadata_from_mldev( return to_object -def _CodeExecutionResult_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, - root_object: Optional[Union[dict[str, Any], object]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['outcome']) is not None: - setv(to_object, ['outcome'], getv(from_object, ['outcome'])) - - if getv(from_object, ['output']) is not None: - setv(to_object, ['output'], getv(from_object, ['output'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _ComputeTokensParameters_to_vertex( api_client: BaseApiClient, from_object: Union[dict[str, Any], object], @@ -1172,27 +1151,6 @@ def _Endpoint_from_vertex( return to_object -def _ExecutableCode_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, - root_object: Optional[Union[dict[str, Any], object]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['code']) is not None: - setv(to_object, ['code'], getv(from_object, ['code'])) - - if getv(from_object, ['language']) is not None: - setv(to_object, ['language'], getv(from_object, ['language'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _FileData_to_mldev( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -3726,19 +3684,11 @@ def _Part_to_vertex( setv( to_object, ['codeExecutionResult'], - _CodeExecutionResult_to_vertex( - getv(from_object, ['code_execution_result']), to_object, root_object - ), + getv(from_object, ['code_execution_result']), ) if getv(from_object, ['executable_code']) is not None: - setv( - to_object, - ['executableCode'], - _ExecutableCode_to_vertex( - getv(from_object, ['executable_code']), to_object, root_object - ), - ) + setv(to_object, ['executableCode'], getv(from_object, ['executable_code'])) if getv(from_object, ['file_data']) is not None: setv(to_object, ['fileData'], getv(from_object, ['file_data'])) diff --git a/google/genai/tunings.py b/google/genai/tunings.py index 13d9283e6..8ef516b3e 100644 --- a/google/genai/tunings.py +++ b/google/genai/tunings.py @@ -138,27 +138,6 @@ def _CancelTuningJobResponse_from_vertex( return to_object -def _CodeExecutionResult_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, - root_object: Optional[Union[dict[str, Any], object]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['outcome']) is not None: - setv(to_object, ['outcome'], getv(from_object, ['outcome'])) - - if getv(from_object, ['output']) is not None: - setv(to_object, ['output'], getv(from_object, ['output'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _CompositeReinforcementTuningRewardConfigWeightedRewardConfig_from_vertex( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -1108,27 +1087,6 @@ def _EvaluationConfig_to_vertex( return to_object -def _ExecutableCode_to_vertex( - from_object: Union[dict[str, Any], object], - parent_object: Optional[dict[str, Any]] = None, - root_object: Optional[Union[dict[str, Any], object]] = None, -) -> dict[str, Any]: - to_object: dict[str, Any] = {} - if getv(from_object, ['code']) is not None: - setv(to_object, ['code'], getv(from_object, ['code'])) - - if getv(from_object, ['language']) is not None: - setv(to_object, ['language'], getv(from_object, ['language'])) - - if getv(from_object, ['id']) is not None: - raise ValueError( - 'id parameter is only supported in Gemini Developer API mode, not in' - ' Gemini Enterprise Agent Platform mode.' - ) - - return to_object - - def _GenerationConfig_from_vertex( from_object: Union[dict[str, Any], object], parent_object: Optional[dict[str, Any]] = None, @@ -1517,19 +1475,11 @@ def _Part_to_vertex( setv( to_object, ['codeExecutionResult'], - _CodeExecutionResult_to_vertex( - getv(from_object, ['code_execution_result']), to_object, root_object - ), + getv(from_object, ['code_execution_result']), ) if getv(from_object, ['executable_code']) is not None: - setv( - to_object, - ['executableCode'], - _ExecutableCode_to_vertex( - getv(from_object, ['executable_code']), to_object, root_object - ), - ) + setv(to_object, ['executableCode'], getv(from_object, ['executable_code'])) if getv(from_object, ['file_data']) is not None: setv(to_object, ['fileData'], getv(from_object, ['file_data'])) diff --git a/google/genai/types.py b/google/genai/types.py index fdcd187dd..5dc66f480 100644 --- a/google/genai/types.py +++ b/google/genai/types.py @@ -405,6 +405,8 @@ class HarmCategory(_common.CaseInSensitiveEnum): """Content that promotes, facilitates, or enables dangerous activities.""" HARM_CATEGORY_CIVIC_INTEGRITY = 'HARM_CATEGORY_CIVIC_INTEGRITY' """Deprecated: Election filter is not longer supported. The harm category is civic integrity.""" + HARM_CATEGORY_JAILBREAK = 'HARM_CATEGORY_JAILBREAK' + """Prompts designed to bypass safety filters.""" HARM_CATEGORY_IMAGE_HATE = 'HARM_CATEGORY_IMAGE_HATE' """Images that contain hate speech. This enum value is not supported in Gemini API.""" HARM_CATEGORY_IMAGE_DANGEROUS_CONTENT = ( @@ -417,8 +419,6 @@ class HarmCategory(_common.CaseInSensitiveEnum): 'HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT' ) """Images that contain sexually explicit content. This enum value is not supported in Gemini API.""" - HARM_CATEGORY_JAILBREAK = 'HARM_CATEGORY_JAILBREAK' - """Prompts designed to bypass safety filters. This enum value is not supported in Gemini API.""" class HarmBlockMethod(_common.CaseInSensitiveEnum): @@ -1578,7 +1578,7 @@ class CodeExecutionResult(_common.BaseModel): ) id: Optional[str] = Field( default=None, - description="""Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.""", + description="""Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.""", ) @@ -1595,7 +1595,7 @@ class CodeExecutionResultDict(TypedDict, total=False): """Optional. Contains stdout when code execution is successful, stderr or other description otherwise.""" id: Optional[str] - """Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI.""" + """Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id.""" CodeExecutionResultOrDict = Union[CodeExecutionResult, CodeExecutionResultDict] @@ -1618,7 +1618,7 @@ class ExecutableCode(_common.BaseModel): ) id: Optional[str] = Field( default=None, - description="""Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.""", + description="""Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.""", ) @@ -1637,7 +1637,7 @@ class ExecutableCodeDict(TypedDict, total=False): """Required. Programming language of the `code`.""" id: Optional[str] - """Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI.""" + """Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`.""" ExecutableCodeOrDict = Union[ExecutableCode, ExecutableCodeDict] @@ -3846,7 +3846,7 @@ class GoogleMaps(_common.BaseModel): ) grounding_types: Optional[GoogleMapsGroundingTypes] = Field( default=None, - description="""Optional. Specifies the types of Google Maps grounding to enable. This field is not supported in Gemini API.""", + description="""Optional. Specifies the types of Google Maps grounding to enable. Defaults to `places` when unset. This field is not supported in Gemini API.""", ) @@ -3860,7 +3860,7 @@ class GoogleMapsDict(TypedDict, total=False): """Deprecated. The Google Maps contextual widget behavior in Grounding with Google Maps is being deprecated; this field is planned for removal and no longer has any effect once removed. Optional. Whether to return a widget context token in the GroundingMetadata of the response.""" grounding_types: Optional[GoogleMapsGroundingTypesDict] - """Optional. Specifies the types of Google Maps grounding to enable. This field is not supported in Gemini API.""" + """Optional. Specifies the types of Google Maps grounding to enable. Defaults to `places` when unset. This field is not supported in Gemini API.""" GoogleMapsOrDict = Union[GoogleMaps, GoogleMapsDict] @@ -5055,6 +5055,14 @@ class ToolParallelAiSearch(_common.BaseModel): default=None, description="""Optional. Custom configs for ParallelAiSearch. This field can be used to pass any parameter from the Parallel.ai Search API. See the Parallel.ai documentation for the full list of available parameters and their usage: https://docs.parallel.ai/api-reference/search-beta/search Currently only `source_policy`, `excerpts`, `max_results`, `mode`, `fetch_policy` can be set via this field. For example: { "source_policy": { "include_domains": ["google.com", "wikipedia.org"], "exclude_domains": ["example.com"] }, "fetch_policy": { "max_age_seconds": 3600 } }""", ) + enable_data_retention: Optional[bool] = Field( + default=None, + description="""Optional. Deprecated: Use `enable_zero_data_retention` instead. Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. If this value is "false" or omitted, the Parallel Web Search for Grounding standard subscription will be used. If this value is "true", the Parallel Web Search for Grounding - ZDR subscription will be used.""", + ) + enable_zero_data_retention: Optional[bool] = Field( + default=None, + description="""Optional. Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. If this value is "false" or omitted, the Parallel Web Search for Grounding standard subscription will be used. If this value is "true", the Parallel Web Search for Grounding - ZDR subscription will be used.""", + ) class ToolParallelAiSearchDict(TypedDict, total=False): @@ -5070,6 +5078,12 @@ class ToolParallelAiSearchDict(TypedDict, total=False): custom_configs: Optional[dict[str, Any]] """Optional. Custom configs for ParallelAiSearch. This field can be used to pass any parameter from the Parallel.ai Search API. See the Parallel.ai documentation for the full list of available parameters and their usage: https://docs.parallel.ai/api-reference/search-beta/search Currently only `source_policy`, `excerpts`, `max_results`, `mode`, `fetch_policy` can be set via this field. For example: { "source_policy": { "include_domains": ["google.com", "wikipedia.org"], "exclude_domains": ["example.com"] }, "fetch_policy": { "max_age_seconds": 3600 } }""" + enable_data_retention: Optional[bool] + """Optional. Deprecated: Use `enable_zero_data_retention` instead. Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. If this value is "false" or omitted, the Parallel Web Search for Grounding standard subscription will be used. If this value is "true", the Parallel Web Search for Grounding - ZDR subscription will be used.""" + + enable_zero_data_retention: Optional[bool] + """Optional. Instructs Vertex Grounding to use Parallel's Zero Data Retention Marketplace product. If this value is "false" or omitted, the Parallel Web Search for Grounding standard subscription will be used. If this value is "true", the Parallel Web Search for Grounding - ZDR subscription will be used.""" + ToolParallelAiSearchOrDict = Union[ ToolParallelAiSearch, ToolParallelAiSearchDict @@ -11337,7 +11351,7 @@ class GenerationConfig(_common.BaseModel): ) enable_affective_dialog: Optional[bool] = Field( default=None, - 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.""", + 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.""", ) frequency_penalty: Optional[float] = Field( default=None, @@ -11443,7 +11457,7 @@ class GenerationConfigDict(TypedDict, total=False): """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.""" enable_affective_dialog: Optional[bool] - """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.""" + """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.""" frequency_penalty: Optional[float] """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].""" @@ -13562,6 +13576,10 @@ class ReinforcementTuningHyperParameters(_common.BaseModel): default=None, description="""Optional. The thinking budget for the tuning job to optimize for (Gemini 2.5 only). * -1 means dynamic thinking * 0 means no thinking * > 0 means thinking budget in tokens If not set, default to -1 (dynamic thinking).""", ) + step_count: Optional[int] = Field( + default=None, + description="""Optional. Number of steps for the tuning job (mutually exclusive with epoch_count).""", + ) class ReinforcementTuningHyperParametersDict(TypedDict, total=False): @@ -13597,6 +13615,9 @@ class ReinforcementTuningHyperParametersDict(TypedDict, total=False): thinking_budget: Optional[int] """Optional. The thinking budget for the tuning job to optimize for (Gemini 2.5 only). * -1 means dynamic thinking * 0 means no thinking * > 0 means thinking budget in tokens If not set, default to -1 (dynamic thinking).""" + step_count: Optional[int] + """Optional. Number of steps for the tuning job (mutually exclusive with epoch_count).""" + ReinforcementTuningHyperParametersOrDict = Union[ ReinforcementTuningHyperParameters, ReinforcementTuningHyperParametersDict @@ -22278,11 +22299,129 @@ class LiveMusicSetWeightedPromptsParametersDict(TypedDict, total=False): ] +class BidiGenerateContentSetup(_common.BaseModel): + """Message to be sent in the first (and only in the first) `BidiGenerateContentClientMessage`. + + Contains configuration that will apply for the duration of the streaming RPC. + Clients should wait for a `BidiGenerateContentSetupComplete` message before + sending any additional messages. This data type is not supported in Vertex AI. + """ + + context_window_compression: Optional[ContextWindowCompressionConfig] = Field( + default=None, + description="""Optional. Configures a context window compression mechanism. If included, the server will automatically reduce the size of the context when it exceeds the configured length.""", + ) + generation_config: Optional[GenerationConfig] = Field( + default=None, + description="""Optional. Generation config. The following fields are not supported: - `response_logprobs` - `response_mime_type` - `logprobs` - `response_schema` - `response_json_schema` - `stop_sequence` - `skip_response_cache` - `routing_config` - `audio_timestamp`""", + ) + history_config: Optional[HistoryConfig] = Field( + default=None, + description="""Optional. Configures the exchange of history between the client and the server.""", + ) + input_audio_transcription: Optional[AudioTranscriptionConfig] = Field( + default=None, + description="""Optional. If set, enables transcription of voice input. The transcription aligns with the input audio language, if configured.""", + ) + model: Optional[str] = Field( + default=None, + description="""Required. The model's resource name. This serves as an ID for the Model to use. Format: `models/{model}`""", + ) + output_audio_transcription: Optional[AudioTranscriptionConfig] = Field( + default=None, + description="""Optional. If set, enables transcription of the model's audio output. The transcription aligns with the language code specified for the output audio, if configured.""", + ) + realtime_input_config: Optional[RealtimeInputConfig] = Field( + default=None, + description="""Optional. Configures the handling of realtime input.""", + ) + session_resumption: Optional[SessionResumptionConfig] = Field( + default=None, + description="""Optional. Configures session resumption mechanism. If included, the server will send `SessionResumptionUpdate` messages.""", + ) + system_instruction: Optional[Content] = Field( + default=None, + description="""Optional. The user provided system instructions for the model. Note: Only text should be used in parts and content in each part will be in a separate paragraph.""", + ) + tools: Optional[list[Tool]] = Field( + default=None, + description="""Optional. A list of `Tools` the model may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.""", + ) + + +class BidiGenerateContentSetupDict(TypedDict, total=False): + """Message to be sent in the first (and only in the first) `BidiGenerateContentClientMessage`. + + Contains configuration that will apply for the duration of the streaming RPC. + Clients should wait for a `BidiGenerateContentSetupComplete` message before + sending any additional messages. This data type is not supported in Vertex AI. + """ + + context_window_compression: Optional[ContextWindowCompressionConfigDict] + """Optional. Configures a context window compression mechanism. If included, the server will automatically reduce the size of the context when it exceeds the configured length.""" + + generation_config: Optional[GenerationConfigDict] + """Optional. Generation config. The following fields are not supported: - `response_logprobs` - `response_mime_type` - `logprobs` - `response_schema` - `response_json_schema` - `stop_sequence` - `skip_response_cache` - `routing_config` - `audio_timestamp`""" + + history_config: Optional[HistoryConfigDict] + """Optional. Configures the exchange of history between the client and the server.""" + + input_audio_transcription: Optional[AudioTranscriptionConfigDict] + """Optional. If set, enables transcription of voice input. The transcription aligns with the input audio language, if configured.""" + + model: Optional[str] + """Required. The model's resource name. This serves as an ID for the Model to use. Format: `models/{model}`""" + + output_audio_transcription: Optional[AudioTranscriptionConfigDict] + """Optional. If set, enables transcription of the model's audio output. The transcription aligns with the language code specified for the output audio, if configured.""" + + realtime_input_config: Optional[RealtimeInputConfigDict] + """Optional. Configures the handling of realtime input.""" + + session_resumption: Optional[SessionResumptionConfigDict] + """Optional. Configures session resumption mechanism. If included, the server will send `SessionResumptionUpdate` messages.""" + + system_instruction: Optional[ContentDict] + """Optional. The user provided system instructions for the model. Note: Only text should be used in parts and content in each part will be in a separate paragraph.""" + + tools: Optional[list[ToolDict]] + """Optional. A list of `Tools` the model may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.""" + + +BidiGenerateContentSetupOrDict = Union[ + BidiGenerateContentSetup, BidiGenerateContentSetupDict +] + + class AuthToken(_common.BaseModel): """Config for auth_tokens.create parameters.""" name: Optional[str] = Field( - default=None, description="""The name of the auth token.""" + default=None, description="""Output only. Identifier. The token itself.""" + ) + bidi_generate_content_setup: Optional[BidiGenerateContentSetup] = Field( + default=None, + description="""Optional. Input only. Immutable. Configuration specific to `BidiGenerateContent`.""", + ) + expire_time: Optional[datetime.datetime] = Field( + default=None, + description="""Optional. Input only. Immutable. An optional time after which, when using the resulting token, messages in BidiGenerateContent sessions will be rejected. (Gemini may preemptively close the session after this time.) If not set then this defaults to 30 minutes in the future. If set, this value must be less than 20 hours in the future.""", + ) + field_mask: Optional[str] = Field( + default=None, + description="""Optional. Input only. Immutable. If field_mask is empty, and `bidi_generate_content_setup` is not present, then the effective `BidiGenerateContentSetup` message is taken from the Live API connection. If field_mask is empty, and `bidi_generate_content_setup` _is_ present, then the effective `BidiGenerateContentSetup` message is taken entirely from `bidi_generate_content_setup` in this request. The setup message from the Live API connection is ignored. If field_mask is not empty, then the corresponding fields from `bidi_generate_content_setup` will overwrite the fields from the setup message in the Live API connection.""", + ) + interaction_id: Optional[str] = Field( + default=None, + description="""Optional. Input only. Immutable. The interaction ID that this token is scoped to. Specific to the Live Interactions API.""", + ) + new_session_expire_time: Optional[datetime.datetime] = Field( + default=None, + description="""Optional. Input only. Immutable. The time after which new Live API sessions using the token resulting from this request will be rejected. If not set this defaults to 60 seconds in the future. If set, this value must be less than 20 hours in the future.""", + ) + uses: Optional[int] = Field( + default=None, + description="""Optional. Input only. Immutable. The number of times the token can be used. If this value is zero then no limit is applied. Resuming a Live API session does not count as a use. If unspecified, the default is 1.""", ) @@ -22290,7 +22429,25 @@ class AuthTokenDict(TypedDict, total=False): """Config for auth_tokens.create parameters.""" name: Optional[str] - """The name of the auth token.""" + """Output only. Identifier. The token itself.""" + + bidi_generate_content_setup: Optional[BidiGenerateContentSetupDict] + """Optional. Input only. Immutable. Configuration specific to `BidiGenerateContent`.""" + + expire_time: Optional[datetime.datetime] + """Optional. Input only. Immutable. An optional time after which, when using the resulting token, messages in BidiGenerateContent sessions will be rejected. (Gemini may preemptively close the session after this time.) If not set then this defaults to 30 minutes in the future. If set, this value must be less than 20 hours in the future.""" + + field_mask: Optional[str] + """Optional. Input only. Immutable. If field_mask is empty, and `bidi_generate_content_setup` is not present, then the effective `BidiGenerateContentSetup` message is taken from the Live API connection. If field_mask is empty, and `bidi_generate_content_setup` _is_ present, then the effective `BidiGenerateContentSetup` message is taken entirely from `bidi_generate_content_setup` in this request. The setup message from the Live API connection is ignored. If field_mask is not empty, then the corresponding fields from `bidi_generate_content_setup` will overwrite the fields from the setup message in the Live API connection.""" + + interaction_id: Optional[str] + """Optional. Input only. Immutable. The interaction ID that this token is scoped to. Specific to the Live Interactions API.""" + + new_session_expire_time: Optional[datetime.datetime] + """Optional. Input only. Immutable. The time after which new Live API sessions using the token resulting from this request will be rejected. If not set this defaults to 60 seconds in the future. If set, this value must be less than 20 hours in the future.""" + + uses: Optional[int] + """Optional. Input only. Immutable. The number of times the token can be used. If this value is zero then no limit is applied. Resuming a Live API session does not count as a use. If unspecified, the default is 1.""" AuthTokenOrDict = Union[AuthToken, AuthTokenDict]