-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.py
More file actions
53 lines (44 loc) · 1.58 KB
/
Copy pathquickstart.py
File metadata and controls
53 lines (44 loc) · 1.58 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""Quickstart example for athena-verify.
Run with: python examples/quickstart.py
"""
from athena_verify import verify
# Your retrieved context chunks (from any RAG pipeline)
context = [
"The indemnification clause in Section 12.1 states that the liability cap "
"is $2,000,000 per incident, with an aggregate annual cap of $5,000,000.",
"The agreement was signed on January 15, 2024, by both parties.",
"Either party may terminate this agreement with 90 days written notice.",
]
# The LLM-generated answer to verify
answer = (
"The liability cap is $1,000,000 per incident. "
"The agreement can be terminated with 30 days notice. "
"It was signed on January 15, 2024."
)
# Run verification
result = verify(
question="What are the key terms of the contract?",
answer=answer,
context=context,
)
# Print results
print(f"Overall trust score: {result.trust_score:.2f}")
print(f"Verification passed: {result.verification_passed}")
print(f"Number of sentences: {len(result.sentences)}")
print()
for sent in result.sentences:
status_emoji = {
"SUPPORTED": "✅",
"PARTIAL": "🟡",
"UNSUPPORTED": "🔴",
"CONTRADICTED": "❌",
}.get(sent.support_status, "❓")
print(f" {status_emoji} [{sent.support_status}] (trust: {sent.trust_score:.2f})")
print(f" \"{sent.text}\"")
print()
if result.unsupported:
print(f"\n⚠️ {len(result.unsupported)} unsupported claim(s) detected!")
for sent in result.unsupported:
print(f" - \"{sent.text}\"")
else:
print("\n✅ All claims are supported by the context.")