@@ -1397,15 +1397,6 @@ def create_evaluation_run(
13971397 )
13981398 inference_configs = {}
13991399 if agent_info :
1400- if isinstance (agent_info , dict ):
1401- agent_info = types .evals .AgentInfo .model_validate (agent_info )
1402- if (
1403- not agent_info .agent
1404- or len (agent_info .agent .split ("reasoningEngines/" )) != 2
1405- ):
1406- raise ValueError (
1407- "agent_info.agent cannot be empty. Please provide a valid reasoning engine resource name in the format of projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}."
1408- )
14091400 inference_configs [agent_info .name ] = types .EvaluationRunInferenceConfig (
14101401 agent_config = types .EvaluationRunAgentConfig (
14111402 developer_instruction = genai_types .Content (
@@ -1414,10 +1405,11 @@ def create_evaluation_run(
14141405 tools = agent_info .tool_declarations ,
14151406 )
14161407 )
1417- labels = labels or {}
1418- labels ["vertex-ai-evaluation-agent-engine-id" ] = agent_info .agent .split (
1419- "reasoningEngines/"
1420- )[- 1 ]
1408+ if agent_info .agent :
1409+ labels = labels or {}
1410+ labels ["vertex-ai-evaluation-agent-engine-id" ] = agent_info .agent .split (
1411+ "reasoningEngines/"
1412+ )[- 1 ]
14211413 if not name :
14221414 name = f"evaluation_run_{ uuid .uuid4 ()} "
14231415
@@ -2252,15 +2244,6 @@ async def create_evaluation_run(
22522244 )
22532245 inference_configs = {}
22542246 if agent_info :
2255- if isinstance (agent_info , dict ):
2256- agent_info = types .evals .AgentInfo .model_validate (agent_info )
2257- if (
2258- not agent_info .agent
2259- or len (agent_info .agent .split ("reasoningEngines/" )) != 2
2260- ):
2261- raise ValueError (
2262- "agent_info.agent cannot be empty. Please provide a valid reasoning engine resource name in the format of projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}."
2263- )
22642247 inference_configs [agent_info .name ] = types .EvaluationRunInferenceConfig (
22652248 agent_config = types .EvaluationRunAgentConfig (
22662249 developer_instruction = genai_types .Content (
@@ -2269,10 +2252,11 @@ async def create_evaluation_run(
22692252 tools = agent_info .tool_declarations ,
22702253 )
22712254 )
2272- labels = labels or {}
2273- labels ["vertex-ai-evaluation-agent-engine-id" ] = agent_info .agent .split (
2274- "reasoningEngines/"
2275- )[- 1 ]
2255+ if agent_info .agent :
2256+ labels = labels or {}
2257+ labels ["vertex-ai-evaluation-agent-engine-id" ] = agent_info .agent .split (
2258+ "reasoningEngines/"
2259+ )[- 1 ]
22762260 if not name :
22772261 name = f"evaluation_run_{ uuid .uuid4 ()} "
22782262
0 commit comments