-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_final_fixes.py
More file actions
76 lines (64 loc) · 2.31 KB
/
test_final_fixes.py
File metadata and controls
76 lines (64 loc) · 2.31 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
#!/usr/bin/env python3
"""Test both log accumulation and RAG document name fixes."""
import requests
import json
import time
BACKEND_URL = "http://af3615e06391145bc88022ac024a36ca-bd296660cda3522f.elb.us-west-2.amazonaws.com"
payload = {
"topic": "What factors I need to consider (such as weight, important ingredients) when I need to decide tariff codes for various sweets? Mention tariff codes or code ranges.",
"report_organization": "Create a comprehensive report with introduction, detailed analysis, and conclusion. Perform a deep research and must use dynamic strategy. Try to utilize the us_tariff collection as well.",
"collection": "us_tariffs",
"search_web": True,
"strategy": "udr"
}
print("=" * 80)
print("FINAL TEST: Log Accumulation & RAG Document Names")
print("=" * 80)
print()
print("Sending UDR query with us_tariffs collection...")
print()
try:
response = requests.post(f"{BACKEND_URL}/research", json=payload, timeout=180)
result = response.json()
print("✅ Response received")
print()
# Test 1: Log Accumulation
print("=" * 80)
print("TEST 1: LOG ACCUMULATION")
print("=" * 80)
logs = result.get('logs', [])
print(f"Total logs: {len(logs)}")
print()
if len(logs) > 1:
print("✅ PASS: Multiple log entries accumulated!")
for i, log in enumerate(logs, 1):
print(f" {i}. {log[:80]}")
else:
print(f"❌ FAIL: Only {len(logs)} log entry")
if logs:
print(f" Content: {logs[0]}")
print()
# Test 2: RAG Document Names
print("=" * 80)
print("TEST 2: RAG DOCUMENT NAMES")
print("=" * 80)
citations = result.get('citations', '')
print("Citations:")
print("-" * 80)
print(citations)
print("-" * 80)
print()
# Check for document names
if "Chapter_" in citations or ".pdf" in citations:
print("✅ PASS: Found actual document names (Chapter_X.pdf)!")
elif "[RAG Document 1]" in citations:
print("⚠️ PARTIAL: Still showing generic 'RAG Document 1'")
print(" (This means citations array is still empty)")
else:
print("❓ UNKNOWN: Check citation format above")
print()
print("=" * 80)
except Exception as e:
print(f"❌ ERROR: {e}")
import traceback
traceback.print_exc()