-
Notifications
You must be signed in to change notification settings - Fork 1
/
minimal.py
36 lines (29 loc) · 880 Bytes
/
minimal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
from insightbench import benchmarks, agents
# Set OpenAI API Key
# os.environ["OPENAI_API_KEY"] = "<openai_api_key>"
# Get Dataset
dataset_dict = benchmarks.load_dataset_dict("data/notebooks/flag-1.json")
# Run an Agent
agent = agents.Agent(
model_name="gpt-4o-mini",
max_questions=2,
branch_depth=1,
n_retries=2,
savedir="results/sample",
)
pred_insights, pred_summary = agent.get_insights(
dataset_csv_path=dataset_dict["dataset_csv_path"], return_summary=True
)
# Evaluate
score_insights = benchmarks.evaluate_insights(
pred_insights=pred_insights,
gt_insights=dataset_dict["insights"],
score_name="rouge1",
)
score_summary = benchmarks.evaluate_summary(
pred=pred_summary, gt=dataset_dict["summary"], score_name="rouge1"
)
# Print Score
print("score_insights: ", score_insights)
print("score_summary: ", score_summary)