Bring back verbose
This commit is contained in:
parent
dccef431b0
commit
d5b6ad544d
2 changed files with 20 additions and 5 deletions
|
|
@ -243,11 +243,12 @@ class HaikuRAGApp:
|
|||
except Exception as e:
|
||||
self.console.print(f"[red]Error: {e}[/red]")
|
||||
|
||||
async def research(self, question: str):
|
||||
async def research(self, question: str, verbose: bool = False):
|
||||
"""Run research via the pydantic-graph pipeline.
|
||||
|
||||
Args:
|
||||
question: The research question
|
||||
verbose: Show AG-UI event stream during execution
|
||||
"""
|
||||
async with HaikuRAG(db_path=self.db_path, config=self.config) as client:
|
||||
try:
|
||||
|
|
@ -260,9 +261,18 @@ class HaikuRAGApp:
|
|||
state = ResearchState.from_config(context=context, config=self.config)
|
||||
deps = ResearchDeps(client=client)
|
||||
|
||||
# Use AG-UI renderer to process events
|
||||
renderer = AGUIConsoleRenderer(self.console)
|
||||
report_dict = await renderer.render(stream_graph(graph, state, deps))
|
||||
if verbose:
|
||||
# Use AG-UI renderer to process and display events
|
||||
renderer = AGUIConsoleRenderer(self.console)
|
||||
report_dict = await renderer.render(
|
||||
stream_graph(graph, state, deps)
|
||||
)
|
||||
else:
|
||||
# Run without rendering events, just get the result
|
||||
report = await graph.run(state=state, deps=deps)
|
||||
report_dict = (
|
||||
report.model_dump() if hasattr(report, "model_dump") else report
|
||||
)
|
||||
|
||||
if report_dict is None:
|
||||
self.console.print("[red]Research did not produce a report.[/red]")
|
||||
|
|
|
|||
|
|
@ -299,9 +299,14 @@ def research(
|
|||
"--db",
|
||||
help="Path to the LanceDB database file",
|
||||
),
|
||||
verbose: bool = typer.Option(
|
||||
False,
|
||||
"--verbose",
|
||||
help="Show planning, searching previews, evaluation summary, and stop reason",
|
||||
),
|
||||
):
|
||||
app = create_app(db)
|
||||
asyncio.run(app.research(question=question))
|
||||
asyncio.run(app.research(question=question, verbose=verbose))
|
||||
|
||||
|
||||
@cli.command("settings", help="Display current configuration settings")
|
||||
|
|
|
|||
Loading…
Reference in a new issue