From 0b181f53ee0c8e0fea8994eb743e8f5c8566fc19 Mon Sep 17 00:00:00 2001 From: Salma Elshafey Date: Thu, 6 Nov 2025 18:56:58 +0200 Subject: [PATCH 1/2] Fix tool call accuracy sample --- .../sample_tool_call_accuracy.py | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/sdk/ai/azure-ai-projects/samples/evaluation/agentic_evaluators/sample_tool_call_accuracy.py b/sdk/ai/azure-ai-projects/samples/evaluation/agentic_evaluators/sample_tool_call_accuracy.py index 70f6c62946f9..bc86f4f90a43 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluation/agentic_evaluators/sample_tool_call_accuracy.py +++ b/sdk/ai/azure-ai-projects/samples/evaluation/agentic_evaluators/sample_tool_call_accuracy.py @@ -102,26 +102,32 @@ def main() -> None: # Example 1: Simple tool call evaluation query1 = "What's the weather like in New York?" - tool_definitions1 = { - "name": "get_weather", - "description": "Get weather information for a location", - "parameters": { - "type": "object", - "properties": {"location": {"type": "string", "description": "The city name"}}, - }, - } + tool_definitions1 = [ + { + "type": "function", + "name": "get_weather", + "description": "Get weather information for a location", + "parameters": { + "type": "object", + "properties": {"location": {"type": "string", "description": "The city name"}}, + }, + } + ] - tool_calls1 = { - "type": "tool_call", - "tool_call_id": "call_1", - "name": "get_weather", - "arguments": {"location": "New York"}, - } + tool_calls1 = [ + { + "type": "tool_call", + "tool_call_id": "call_1", + "name": "get_weather", + "arguments": {"location": "New York"}, + } + ] # Example 2: Multiple tool calls query2 = "Search for customer orders and send an email update" tool_definitions2 = [ { + "type": "function", "id": "search_database_tool", "name": "search_database", "description": "Search database for information", @@ -131,6 +137,7 @@ def main() -> None: }, }, { + "type": "function", "id": "send_email_tool", "name": "send_email", "description": "Send an email", From ff896e57e23731bdc7468595583ed2dde01f2c2d Mon Sep 17 00:00:00 2001 From: Salma Elshafey Date: Thu, 6 Nov 2025 19:27:26 +0200 Subject: [PATCH 2/2] Update agent response evaluation --- .../samples/evaluation/sample_agent_response_evaluation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/ai/azure-ai-projects/samples/evaluation/sample_agent_response_evaluation.py b/sdk/ai/azure-ai-projects/samples/evaluation/sample_agent_response_evaluation.py index 374b967eacc2..5a7212125f5e 100644 --- a/sdk/ai/azure-ai-projects/samples/evaluation/sample_agent_response_evaluation.py +++ b/sdk/ai/azure-ai-projects/samples/evaluation/sample_agent_response_evaluation.py @@ -103,14 +103,16 @@ openai_client.evals.runs.output_items.list(run_id=response_eval_run.id, eval_id=eval_object.id) ) print(f"\nOUTPUT ITEMS (Total: {len(output_items)})") + print(f"Eval Run Report URL: {response_eval_run.report_url}") + print(f"{'-'*60}") pprint(output_items) print(f"{'-'*60}") else: print("\n✗ Evaluation run failed.") - openai_client.evals.delete(eval_id=eval_object.id) - print("Evaluation deleted") + # openai_client.evals.delete(eval_id=eval_object.id) + # print("Evaluation deleted") project_client.agents.delete(agent_name=agent.name) print("Agent deleted")