forked from JamsheerJabbar/Hackathon_backend_deriv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_complex_query.py
More file actions
27 lines (24 loc) · 1020 Bytes
/
debug_complex_query.py
File metadata and controls
27 lines (24 loc) · 1020 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
import asyncio
from app.orchestration.workflow import app_graph
async def test_complex_query():
# Attempting Case 3: Analyze the impact of login failures on transaction status.
query = "Analyze the impact of login failures on transaction status. Compare the percentage of successful transactions for users with at least one failed login vs those with none."
initial_state = {
"user_question": query,
"domain": "operations",
"conversation_history": [],
"retry_count": 0
}
try:
result = await app_graph.ainvoke(initial_state)
print("RESULT STATUS:", result.get("status"))
if result.get("status") == "success":
print("SQL:", result.get("generated_sql"))
print("INSIGHT:", result.get("insight"))
else:
print("ERROR:", result.get("validation_error"))
except Exception as e:
import traceback
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(test_complex_query())