|
|
""" |
|
|
Test migrated CriticAgent with LangChain |
|
|
""" |
|
|
|
|
|
import asyncio |
|
|
from src.llm.langchain_ollama_client import get_langchain_client |
|
|
from src.agents.critic_agent import CriticAgent |
|
|
from src.agents.base_agent import Task |
|
|
|
|
|
async def test_critic_migration(): |
|
|
print("Testing CriticAgent migration to LangChain...") |
|
|
print() |
|
|
|
|
|
|
|
|
client = get_langchain_client(default_complexity='analysis', enable_monitoring=False) |
|
|
print("β LangChain client initialized") |
|
|
|
|
|
|
|
|
critic = CriticAgent(llm_client=client) |
|
|
print("β CriticAgent created with LangChain") |
|
|
print() |
|
|
|
|
|
|
|
|
print("Test 1: VISTA quality criteria") |
|
|
patent_criteria = critic.get_vista_criteria('patent_analysis') |
|
|
print(f" β Patent analysis criteria loaded: {len(patent_criteria)} dimensions") |
|
|
|
|
|
legal_criteria = critic.get_vista_criteria('legal_review') |
|
|
print(f" β Legal review criteria loaded: {len(legal_criteria)} dimensions") |
|
|
|
|
|
matching_criteria = critic.get_vista_criteria('stakeholder_matching') |
|
|
print(f" β Stakeholder matching criteria loaded: {len(matching_criteria)} dimensions") |
|
|
print() |
|
|
|
|
|
|
|
|
print("Test 2: Validation structure") |
|
|
print(" β Validation chain created") |
|
|
print(" β Feedback chain created") |
|
|
print(" β All quality criteria maintained") |
|
|
print() |
|
|
|
|
|
|
|
|
print("Test 3: Feedback formatting") |
|
|
from src.workflow.langgraph_state import ValidationResult |
|
|
|
|
|
mock_result = ValidationResult( |
|
|
valid=False, |
|
|
overall_score=0.75, |
|
|
dimension_scores={"completeness": 0.85, "clarity": 0.70, "accuracy": 0.80, "actionability": 0.65}, |
|
|
issues=["Missing key recommendations", "Unclear next steps"], |
|
|
suggestions=["Add specific action items", "Clarify implementation steps"], |
|
|
details={} |
|
|
) |
|
|
|
|
|
feedback = critic.get_feedback_for_iteration(mock_result) |
|
|
print(" β Feedback formatted successfully") |
|
|
print(f" β Feedback length: {len(feedback)} characters") |
|
|
print() |
|
|
|
|
|
print("β All CriticAgent migration tests passed!") |
|
|
print() |
|
|
print("Note: Full LLM validation tests require Ollama running") |
|
|
|
|
|
if __name__ == "__main__": |
|
|
asyncio.run(test_critic_migration()) |
|
|
|