import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "http://localhost:8000/api/v1" # Replace with your AIVA Queen instance URL

def chat_with_aiva(user_id, message):
  headers = {"Authorization": f"Bearer {API_KEY}"}
  payload = {"user_id": user_id, "message": message}
  response = requests.post(f"{BASE_URL}/chat", headers=headers, json=payload)
  response.raise_for_status()  # Raise HTTPError for bad responses (4xx or 5xx)
  return response.json()

if __name__ == "__main__":
  try:
    result = chat_with_aiva("test_user", "Hello, AIVA!")
    print(result)
  except requests.exceptions.RequestException as e:
    print(f"Error: {e}")