Skip to content

Commit 78a0139

Browse files
sararobcopybara-github
authored andcommitted
feat: Add bidiGenerateContentSetup, expireTime, fieldMask, newSessionExpireTime, and uses to AuthToken. Add audioTranscriptionConfig to GenerationConfig. Add buildSpec to ReasoningEngineSpec. Add stepCount to ReinforcementTuningHyperParameters. Add enableDataRetention and enableZeroDataRetention to ToolParallelAiSearch.
PiperOrigin-RevId: 952092382
1 parent f93c455 commit 78a0139

3 files changed

Lines changed: 64 additions & 69 deletions

File tree

agentplatform/_genai/evals.py

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3095,25 +3095,7 @@ def create_evaluation_run(
30953095
if isinstance(config, dict):
30963096
config = types.CreateEvaluationRunConfig.model_validate(config)
30973097

3098-
# Auto-construct inference_configs when agent_info is explicitly
3099-
# provided (existing behavior) OR an agent resource is provided
3100-
# (allows omitting agent_info for both Gemini Agents and Agent
3101-
# Engine). The server skips inference per-item when a
3102-
# CandidateResponse with a matching candidate name already exists,
3103-
# so it is safe to always send inference_configs.
3104-
_should_auto_infer = not inference_configs and (agent_info or agent)
3105-
if _should_auto_infer:
3106-
if not parsed_agent_info.name:
3107-
# Prefer the dataset's candidate_name (set by run_inference)
3108-
# so the inference_configs key matches the CandidateResponse
3109-
# and the server correctly skips already-completed items.
3110-
if (
3111-
isinstance(dataset, types.EvaluationDataset)
3112-
and dataset.candidate_name
3113-
):
3114-
parsed_agent_info.name = dataset.candidate_name
3115-
else:
3116-
parsed_agent_info.name = _evals_common._DEFAULT_CANDIDATE_NAME
3098+
if agent_info and not inference_configs:
31173099
parsed_user_simulator_config = (
31183100
evals_types.UserSimulatorConfig.model_validate(user_simulator_config)
31193101
if isinstance(user_simulator_config, dict)
@@ -3122,9 +3104,7 @@ def create_evaluation_run(
31223104
if getattr(parsed_user_simulator_config, "max_turn", None) is None:
31233105
parsed_user_simulator_config.max_turn = 5
31243106

3125-
candidate_name = (
3126-
parsed_agent_info.name or _evals_common._DEFAULT_CANDIDATE_NAME
3127-
)
3107+
candidate_name = parsed_agent_info.name or "candidate-1"
31283108
if agent and _evals_common._is_gemini_agent_resource(agent):
31293109
agent_run_config = types.AgentRunConfig(
31303110
gemini_agent_config=types.GeminiAgentConfig(gemini_agent=agent),
@@ -5183,25 +5163,7 @@ async def create_evaluation_run(
51835163
if isinstance(config, dict):
51845164
config = types.CreateEvaluationRunConfig.model_validate(config)
51855165

5186-
# Auto-construct inference_configs when agent_info is explicitly
5187-
# provided (existing behavior) OR an agent resource is provided
5188-
# (allows omitting agent_info for both Gemini Agents and Agent
5189-
# Engine). The server skips inference per-item when a
5190-
# CandidateResponse with a matching candidate name already exists,
5191-
# so it is safe to always send inference_configs.
5192-
_should_auto_infer = not inference_configs and (agent_info or agent)
5193-
if _should_auto_infer:
5194-
if not parsed_agent_info.name:
5195-
# Prefer the dataset's candidate_name (set by run_inference)
5196-
# so the inference_configs key matches the CandidateResponse
5197-
# and the server correctly skips already-completed items.
5198-
if (
5199-
isinstance(dataset, types.EvaluationDataset)
5200-
and dataset.candidate_name
5201-
):
5202-
parsed_agent_info.name = dataset.candidate_name
5203-
else:
5204-
parsed_agent_info.name = _evals_common._DEFAULT_CANDIDATE_NAME
5166+
if agent_info and not inference_configs:
52055167
parsed_user_simulator_config = (
52065168
evals_types.UserSimulatorConfig.model_validate(user_simulator_config)
52075169
if isinstance(user_simulator_config, dict)
@@ -5210,9 +5172,7 @@ async def create_evaluation_run(
52105172
if getattr(parsed_user_simulator_config, "max_turn", None) is None:
52115173
parsed_user_simulator_config.max_turn = 5
52125174

5213-
candidate_name = (
5214-
parsed_agent_info.name or _evals_common._DEFAULT_CANDIDATE_NAME
5215-
)
5175+
candidate_name = parsed_agent_info.name or "candidate-1"
52165176
if agent and _evals_common._is_gemini_agent_resource(agent):
52175177
agent_run_config = types.AgentRunConfig(
52185178
gemini_agent_config=types.GeminiAgentConfig(gemini_agent=agent),

agentplatform/_genai/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,9 @@
14191419
from .common import ReasoningEngineRuntimeRevisionDict
14201420
from .common import ReasoningEngineRuntimeRevisionOrDict
14211421
from .common import ReasoningEngineSpec
1422+
from .common import ReasoningEngineSpecBuildSpec
1423+
from .common import ReasoningEngineSpecBuildSpecDict
1424+
from .common import ReasoningEngineSpecBuildSpecOrDict
14221425
from .common import ReasoningEngineSpecContainerSpec
14231426
from .common import ReasoningEngineSpecContainerSpecDict
14241427
from .common import ReasoningEngineSpecContainerSpecOrDict
@@ -2551,6 +2554,9 @@
25512554
"ReasoningEngineSpecContainerSpec",
25522555
"ReasoningEngineSpecContainerSpecDict",
25532556
"ReasoningEngineSpecContainerSpecOrDict",
2557+
"ReasoningEngineSpecBuildSpec",
2558+
"ReasoningEngineSpecBuildSpecDict",
2559+
"ReasoningEngineSpecBuildSpecOrDict",
25542560
"ReasoningEngineSpec",
25552561
"ReasoningEngineSpecDict",
25562562
"ReasoningEngineSpecOrDict",

agentplatform/_genai/types/common.py

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8676,6 +8676,27 @@ class ReasoningEngineSpecContainerSpecDict(TypedDict, total=False):
86768676
]
86778677

86788678

8679+
class ReasoningEngineSpecBuildSpec(_common.BaseModel):
8680+
"""Specification for building container image."""
8681+
8682+
worker_pool: Optional[str] = Field(
8683+
default=None,
8684+
description="""Optional. Identifier. The resource name of the Cloud Build WorkerPool to use for the build. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`""",
8685+
)
8686+
8687+
8688+
class ReasoningEngineSpecBuildSpecDict(TypedDict, total=False):
8689+
"""Specification for building container image."""
8690+
8691+
worker_pool: Optional[str]
8692+
"""Optional. Identifier. The resource name of the Cloud Build WorkerPool to use for the build. Format: `projects/{project}/locations/{location}/workerPools/{worker_pool}`"""
8693+
8694+
8695+
ReasoningEngineSpecBuildSpecOrDict = Union[
8696+
ReasoningEngineSpecBuildSpec, ReasoningEngineSpecBuildSpecDict
8697+
]
8698+
8699+
86798700
class ReasoningEngineSpec(_common.BaseModel):
86808701
"""The specification of an agent engine."""
86818702

@@ -8719,6 +8740,10 @@ class ReasoningEngineSpec(_common.BaseModel):
87198740
default=None,
87208741
description="""Deploy from a container image with a defined entrypoint and commands.""",
87218742
)
8743+
build_spec: Optional[ReasoningEngineSpecBuildSpec] = Field(
8744+
default=None,
8745+
description="""Optional. Configuration for building container image.""",
8746+
)
87228747

87238748

87248749
class ReasoningEngineSpecDict(TypedDict, total=False):
@@ -8754,6 +8779,9 @@ class ReasoningEngineSpecDict(TypedDict, total=False):
87548779
container_spec: Optional[ReasoningEngineSpecContainerSpecDict]
87558780
"""Deploy from a container image with a defined entrypoint and commands."""
87568781

8782+
build_spec: Optional[ReasoningEngineSpecBuildSpecDict]
8783+
"""Optional. Configuration for building container image."""
8784+
87578785

87588786
ReasoningEngineSpecOrDict = Union[ReasoningEngineSpec, ReasoningEngineSpecDict]
87598787

@@ -24142,83 +24170,84 @@ class FeedbackEntry(_common.BaseModel):
2414224170

2414324171
create_time: Optional[datetime.datetime] = Field(
2414424172
default=None,
24145-
description="""Output only. Timestamp when the feedback entry was created.""",
24173+
description="""Output only. The time at which the entry was created.""",
2414624174
)
2414724175
custom_metadata: Optional[dict[str, str]] = Field(
2414824176
default=None,
24149-
description="""Optional. Additional key-value metadata associated with the feedback. Allows the collect data for which there is no dedicated field in the resource, ex. version, LLM temperature etc.""",
24177+
description="""Optional. Additional key-value metadata associated with the feedback.""",
2415024178
)
2415124179
event_id: Optional[str] = Field(
2415224180
default=None,
24153-
description="""Required. The ID of the event to which the feedback relates to.""",
24181+
description="""Required. The ID of the event within the session that the feedback relates to.""",
2415424182
)
2415524183
feedback_labels: Optional[list[str]] = Field(
24156-
default=None,
24157-
description="""Optional. Specific labels for feedback (non-factual, offensive, etc.).""",
24184+
default=None, description="""feedbackLabels"""
2415824185
)
2415924186
feedback_text: Optional[str] = Field(
2416024187
default=None,
2416124188
description="""Optional. Qualitative free-form comments provided by the user.""",
2416224189
)
2416324190
feedback_type: Optional[FeedbackType] = Field(
24164-
default=None, description="""Required. The type of feedback provided."""
24191+
default=None,
24192+
description="""Required. The coarse-grained type of feedback provided by the user. Must be set to a value other than `FEEDBACK_TYPE_UNSPECIFIED`.""",
2416524193
)
2416624194
name: Optional[str] = Field(
2416724195
default=None,
24168-
description="""Identifier. The resource name of the feedback entry. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}'.""",
24196+
description="""Identifier. The resource name. Assigned by the server on create. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}`""",
2416924197
)
2417024198
session_id: Optional[str] = Field(
2417124199
default=None,
24172-
description="""Required. The ID of the session to which the feedback relates to.""",
24200+
description="""Required. The ID of the session that the feedback relates to.""",
2417324201
)
2417424202
source: Optional[str] = Field(
2417524203
default=None,
24176-
description="""Optional. Originating UI surface (e.g. 'ADK Web UI').""",
24204+
description="""Optional. The surface that the feedback originated from.""",
2417724205
)
2417824206
update_time: Optional[datetime.datetime] = Field(
2417924207
default=None,
24180-
description="""Output only. Timestamp when the feedback entry was last updated.""",
24208+
description="""Output only. The time at which the entry was most recently updated.""",
2418124209
)
2418224210
user_id: Optional[str] = Field(
24183-
default=None, description="""Optional. User provided identifier."""
24211+
default=None,
24212+
description="""Optional. A caller-supplied identifier for the user who provided the feedback. The semantics of this field (for example whether it is an opaque token, a hashed value, or a user-visible identifier) are determined by the calling application.""",
2418424213
)
2418524214

2418624215

2418724216
class FeedbackEntryDict(TypedDict, total=False):
2418824217
"""A Feedback Entry."""
2418924218

2419024219
create_time: Optional[datetime.datetime]
24191-
"""Output only. Timestamp when the feedback entry was created."""
24220+
"""Output only. The time at which the entry was created."""
2419224221

2419324222
custom_metadata: Optional[dict[str, str]]
24194-
"""Optional. Additional key-value metadata associated with the feedback. Allows the collect data for which there is no dedicated field in the resource, ex. version, LLM temperature etc."""
24223+
"""Optional. Additional key-value metadata associated with the feedback."""
2419524224

2419624225
event_id: Optional[str]
24197-
"""Required. The ID of the event to which the feedback relates to."""
24226+
"""Required. The ID of the event within the session that the feedback relates to."""
2419824227

2419924228
feedback_labels: Optional[list[str]]
24200-
"""Optional. Specific labels for feedback (non-factual, offensive, etc.)."""
24229+
"""feedbackLabels"""
2420124230

2420224231
feedback_text: Optional[str]
2420324232
"""Optional. Qualitative free-form comments provided by the user."""
2420424233

2420524234
feedback_type: Optional[FeedbackType]
24206-
"""Required. The type of feedback provided."""
24235+
"""Required. The coarse-grained type of feedback provided by the user. Must be set to a value other than `FEEDBACK_TYPE_UNSPECIFIED`."""
2420724236

2420824237
name: Optional[str]
24209-
"""Identifier. The resource name of the feedback entry. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}'."""
24238+
"""Identifier. The resource name. Assigned by the server on create. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}`"""
2421024239

2421124240
session_id: Optional[str]
24212-
"""Required. The ID of the session to which the feedback relates to."""
24241+
"""Required. The ID of the session that the feedback relates to."""
2421324242

2421424243
source: Optional[str]
24215-
"""Optional. Originating UI surface (e.g. 'ADK Web UI')."""
24244+
"""Optional. The surface that the feedback originated from."""
2421624245

2421724246
update_time: Optional[datetime.datetime]
24218-
"""Output only. Timestamp when the feedback entry was last updated."""
24247+
"""Output only. The time at which the entry was most recently updated."""
2421924248

2422024249
user_id: Optional[str]
24221-
"""Optional. User provided identifier."""
24250+
"""Optional. A caller-supplied identifier for the user who provided the feedback. The semantics of this field (for example whether it is an opaque token, a hashed value, or a user-visible identifier) are determined by the calling application."""
2422224251

2422324252

2422424253
FeedbackEntryOrDict = Union[FeedbackEntry, FeedbackEntryDict]
@@ -24725,22 +24754,22 @@ class FeedbackContext(_common.BaseModel):
2472524754

2472624755
context_events: Optional[list[SessionEvent]] = Field(
2472724756
default=None,
24728-
description="""Optional. Events from the conversation relevant to the parent feedback entry.""",
24757+
description="""Optional. The session events from the originating session.""",
2472924758
)
2473024759
name: Optional[str] = Field(
2473124760
default=None,
24732-
description="""Identifier. The resource name of the feedback context. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}/feedbackContext'.""",
24761+
description="""Identifier. The resource name. Assigned by the server on create. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}/feedbackContext`""",
2473324762
)
2473424763

2473524764

2473624765
class FeedbackContextDict(TypedDict, total=False):
2473724766
"""A Feedback Context."""
2473824767

2473924768
context_events: Optional[list[SessionEventDict]]
24740-
"""Optional. Events from the conversation relevant to the parent feedback entry."""
24769+
"""Optional. The session events from the originating session."""
2474124770

2474224771
name: Optional[str]
24743-
"""Identifier. The resource name of the feedback context. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}/feedbackContext'."""
24772+
"""Identifier. The resource name. Assigned by the server on create. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/feedbackEntries/{feedback_entry}/feedbackContext`"""
2474424773

2474524774

2474624775
FeedbackContextOrDict = Union[FeedbackContext, FeedbackContextDict]

0 commit comments

Comments
 (0)