Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion databao/executors/lighthouse/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_result(self, state: AgentState) -> ExecutionResult:
df = state.get("df") # Latest df result (usually from run_sql_query)
visualization_prompt = state.get("visualization_prompt")
result = ExecutionResult(
text=last_ai_message.text(),
text=last_ai_message.text,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New version of LangChain raise deprecation warning on this.

df=df,
code=sql,
meta={
Expand Down
57 changes: 57 additions & 0 deletions examples/latency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import time
from pathlib import Path

import duckdb
import pandas as pd

import databao

file_path = Path(__file__).parent


def run_scenario() -> bool:
db_path = file_path / "web_shop_orders/data/web_shop.duckdb"
conn = duckdb.connect(db_path, read_only=True)

llm_config = databao.LLMConfig.from_yaml(file_path / "configs/gpt-oss-20b-ollama.yaml")
# llm_config = databao.LLMConfig(name="claude-sonnet-4-5")

# llm_config = databao.LLMConfig.from_yaml("configs/qwen3-8b-ollama.yaml") # Use a custom config file
# llm_config = databao.LLMConfigDirectory.QWEN3_8B_OLLAMA # Use one of the preconfigured configs
agent = databao.new_agent("my_agent", llm_config=llm_config, stream_ask=False)
agent.add_db(conn)

thread = agent.thread(lazy=True)
thread.ask(
"""
Compute a KPI overview
Return:
- total orders
- total revenue from all orders
- average order value (AOV)
- total freight
- average delivery days (only for delivered orders)
- average review score (satisfaction proxy)
"""
)
thread.ask("count cancelled shows by directors")
df = thread.df()

return df is not None


def main() -> None:
time_measures = []
for _ in range(10):
start_time = time.time()
success = run_scenario()
if success:
time_measures.append(time.time() - start_time)

measures = pd.Series(time_measures)

print(f"Mean time: {measures.mean():.2f} seconds, Std: {measures.std():.2f}")


if __name__ == "__main__":
main()