import requests import json import time def test_engine(): url = "http://127.0.0.1:8002/run" headers = {"Content-Type": "application/json"} payload = { "request_id": "test_script_001", "engine": "general-ai-engine", "action": "ask_question", "actor": {"user_id": "test_user", "session_id": None}, "input": {"text": "What is the capital of France?"}, "context": {}, "options": {"temperature": 0.7, "max_tokens": 50} } print(f"Sending request to {url}...") start_time = time.time() try: response = requests.post(url, headers=headers, json=payload, timeout=60) duration = time.time() - start_time print(f"Request finished in {duration:.2f} seconds.") print(f"Status Code: {response.status_code}") try: print("Response JSON:", json.dumps(response.json(), indent=2)) except: print("Response Text:", response.text) except Exception as e: print(f"Request failed: {e}") if __name__ == "__main__": # Wait a bit for server to be fully ready print("Waiting 5s for server warmup...") time.sleep(5) test_engine()