Skip to content

Commit 40191d2

Browse files
committed
feat(benchmarks): Added intital attempt to generate basic summary via LLM
1 parent 7c3a453 commit 40191d2

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

.github/workflows/CI.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ jobs:
5656
version: "1.11"
5757

5858
- name: Run and Compare Benchmarks
59+
env:
60+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
5961
run: |
6062
# Install python dependencies
6163
pip install uv
6264
uv venv
6365
source .venv/bin/activate
64-
uv pip install simstring-fast pandas maturin tabulate
66+
uv pip install simstring-fast pandas maturin tabulate pydantic-ai tenacity
6567
rm -rf target/wheels
6668
maturin build --release
6769
uv pip install target/wheels/*.whl

benches/compare_benches.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
33
from pathlib import Path
44

55
import pandas as pd
6+
from pydantic_ai import Agent
7+
from tenacity import retry, stop_after_attempt, wait_exponential
8+
9+
agent = Agent(
10+
"google-gla:gemini-2.5-pro",
11+
system_prompt=(
12+
"Directly generate a markdown summary of the provided benchmark results. "
13+
"Do not include any conversational filler or introductory sentences. "
14+
"Your response should begin immediately with the summary content, "
15+
"structured with markdown sub-headings (e.g., '#### Summary', '##### Insert Performance', '#### Search Performance'). "
16+
"The summary should analyze insert and search performance, "
17+
"compare the different implementations, and include speedup metrics."
18+
),
19+
)
20+
21+
22+
@retry(wait=wait_exponential(multiplier=1, min=4, max=10), stop=stop_after_attempt(3))
23+
def generate_summary(agent: Agent, benchmark_markdown_output: str) -> str:
24+
results = agent.run_sync(benchmark_markdown_output)
25+
return results.output
626

727

828
def compare_benchmarks():
@@ -62,6 +82,10 @@ def compare_benchmarks():
6282
markdown_output = group.to_markdown(index=False)
6383
if markdown_output:
6484
f.write(markdown_output)
85+
# Generate a comparision summary section via LLM which includes the speedup gains and/os losses
86+
f.write("\n\n#### AI Summary\n")
87+
summary = generate_summary(agent, markdown_output)
88+
f.write(summary)
6589
f.write("\n\n")
6690

6791
print("--- Finished benchmark comparison successfully ---")

benches/run_benches.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ def run_benchmarks():
6363
if __name__ == "__main__":
6464
run_benchmarks()
6565
compare_benchmarks()
66-

0 commit comments

Comments
 (0)