-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_learning_chat.py
More file actions
29 lines (22 loc) · 834 Bytes
/
test_learning_chat.py
File metadata and controls
29 lines (22 loc) · 834 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
28
29
import requests
import json
BASE_URL = "http://127.0.0.1:8000"
def test_learning_chat():
print("Testing /learning/chat endpoint...")
url = f"{BASE_URL}/learning/chat"
payload = {
"message": "Explain the difference between a process and a thread.",
"candidate_id": None
}
try:
response = requests.post(url, json=payload)
if response.status_code == 200:
print("SUCCESS: Endpoint responded 200 OK")
print(f"Response: {json.dumps(response.json(), indent=2)}")
else:
print(f"FAILURE: Status Code {response.status_code}")
print(f"Response: {response.text}")
except Exception as e:
print(f"ERROR: Could not connect to backend. {e}")
if __name__ == "__main__":
test_learning_chat()