Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Example
-------
>>> from aieng.agent_evals.knowledge_agent import (
>>> from aieng.agent_evals.knowledge_qa import (
... KnowledgeGroundedAgent,
... DeepSearchQADataset,
... DeepSearchQAEvaluator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class KnowledgeGroundedAgent:

Examples
--------
>>> from aieng.agent_evals.knowledge_agent import KnowledgeGroundedAgent
>>> from aieng.agent_evals.knowledge_qa import KnowledgeGroundedAgent
>>> agent = KnowledgeGroundedAgent()
>>> response = agent.answer("Who won the 2024 Nobel Prize in Physics?")
>>> print(response.text)
Expand Down Expand Up @@ -283,7 +283,7 @@ def __init__(

# Runner orchestrates the ReAct loop
self._runner = Runner(
app_name="knowledge_agent",
app_name="knowledge_qa",
agent=self._agent,
session_service=self._session_service,
)
Expand All @@ -310,7 +310,7 @@ async def _get_or_create_session_async(self, session_id: str | None = None) -> s
if session_id not in self._sessions:
# Create a new ADK session through the session service
session = await self._session_service.create_session(
app_name="knowledge_agent",
app_name="knowledge_qa",
user_id="user",
state={},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class DeepSearchQAEvaluator:

Examples
--------
>>> from aieng.agent_evals.knowledge_agent import (
>>> from aieng.agent_evals.knowledge_qa import (
... KnowledgeGroundedAgent,
... DeepSearchQAEvaluator,
... )
Expand Down
2 changes: 1 addition & 1 deletion aieng-eval-agents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies = [
]

[project.scripts]
knowledge-agent = "aieng.agent_evals.knowledge_agent.cli:main"
knowledge-qa = "aieng.agent_evals.knowledge_qa.cli:main"

[dependency-groups]
dev = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from unittest.mock import AsyncMock, MagicMock, patch

import pytest
from aieng.agent_evals.knowledge_agent.agent import (
from aieng.agent_evals.knowledge_qa.agent import (
SYSTEM_INSTRUCTIONS,
KnowledgeAgentManager,
KnowledgeGroundedAgent,
Expand All @@ -22,10 +22,10 @@ def mock_config(self):
config.default_worker_model = "gemini-2.5-flash"
return config

@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
def test_agent_initialization(
self,
mock_create_tool,
Expand Down Expand Up @@ -55,10 +55,10 @@ def test_agent_initialization(
mock_session_service.assert_called_once()
mock_runner_class.assert_called_once()

@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
def test_agent_with_custom_model(
self,
mock_create_tool,
Expand All @@ -74,10 +74,10 @@ def test_agent_with_custom_model(
assert call_kwargs["model"] == "gemini-2.5-pro"

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_get_or_create_session(
self,
mock_create_tool,
Expand Down Expand Up @@ -110,10 +110,10 @@ async def test_get_or_create_session(
assert session3 != session1

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_get_or_create_session_generates_id(
self,
mock_create_tool,
Expand All @@ -136,10 +136,10 @@ async def test_get_or_create_session_generates_id(
assert session is not None

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async(
self,
mock_create_tool,
Expand Down Expand Up @@ -176,10 +176,10 @@ async def mock_run_async(*args, **kwargs):
assert response.text == "Paris is the capital of France."

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_extracts_function_calls(
self,
mock_create_tool,
Expand Down Expand Up @@ -234,10 +234,10 @@ async def mock_run_async(*args, **kwargs):
assert "capital of France" in response.search_queries

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_extracts_sources_from_function_responses(
self,
mock_create_tool,
Expand Down Expand Up @@ -297,10 +297,10 @@ async def mock_run_async(*args, **kwargs):
assert response.sources[1].uri == "https://example.com/paris"

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_extracts_grounding_chunks_from_responses(
self,
mock_create_tool,
Expand Down Expand Up @@ -360,10 +360,10 @@ async def mock_run_async(*args, **kwargs):
assert response.sources[1].uri == "https://news.com/article"

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_extracts_grounding_metadata(
self,
mock_create_tool,
Expand Down Expand Up @@ -426,10 +426,10 @@ async def mock_run_async(*args, **kwargs):
assert "grounded query" in response.search_queries

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_extracts_grounding_metadata_from_content(
self,
mock_create_tool,
Expand Down Expand Up @@ -495,10 +495,10 @@ async def mock_run_async(*args, **kwargs):
assert "content query" in response.search_queries

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_handles_multiple_search_tool_names(
self,
mock_create_tool,
Expand Down Expand Up @@ -561,10 +561,10 @@ async def mock_run_async(*args, **kwargs):
assert "query three" in response.search_queries

@pytest.mark.asyncio
@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
async def test_answer_async_handles_empty_events(
self,
mock_create_tool,
Expand Down Expand Up @@ -618,10 +618,10 @@ async def mock_run_async(*args, **kwargs):
class TestKnowledgeAgentManager:
"""Tests for the KnowledgeAgentManager class."""

@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
def test_lazy_initialization(
self,
mock_create_tool,
Expand All @@ -630,7 +630,7 @@ def test_lazy_initialization(
mock_runner_class,
):
"""Test that clients are lazily initialized."""
with patch("aieng.agent_evals.knowledge_agent.agent.Configs") as mock_config_class:
with patch("aieng.agent_evals.knowledge_qa.agent.Configs") as mock_config_class:
mock_config_class.return_value = MagicMock()

manager = KnowledgeAgentManager()
Expand All @@ -644,10 +644,10 @@ def test_lazy_initialization(
# Now should be initialized
assert manager.is_initialized()

@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
def test_close(
self,
mock_create_tool,
Expand All @@ -656,7 +656,7 @@ def test_close(
mock_runner_class,
):
"""Test closing the client manager."""
with patch("aieng.agent_evals.knowledge_agent.agent.Configs") as mock_config_class:
with patch("aieng.agent_evals.knowledge_qa.agent.Configs") as mock_config_class:
mock_config_class.return_value = MagicMock()

manager = KnowledgeAgentManager()
Expand All @@ -666,10 +666,10 @@ def test_close(
manager.close()
assert not manager.is_initialized()

@patch("aieng.agent_evals.knowledge_agent.agent.Runner")
@patch("aieng.agent_evals.knowledge_agent.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_agent.agent.Agent")
@patch("aieng.agent_evals.knowledge_agent.agent.create_google_search_tool")
@patch("aieng.agent_evals.knowledge_qa.agent.Runner")
@patch("aieng.agent_evals.knowledge_qa.agent.InMemorySessionService")
@patch("aieng.agent_evals.knowledge_qa.agent.Agent")
@patch("aieng.agent_evals.knowledge_qa.agent.create_google_search_tool")
def test_agent_reuse(
self,
mock_create_tool,
Expand All @@ -678,7 +678,7 @@ def test_agent_reuse(
mock_runner_class,
):
"""Test that agent is reused on multiple accesses."""
with patch("aieng.agent_evals.knowledge_agent.agent.Configs") as mock_config_class:
with patch("aieng.agent_evals.knowledge_qa.agent.Configs") as mock_config_class:
mock_config_class.return_value = MagicMock()

manager = KnowledgeAgentManager()
Expand All @@ -698,7 +698,7 @@ class TestKnowledgeGroundedAgentIntegration:

def test_agent_creation_real(self):
"""Test creating a real agent instance."""
from aieng.agent_evals.knowledge_agent import ( # noqa: PLC0415
from aieng.agent_evals.knowledge_qa import ( # noqa: PLC0415
KnowledgeGroundedAgent,
)

Expand All @@ -709,7 +709,7 @@ def test_agent_creation_real(self):
@pytest.mark.asyncio
async def test_answer_real_question(self):
"""Test answering a real question."""
from aieng.agent_evals.knowledge_agent import ( # noqa: PLC0415
from aieng.agent_evals.knowledge_qa import ( # noqa: PLC0415
KnowledgeGroundedAgent,
)

Expand Down
Loading