microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service
MIT License
1.14k stars 949 forks source link

Load Test #388

Open quirxx-droid opened 1 month ago

quirxx-droid commented 1 month ago

I have this app deployed and I am trying to do the load-test using locust.

I am able to obtain access token but when I try to make an api call using:

chat_endpoint = 'app-url/api/chat'  # Ensure this is the correct API endpoint

# JSON payload for the chat message
chat_payload = {
    'id': 'thread-id',  # Replace with the actual chat thread ID
    'message': 'Hello, LLM!'  # The user message
}

chat_headers = {
    'Authorization': f'Bearer {token}',
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Origin': 'app-url',
    'Referer': 'app-url/chat/thread-id',
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15'
}

chat_response = requests.post(chat_endpoint, headers=chat_headers, json=chat_payload)

print(f"Chat Status Code: {chat_response.status_code}")
print(f"Chat Response Headers: {chat_response.headers}")
print(f"Chat Raw Response Content: {chat_response.text}")

try:
    chat_response_json = chat_response.json()
    print('Chat Response:', chat_response_json)
except ValueError:
    print('Chat response content is not valid JSON')

though I am getting status code 200, I am getting a response in html. When I look at transactions in Applications Insights, I see code 307.