-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (34 loc) · 1.07 KB
/
main.py
File metadata and controls
44 lines (34 loc) · 1.07 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
"""
Entry point for ReasonGraph.
"""
import sys
from app.graph.graph import graph
from app.graph.state import initial_state
def main() -> None:
query = sys.argv[1] if len(sys.argv) > 1 else "What is this document about?"
state = initial_state(query)
result = graph.invoke(state)
# Draft answer
draft = result.get("draft_answer") or ""
print(draft)
print()
# Citations: [chunk_id] → claim
citations = result.get("citations") or []
if citations:
for c in citations:
chunk_id = c.get("chunk_id") or ""
claim = c.get("claim") or ""
print(f"[{chunk_id}] → {claim}")
print()
# Verifier warning
if not result.get("verifier_passed", False):
print("Warning: The answer may be unreliable (verification did not pass).")
print()
# Unsupported claims
unsupported = result.get("unsupported_claims") or []
if unsupported:
print("Unsupported claims:")
for claim in unsupported:
print(f" - {claim}")
if __name__ == "__main__":
main()