File size: 1,651 Bytes
691e701 |
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 |
#!/usr/bin/env python3
"""Test Drummond agent on live HuggingFace deployment"""
import requests
import json
# Test the chat endpoint with a greeting
url = "https://neural-thinker-cidadao-ai-backend.hf.space/api/v1/chat/message"
headers = {"Content-Type": "application/json"}
# Test 1: Simple greeting (should route to Drummond)
print("Test 1: Testing greeting message...")
data = {"message": "Olá, pode me ajudar?"}
try:
response = requests.post(url, json=data, headers=headers)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")
except Exception as e:
print(f"Error: {e}")
if hasattr(response, 'text'):
print(f"Raw response: {response.text}")
print("\n" + "="*50 + "\n")
# Test 2: Literary analysis request
print("Test 2: Testing literary analysis...")
data = {"message": "Analise o poema 'No meio do caminho tinha uma pedra' de Drummond"}
try:
response = requests.post(url, json=data, headers=headers)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")
except Exception as e:
print(f"Error: {e}")
if hasattr(response, 'text'):
print(f"Raw response: {response.text}")
print("\n" + "="*50 + "\n")
# Test 3: Check health endpoint
print("Test 3: Checking health endpoint...")
health_url = "https://neural-thinker-cidadao-ai-backend.hf.space/health"
try:
response = requests.get(health_url)
print(f"Status: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}")
except Exception as e:
print(f"Error: {e}") |