Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions agentplatform/_genai/evals.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ def _CustomCodeExecutionSpec_from_vertex(
getv(from_object, ["evaluation_function"]),
)

if getv(from_object, ["codeExecutionRegion"]) is not None:
setv(
to_object,
["code_execution_region"],
getv(from_object, ["codeExecutionRegion"]),
)

return to_object


Expand All @@ -237,6 +244,13 @@ def _CustomCodeExecutionSpec_to_vertex(
getv(from_object, ["remote_custom_function"]),
)

if getv(from_object, ["code_execution_region"]) is not None:
setv(
to_object,
["codeExecutionRegion"],
getv(from_object, ["code_execution_region"]),
)

return to_object


Expand Down
2 changes: 2 additions & 0 deletions agentplatform/_genai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,7 @@
from .common import MapInstance
from .common import MapInstanceDict
from .common import MapInstanceOrDict
from .common import MediaProcessing
from .common import MediaResolution
from .common import Memory
from .common import MemoryBank
Expand Down Expand Up @@ -4326,6 +4327,7 @@
"Modality",
"DeploymentType",
"ModelProvider",
"MediaProcessing",
"Outcome",
"FunctionResponseScheduling",
"MediaResolution",
Expand Down
64 changes: 46 additions & 18 deletions agentplatform/_genai/types/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class SandboxState(_common.CaseInSensitiveEnum):
"""Sandbox has terminated with underlying runtime failure."""
STATE_DELETED = "STATE_DELETED"
"""Sandbox runtime has been deleted."""
STATE_STOPPING = "STATE_STOPPING"
"""Sandbox runtime is stopping."""


class Protocol(_common.CaseInSensitiveEnum):
Expand Down Expand Up @@ -582,6 +584,17 @@ class ModelProvider(_common.CaseInSensitiveEnum):
"""Anthropic."""


class MediaProcessing(_common.CaseInSensitiveEnum):
"""How the model processes this part's media for understanding. Only meaningful for video parts (`inline_data` or `file_data` with video mime). Non-video parts ignore this field."""

MEDIA_PROCESSING_UNSPECIFIED = "MEDIA_PROCESSING_UNSPECIFIED"
"""Default. Uses model-specific processing (3.5 Pro+ -> `AGENTIC`, older models -> `STATIC`)."""
STATIC = "STATIC"
"""Fixed-rate frame extraction. All frames placed in context."""
AGENTIC = "AGENTIC"
"""Model-driven dynamic navigation. Recommended for most use cases."""


class Outcome(_common.CaseInSensitiveEnum):
"""Outcome of the code execution."""

Expand Down Expand Up @@ -1682,6 +1695,10 @@ def evaluate(instance: dict[str, Any]) -> float:
Instance is the evaluation instance, any fields populated in the instance
are available to the function as instance[field_name].""",
)
code_execution_region: Optional[str] = Field(
default=None,
description="""Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. Supported regions: us-central1, us-east1, us-east4, us-west1, us-west4, southamerica-east1, europe-west2, europe-west3, asia-east1, asia-south1, asia-southeast1. If unset, the request's originating region is used; requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED.""",
)


class CustomCodeExecutionSpecDict(TypedDict, total=False):
Expand All @@ -1701,6 +1718,9 @@ def evaluate(instance: dict[str, Any]) -> float:
Instance is the evaluation instance, any fields populated in the instance
are available to the function as instance[field_name]."""

code_execution_region: Optional[str]
"""Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. Supported regions: us-central1, us-east1, us-east4, us-west1, us-west4, southamerica-east1, europe-west2, europe-west3, asia-east1, asia-south1, asia-southeast1. If unset, the request's originating region is used; requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED."""


CustomCodeExecutionSpecOrDict = Union[
CustomCodeExecutionSpec, CustomCodeExecutionSpecDict
Expand Down Expand Up @@ -6642,7 +6662,7 @@ class ReservationAffinity(_common.BaseModel):
)
values: Optional[list[str]] = Field(
default=None,
description="""Optional. Corresponds to the label values of a reservation resource. This must be the full resource name of the reservation or reservation block.""",
description="""Optional. Corresponds to the label values of a reservation resource. This must be the resource name of the reservation, reservation block, or reservation sub- block.""",
)


Expand All @@ -6656,7 +6676,7 @@ class ReservationAffinityDict(TypedDict, total=False):
"""Required. Specifies the reservation affinity type."""

values: Optional[list[str]]
"""Optional. Corresponds to the label values of a reservation resource. This must be the full resource name of the reservation or reservation block."""
"""Optional. Corresponds to the label values of a reservation resource. This must be the resource name of the reservation, reservation block, or reservation sub- block."""


ReservationAffinityOrDict = Union[ReservationAffinity, ReservationAffinityDict]
Expand Down Expand Up @@ -16541,13 +16561,13 @@ class SandboxEnvironmentSpecComputerUseEnvironmentDict(TypedDict, total=False):


class SandboxEnvironmentSpecShellEnvironment(_common.BaseModel):
"""The shell environment with customized settings."""
"""The shell environment."""

pass


class SandboxEnvironmentSpecShellEnvironmentDict(TypedDict, total=False):
"""The shell environment with customized settings."""
"""The shell environment."""

pass

Expand All @@ -16567,7 +16587,8 @@ class SandboxEnvironmentSpec(_common.BaseModel):
Field(default=None, description="""Optional. The computer use environment.""")
)
shell_environment: Optional[SandboxEnvironmentSpecShellEnvironment] = Field(
default=None, description="""Optional. The shell environment."""
default=None,
description="""Optional. The shell environment for executing shell commands and scripts.""",
)


