@@ -1397,15 +1397,6 @@ def create_evaluation_run( |
1397 | 1397 | ) |
1398 | 1398 | inference_configs = {} |
1399 | 1399 | 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 | | - ) |
1409 | 1400 | inference_configs[agent_info.name] = types.EvaluationRunInferenceConfig( |
1410 | 1401 | agent_config=types.EvaluationRunAgentConfig( |
1411 | 1402 | developer_instruction=genai_types.Content( |
@@ -1414,10 +1405,11 @@ def create_evaluation_run( |
1414 | 1405 | tools=agent_info.tool_declarations, |
1415 | 1406 | ) |
1416 | 1407 | ) |
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] |
1421 | 1413 | if not name: |
1422 | 1414 | name = f"evaluation_run_{uuid.uuid4()}" |
1423 | 1415 |
|
@@ -2252,15 +2244,6 @@ async def create_evaluation_run( |
2252 | 2244 | ) |
2253 | 2245 | inference_configs = {} |
2254 | 2246 | 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 | | - ) |
2264 | 2247 | inference_configs[agent_info.name] = types.EvaluationRunInferenceConfig( |
2265 | 2248 | agent_config=types.EvaluationRunAgentConfig( |
2266 | 2249 | developer_instruction=genai_types.Content( |
@@ -2269,10 +2252,11 @@ async def create_evaluation_run( |
2269 | 2252 | tools=agent_info.tool_declarations, |
2270 | 2253 | ) |
2271 | 2254 | ) |
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] |
2276 | 2260 | if not name: |
2277 | 2261 | name = f"evaluation_run_{uuid.uuid4()}" |
2278 | 2262 |
|
|