Files
NaliiaBot/tests/conftest.py

57 lines
1.2 KiB
Python

import pytest
from unittest.mock import Mock
from src.naliiabot.bot.agent.agent import Agent, AgentConfig
from src.naliiabot.bot.factories.llm_factory import LLMFactory
@pytest.fixture
def mock_tool():
"""Mock de herramienta."""
tool = Mock()
tool.name = "calculator"
tool.invoke = Mock(return_value="42")
return tool
@pytest.fixture
def mock_model():
"""Mock de modelo LLM con interfaz completa."""
model = Mock()
model.bind_tools = Mock(return_value=model)
return model
@pytest.fixture
def default_config():
"""Configuración de test predecible."""
return AgentConfig(
system_prompt="Test prompt",
max_iterations=5,
timeout_seconds=10.0
)
@pytest.fixture
def agent(mock_model, default_config):
"""Agente básico sin herramientas."""
return Agent(model=mock_model, config=default_config)
@pytest.fixture
def agent_with_tool(mock_model, default_config, mock_tool):
"""Agente con una herramienta mock."""
return Agent(
model=mock_model,
config=default_config,
tools=[mock_tool]
)
@pytest.fixture
def anthropic_model():
llmFactory = LLMFactory("anthropic")
anthropic_model = llmFactory.get_model()
return anthropic_model