make eval functions async

PiperOrigin-RevId: 756106627
This commit is contained in:
Xiang (Sean) Zhou
2025-05-07 19:52:47 -07:00
committed by Copybara-Service
parent cc1ef3f2ad
commit e7d9cf359a
11 changed files with 50 additions and 36 deletions

View File

@@ -51,12 +51,13 @@ def agent_eval_artifacts_in_fixture():
return agent_eval_artifacts
@pytest.mark.asyncio
@pytest.mark.parametrize(
'agent_name, evalfile, initial_session_file',
agent_eval_artifacts_in_fixture(),
ids=[agent_name for agent_name, _, _ in agent_eval_artifacts_in_fixture()],
)
def test_evaluate_agents_long_running_4_runs_per_eval_item(
async def test_evaluate_agents_long_running_4_runs_per_eval_item(
agent_name, evalfile, initial_session_file
):
"""Test agents evaluation in fixture folder.
@@ -66,7 +67,7 @@ def test_evaluate_agents_long_running_4_runs_per_eval_item(
A single eval item is a session that can have multiple queries in it.
"""
AgentEvaluator.evaluate(
await AgentEvaluator.evaluate(
agent_module=agent_name,
eval_dataset_file_path_or_dir=evalfile,
initial_session_file=initial_session_file,

View File

@@ -15,7 +15,8 @@
from google.adk.evaluation import AgentEvaluator
def test_eval_agent():
@pytest.mark.asyncio
async def test_eval_agent():
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.trip_planner_agent",
eval_dataset_file_path_or_dir=(

View File

@@ -15,7 +15,8 @@
from google.adk.evaluation import AgentEvaluator
def test_simple_multi_turn_conversation():
@pytest.mark.asyncio
async def test_simple_multi_turn_conversation():
"""Test a simple multi-turn conversation."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",
@@ -24,7 +25,8 @@ def test_simple_multi_turn_conversation():
)
def test_dependent_tool_calls():
@pytest.mark.asyncio
async def test_dependent_tool_calls():
"""Test subsequent tool calls that are dependent on previous tool calls."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",
@@ -33,8 +35,10 @@ def test_dependent_tool_calls():
)
def test_memorizing_past_events():
@pytest.mark.asyncio
async def test_memorizing_past_events():
"""Test memorizing past events."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",
eval_dataset_file_path_or_dir="tests/integration/fixture/home_automation_agent/test_files/memorizing_past_events/eval_data.test.json",

View File

@@ -15,7 +15,8 @@
from google.adk.evaluation import AgentEvaluator
def test_eval_agent():
@pytest.mark.asyncio
async def test_eval_agent():
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",
eval_dataset_file_path_or_dir="tests/integration/fixture/home_automation_agent/simple_test.test.json",

View File

@@ -15,7 +15,8 @@
from google.adk.evaluation import AgentEvaluator
def test_eval_agent():
@pytest.mark.asyncio
async def test_eval_agent():
"""Test hotel sub agent in a multi-agent system."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.trip_planner_agent",

View File

@@ -15,7 +15,8 @@
from google.adk.evaluation import AgentEvaluator
def test_with_single_test_file():
@pytest.mark.asyncio
async def test_with_single_test_file():
"""Test the agent's basic ability via session file."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",
@@ -23,7 +24,8 @@ def test_with_single_test_file():
)
def test_with_folder_of_test_files_long_running():
@pytest.mark.asyncio
async def test_with_folder_of_test_files_long_running():
"""Test the agent's basic ability via a folder of session files."""
AgentEvaluator.evaluate(
agent_module="tests.integration.fixture.home_automation_agent",