-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_experiments.py
More file actions
33 lines (25 loc) · 868 Bytes
/
run_experiments.py
File metadata and controls
33 lines (25 loc) · 868 Bytes
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
import json
import os
USE_ANTHROPIC = False # <-- intentional default
if USE_ANTHROPIC:
from models.anthropic_model import query_anthropic as query_model
else:
from models.mock_model import query_model
results = []
for file in ["factual", "ambiguous", "unanswerable"]:
data = json.load(open(f"data/{file}.json"))
for item in data:
answer, confidence = query_model(item["question"])
correct = (
item["answer"] is not None
and answer is not None
and answer.lower() == item["answer"].lower()
)
results.append({
"question": item["question"],
"confidence": confidence,
"correct": correct,
"type": file,
"model": "anthropic" if USE_ANTHROPIC else "mock"
})
json.dump(results, open("results.json", "w"), indent=2)