Skip to content

Commit be27597

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Onboard Vertex Model Garden to GenAI Python SDK: Add export_open_model support
PiperOrigin-RevId: 951526334
1 parent e46d239 commit be27597

8 files changed

Lines changed: 1617 additions & 201 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),

0 commit comments

Comments
 (0)