Deep_research_agent / test_gradio.py
Shekarss's picture
Upload 10 files
aa9134d verified
#!/usr/bin/env python3
"""
Test script to verify the Gradio interface works correctly
"""
import asyncio
from research_manager import ResearchManager
async def test_research_flow():
"""Test the research flow without Gradio to ensure it works"""
manager = ResearchManager()
# Test query
query = "The impact of AI on healthcare"
print("Testing research flow...")
print(f"Query: {query}")
print("-" * 50)
# First run - should return questions
print("Step 1: Getting questions...")
async for chunk in manager.run(query):
if isinstance(chunk, dict) and chunk.get("type") == "questions":
print(f"Generated {len(chunk['questions'])} questions:")
for q in chunk['questions']:
print(f" {q.number}. {q.question}")
break
else:
print(f"Status: {chunk}")
print("\n" + "-" * 50)
# Simulate user answers
sample_answers = {
"1": "I'm interested in diagnostic accuracy improvements",
"2": "Looking at the last 5 years of developments",
"3": "Focus on both benefits and challenges"
}
print("Step 2: Running research with sample answers...")
async for chunk in manager.run(query, sample_answers):
print(f"Status: {chunk}")
if __name__ == "__main__":
asyncio.run(test_research_flow())