Simplify structured output for research agents
This commit is contained in:
parent
714c6c627e
commit
a807f3ea36
6 changed files with 13 additions and 12 deletions
|
|
@ -122,12 +122,7 @@ class HaikuRAGApp:
|
|||
self.console.print(f"• {finding}")
|
||||
self.console.print()
|
||||
|
||||
# Themes
|
||||
if report.themes:
|
||||
self.console.print("[bold cyan]Key Themes:[/bold cyan]")
|
||||
for theme, explanation in report.themes.items():
|
||||
self.console.print(f"• [bold]{theme}[/bold]: {explanation}")
|
||||
self.console.print()
|
||||
# (Themes section removed)
|
||||
|
||||
# Conclusions
|
||||
if report.conclusions:
|
||||
|
|
@ -261,7 +256,7 @@ class HaikuRAGApp:
|
|||
elif transport == "sse":
|
||||
await server.run_sse_async()
|
||||
else:
|
||||
await server.run_http_async("streamable-http")
|
||||
await server.run_http_async(transport="streamable-http")
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class QuestionAnswerAgent:
|
|||
limit: int = 3,
|
||||
) -> list[SearchResult]:
|
||||
"""Search the knowledge base for relevant documents."""
|
||||
|
||||
# Remove quotes from queries as this requires positional indexing in lancedb
|
||||
query = query.replace('"', "")
|
||||
search_results = await ctx.deps.client.search(query, limit=limit)
|
||||
expanded_results = await ctx.deps.client.expand_context(search_results)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ class EvaluationResult(BaseModel):
|
|||
description="Main insights extracted from the research so far"
|
||||
)
|
||||
new_questions: list[str] = Field(
|
||||
description="New sub-questions to add to the research (max 3)", max_length=3
|
||||
description="New sub-questions to add to the research (max 3)",
|
||||
max_length=3,
|
||||
default=[],
|
||||
)
|
||||
confidence_score: float = Field(
|
||||
description="Confidence level in the completeness of research (0-1)",
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class SearchSpecialistAgent(BaseResearchAgent[SearchAnswer]):
|
|||
) -> str:
|
||||
"""Search the KB and return a concise context pack."""
|
||||
# Remove quotes from queries as this requires positional indexing in lancedb
|
||||
# XXX: Investigate how to do that with lancedb
|
||||
query = query.replace('"', "")
|
||||
search_results = await ctx.deps.client.search(query, limit=limit)
|
||||
expanded = await ctx.deps.client.expand_context(search_results)
|
||||
|
|
|
|||
|
|
@ -12,11 +12,12 @@ class ResearchReport(BaseModel):
|
|||
main_findings: list[str] = Field(
|
||||
description="Primary research findings with supporting evidence"
|
||||
)
|
||||
themes: dict[str, str] = Field(description="Major themes and their explanations")
|
||||
conclusions: list[str] = Field(description="Evidence-based conclusions")
|
||||
limitations: list[str] = Field(description="Limitations of the current research")
|
||||
limitations: list[str] = Field(
|
||||
description="Limitations of the current research", default=[]
|
||||
)
|
||||
recommendations: list[str] = Field(
|
||||
description="Actionable recommendations based on findings"
|
||||
description="Actionable recommendations based on findings", default=[]
|
||||
)
|
||||
sources_summary: str = Field(
|
||||
description="Summary of sources used and their reliability"
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@ class TestResearchOrchestrator:
|
|||
assert report.title
|
||||
assert report.executive_summary
|
||||
assert isinstance(report.main_findings, list)
|
||||
assert isinstance(report.themes, dict)
|
||||
assert isinstance(report.conclusions, list)
|
||||
assert isinstance(report.limitations, list)
|
||||
assert isinstance(report.recommendations, list)
|
||||
|
|
|
|||
Loading…
Reference in a new issue