Expand All @@ -16583,7 +16604,7 @@ class SandboxEnvironmentSpecDict(TypedDict, total=False):
"""Optional. The computer use environment."""

shell_environment: Optional[SandboxEnvironmentSpecShellEnvironmentDict]
"""Optional. The shell environment."""
"""Optional. The shell environment for executing shell commands and scripts."""


SandboxEnvironmentSpecOrDict = Union[SandboxEnvironmentSpec, SandboxEnvironmentSpecDict]
Expand Down Expand Up @@ -17528,11 +17549,11 @@ class SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfig(_common.Base
)
target_network: Optional[str] = Field(
default=None,
description="""Required. The VPC network name in the target_project where the DNS zone specified by 'domain' is visible.""",
description="""Required. The VPC network name in the target_project where the DNS zone specified by `domain` is visible.""",
)
target_project: Optional[str] = Field(
default=None,
description="""Required. The project ID hosting the Cloud DNS managed zone that contains the 'domain'. The Vertex AI Service Agent requires the dns.peer role on this project.""",
description="""Required. The project ID hosting the Cloud DNS managed zone that contains the `domain`. The Vertex AI Service Agent requires the dns.peer role on this project.""",
)


Expand All @@ -17545,10 +17566,10 @@ class SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfigDict(
"""Required. The DNS name suffix of the zone being peered to, e.g., "my-internal-domain.corp.". Must end with a dot."""

target_network: Optional[str]
"""Required. The VPC network name in the target_project where the DNS zone specified by 'domain' is visible."""
"""Required. The VPC network name in the target_project where the DNS zone specified by `domain` is visible."""

target_project: Optional[str]
"""Required. The project ID hosting the Cloud DNS managed zone that contains the 'domain'. The Vertex AI Service Agent requires the dns.peer role on this project."""
"""Required. The project ID hosting the Cloud DNS managed zone that contains the `domain`. The Vertex AI Service Agent requires the dns.peer role on this project."""


SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfigOrDict = Union[
Expand All @@ -17575,7 +17596,7 @@ class SandboxEnvironmentTemplateEgressControlConfig(_common.BaseModel):
)
network_attachment: Optional[str] = Field(
default=None,
description="""Optional. The name of the customer VPC NetworkAttachment used to draw a PSC interface IP into the customer VPC for sandbox egress.""",
description="""Optional. The name of the customer VPC `NetworkAttachment` used to draw a PSC interface IP into the customer VPC for sandbox egress.""",
)


Expand All @@ -17594,7 +17615,7 @@ class SandboxEnvironmentTemplateEgressControlConfigDict(TypedDict, total=False):
"""Optional. DNS peering configurations that allow sandbox egress to resolve customer-internal domains via the customer VPC."""

network_attachment: Optional[str]
"""Optional. The name of the customer VPC NetworkAttachment used to draw a PSC interface IP into the customer VPC for sandbox egress."""
"""Optional. The name of the customer VPC `NetworkAttachment` used to draw a PSC interface IP into the customer VPC for sandbox egress."""


SandboxEnvironmentTemplateEgressControlConfigOrDict = Union[
Expand Down Expand Up @@ -20953,6 +20974,10 @@ class SchemaPromptSpecAppBuilderData(_common.BaseModel):
description="""Linked resources attached to the application by the user.""",
)
)
deployed_regions: Optional[list[str]] = Field(
default=None,
description="""Optional. The Cloud Run regions in which the application is currently deployed. Used to rediscover and redeploy the app in the regions it already runs in, which may differ from the prompt's location.""",
)


class SchemaPromptSpecAppBuilderDataDict(TypedDict, total=False):
Expand All @@ -20967,6 +20992,9 @@ class SchemaPromptSpecAppBuilderDataDict(TypedDict, total=False):
linked_resources: Optional[list[SchemaPromptSpecAppBuilderDataLinkedResourceDict]]
"""Linked resources attached to the application by the user."""

deployed_regions: Optional[list[str]]
"""Optional. The Cloud Run regions in which the application is currently deployed. Used to rediscover and redeploy the app in the regions it already runs in, which may differ from the prompt's location."""


SchemaPromptSpecAppBuilderDataOrDict = Union[
SchemaPromptSpecAppBuilderData, SchemaPromptSpecAppBuilderDataDict
Expand Down Expand Up @@ -28654,33 +28682,33 @@ class AudioTranscriptionWordInfoDict(TypedDict, total=False):


class AudioTranscription(_common.BaseModel):
"""The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label."""
"""The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`."""

speaker_label: Optional[str] = Field(
default=None,
description="""Optional. A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). Present when diarization is set.""",
description="""Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.""",
)
text: Optional[str] = Field(
default=None,
description="""Required. The transcription text of this audio segment.""",
)
words: Optional[list[AudioTranscriptionWordInfo]] = Field(
default=None,
description="""Optional. Detailed word-level transcriptions and timing details. Present when word_timestamp is set.""",
description="""Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.""",
)


class AudioTranscriptionDict(TypedDict, total=False):
"""The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label."""
"""The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`."""

speaker_label: Optional[str]
"""Optional. A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). Present when diarization is set."""
"""Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set."""

text: Optional[str]
"""Required. The transcription text of this audio segment."""

words: Optional[list[AudioTranscriptionWordInfoDict]]
"""Optional. Detailed word-level transcriptions and timing details. Present when word_timestamp is set."""
"""Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set."""


AudioTranscriptionOrDict = Union[AudioTranscription, AudioTranscriptionDict]
Expand Down
Loading