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:
|
except Exception as e:
|
||||||
self.console.print(f"[red]Error: {e}[/red]")
|
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.
|
"""Run research via the pydantic-graph pipeline.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
question: The research question
|
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:
|
async with HaikuRAG(db_path=self.db_path, config=self.config) as client:
|
||||||
try:
|
try:
|
||||||
|
|
@ -260,9 +261,18 @@ class HaikuRAGApp:
|
||||||
state = ResearchState.from_config(context=context, config=self.config)
|
state = ResearchState.from_config(context=context, config=self.config)
|
||||||
deps = ResearchDeps(client=client)
|
deps = ResearchDeps(client=client)
|
||||||
|
|
||||||
# Use AG-UI renderer to process events
|
if verbose:
|
||||||
|
# Use AG-UI renderer to process and display events
|
||||||
renderer = AGUIConsoleRenderer(self.console)
|
renderer = AGUIConsoleRenderer(self.console)
|
||||||
report_dict = await renderer.render(stream_graph(graph, state, deps))
|
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:
|
if report_dict is None:
|
||||||
self.console.print("[red]Research did not produce a report.[/red]")
|
self.console.print("[red]Research did not produce a report.[/red]")
|
||||||
|
|
|
||||||
|
|
@ -299,9 +299,14 @@ def research(
|
||||||
"--db",
|
"--db",
|
||||||
help="Path to the LanceDB database file",
|
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)
|
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")
|
@cli.command("settings", help="Display current configuration settings")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue