-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_progressive_streaming.py
More file actions
80 lines (66 loc) · 2.1 KB
/
test_progressive_streaming.py
File metadata and controls
80 lines (66 loc) · 2.1 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python3
"""Test progressive streaming - logs should appear incrementally, not all at once."""
import requests
import json
import time
BACKEND_URL = "http://af3615e06391145bc88022ac024a36ca-bd296660cda3522f.elb.us-west-2.amazonaws.com"
payload = {
"topic": "What is the tariff code for chocolate candy?",
"report_organization": "Brief summary",
"collection": "us_tariffs",
"search_web": False,
"strategy": "auto"
}
print("=" * 80)
print("TESTING PROGRESSIVE STREAMING")
print("=" * 80)
print()
print("Query: 'What is the tariff code for chocolate candy?'")
print("Expected: SIMPLE_RAG with progressive log updates")
print()
print("Monitoring log appearance times...")
print("-" * 80)
start_time = time.time()
try:
response = requests.post(
f"{BACKEND_URL}/research",
json=payload,
timeout=180
)
end_time = time.time()
elapsed = end_time - start_time
result = response.json()
logs = result.get('logs', [])
print()
print("=" * 80)
print(f"✅ Query completed in {elapsed:.1f} seconds")
print("=" * 80)
print()
print(f"Total logs received: {len(logs)}")
print()
print("Logs:")
for i, log in enumerate(logs, 1):
print(f" {i}. {log[:80]}")
print()
print("-" * 80)
print()
if len(logs) >= 6:
print("✅ SUCCESS: Received detailed logs!")
print()
print("NOTE: In the UI, these should appear progressively:")
print(" - First 2 logs after ~5 seconds (query generation)")
print(" - Next 2-3 logs after ~15 seconds (searching)")
print(" - Final 2 logs after ~25 seconds (synthesis)")
print()
print("The API returns all logs at once, but the SSE stream")
print("should have shown them progressively as nodes completed.")
else:
print(f"⚠️ Only {len(logs)} logs - expected 6+")
except requests.exceptions.Timeout:
print("❌ Query timed out after 180 seconds")
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()
print()
print("=" * 80)