File size: 1,184 Bytes
b0b150b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Quick test to see the full multimodal response
"""
import requests
from pathlib import Path

BASE_URL = 'http://127.0.0.1:8000'

# Login
login_resp = requests.post(f'{BASE_URL}/api/auth/login', json={'email': 'dev@gmail.com', 'password': '123456'})
token = login_resp.json().get('access_token')
headers = {'Authorization': f'Bearer {token}'}

# Get agent
agents_resp = requests.get(f'{BASE_URL}/api/agents/', headers=headers)
agent_name = agents_resp.json()[0]['name']
print(f"Using agent: {agent_name}")

# Test with image
test_image = Path('data/temp/test_multimodal.png')
with open(test_image, 'rb') as f:
    files = {'image': (test_image.name, f, 'image/png')}
    data = {'agent_name': agent_name, 'message': 'What color is this image?', 'include_explainability': 'true'}
    response = requests.post(f'{BASE_URL}/api/chat/multimodal', files=files, data=data, headers=headers, timeout=120)

result = response.json()
print('=== FULL RESPONSE ===')
print(f"Success: {result.get('success')}")
print(f"Answer: {result.get('answer')}")
print(f"Confidence: {result.get('confidence')}")
print(f"Image URL: {result.get('image_url')}")
print(f"In Domain: {result.get('in_domain')}")