Remove openai models from research tests

This commit is contained in:
Yiorgis Gozadinos 2025-09-19 09:05:04 +03:00
parent edd9defa7d
commit 5bfa720864
No known key found for this signature in database
4 changed files with 40 additions and 20 deletions

View file

@ -1,3 +1,4 @@
from haiku.rag.config import Config
from haiku.rag.research.evaluation_agent import ( from haiku.rag.research.evaluation_agent import (
AnalysisEvaluationAgent, AnalysisEvaluationAgent,
EvaluationResult, EvaluationResult,
@ -8,7 +9,9 @@ class TestAnalysisEvaluationAgent:
"""Lean tests for AnalysisEvaluationAgent without LLM mocking.""" """Lean tests for AnalysisEvaluationAgent without LLM mocking."""
def test_agent_initialization(self): def test_agent_initialization(self):
agent = AnalysisEvaluationAgent(provider="openai", model="gpt-4") agent = AnalysisEvaluationAgent(
assert agent.provider == "openai" provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
assert agent.model == "gpt-4" )
assert agent.provider == Config.RESEARCH_PROVIDER
assert agent.model == Config.RESEARCH_MODEL
assert agent.output_type == EvaluationResult assert agent.output_type == EvaluationResult

View file

@ -4,6 +4,7 @@ import pytest
from pydantic_ai.models.test import TestModel from pydantic_ai.models.test import TestModel
from haiku.rag.client import HaikuRAG from haiku.rag.client import HaikuRAG
from haiku.rag.config import Config
from haiku.rag.research.dependencies import ResearchContext, ResearchDependencies from haiku.rag.research.dependencies import ResearchContext, ResearchDependencies
from haiku.rag.research.evaluation_agent import EvaluationResult from haiku.rag.research.evaluation_agent import EvaluationResult
from haiku.rag.research.orchestrator import ResearchOrchestrator, ResearchPlan from haiku.rag.research.orchestrator import ResearchOrchestrator, ResearchPlan
@ -70,7 +71,9 @@ class TestResearchOrchestrator:
def test_orchestrator_initialization(self): def test_orchestrator_initialization(self):
"""Test that orchestrator initializes all agents correctly.""" """Test that orchestrator initializes all agents correctly."""
orchestrator = ResearchOrchestrator(provider="openai", model="gpt-4") orchestrator = ResearchOrchestrator(
provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
)
# Check all agents are initialized # Check all agents are initialized
assert orchestrator.search_agent is not None assert orchestrator.search_agent is not None
@ -78,21 +81,25 @@ class TestResearchOrchestrator:
assert orchestrator.synthesis_agent is not None assert orchestrator.synthesis_agent is not None
# Check they all use the same provider and model # Check they all use the same provider and model
assert orchestrator.search_agent.provider == "openai" assert orchestrator.search_agent.provider == Config.RESEARCH_PROVIDER
assert orchestrator.search_agent.model == "gpt-4" assert orchestrator.search_agent.model == Config.RESEARCH_MODEL
assert orchestrator.evaluation_agent.provider == "openai" assert orchestrator.evaluation_agent.provider == Config.RESEARCH_PROVIDER
assert orchestrator.evaluation_agent.model == "gpt-4" assert orchestrator.evaluation_agent.model == Config.RESEARCH_MODEL
assert orchestrator.synthesis_agent.provider == "openai" assert orchestrator.synthesis_agent.provider == Config.RESEARCH_PROVIDER
assert orchestrator.synthesis_agent.model == "gpt-4" assert orchestrator.synthesis_agent.model == Config.RESEARCH_MODEL
def test_orchestrator_has_correct_output_type(self): def test_orchestrator_has_correct_output_type(self):
"""Test that orchestrator's output type is ResearchPlan.""" """Test that orchestrator's output type is ResearchPlan."""
orchestrator = ResearchOrchestrator(provider="openai", model="gpt-4") orchestrator = ResearchOrchestrator(
provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
)
assert orchestrator.output_type == ResearchPlan assert orchestrator.output_type == ResearchPlan
def test_orchestrator_has_no_tools(self): def test_orchestrator_has_no_tools(self):
"""Test that orchestrator no longer registers tools (direct agent calls now).""" """Test that orchestrator no longer registers tools (direct agent calls now)."""
orchestrator = ResearchOrchestrator(provider="openai", model="gpt-4") orchestrator = ResearchOrchestrator(
provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
)
# Get the tools from the agent # Get the tools from the agent
tools = orchestrator.agent._function_toolset.tools tools = orchestrator.agent._function_toolset.tools
@ -103,7 +110,9 @@ class TestResearchOrchestrator:
def test_should_stop_research_logic(self): def test_should_stop_research_logic(self):
"""Test the stopping logic based on EvaluationResult.""" """Test the stopping logic based on EvaluationResult."""
orchestrator = ResearchOrchestrator(provider="openai", model="gpt-4") orchestrator = ResearchOrchestrator(
provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
)
# Create mock evaluation results # Create mock evaluation results
from unittest.mock import MagicMock from unittest.mock import MagicMock
@ -148,7 +157,9 @@ class TestResearchOrchestrator:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_conduct_research_workflow(self, test_model, mock_client): async def test_conduct_research_workflow(self, test_model, mock_client):
"""Test the basic research workflow using TestModel.""" """Test the basic research workflow using TestModel."""
orchestrator = ResearchOrchestrator(provider="openai", model="gpt-4") orchestrator = ResearchOrchestrator(
provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
)
# Setup mock client returns # Setup mock client returns
mock_chunks = [ mock_chunks = [

View file

@ -1,3 +1,4 @@
from haiku.rag.config import Config
from haiku.rag.research import SearchAnswer, SearchSpecialistAgent from haiku.rag.research import SearchAnswer, SearchSpecialistAgent
@ -5,7 +6,9 @@ class TestSearchSpecialistAgent:
"""Lean tests for SearchSpecialistAgent without LLM mocking.""" """Lean tests for SearchSpecialistAgent without LLM mocking."""
def test_agent_initialization(self): def test_agent_initialization(self):
agent = SearchSpecialistAgent(provider="openai", model="gpt-4") agent = SearchSpecialistAgent(
assert agent.provider == "openai" provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
assert agent.model == "gpt-4" )
assert agent.provider == Config.RESEARCH_PROVIDER
assert agent.model == Config.RESEARCH_MODEL
assert agent.output_type is SearchAnswer assert agent.output_type is SearchAnswer

View file

@ -1,3 +1,4 @@
from haiku.rag.config import Config
from haiku.rag.research.synthesis_agent import ResearchReport, SynthesisAgent from haiku.rag.research.synthesis_agent import ResearchReport, SynthesisAgent
@ -5,7 +6,9 @@ class TestSynthesisAgent:
"""Lean tests for SynthesisAgent without LLM mocking.""" """Lean tests for SynthesisAgent without LLM mocking."""
def test_agent_initialization(self): def test_agent_initialization(self):
agent = SynthesisAgent(provider="openai", model="gpt-4") agent = SynthesisAgent(
assert agent.provider == "openai" provider=Config.RESEARCH_PROVIDER, model=Config.RESEARCH_MODEL
assert agent.model == "gpt-4" )
assert agent.provider == Config.RESEARCH_PROVIDER
assert agent.model == Config.RESEARCH_MODEL
assert agent.output_type == ResearchReport assert agent.output_type == ResearchReport