MuratcanKoylan/Marketing-Memory-Routing-8B
1
1import os2import cohere3import time4from dotenv import load_dotenv5 6load_dotenv()7 8def test_connection():9 api_key = os.getenv("COHERE_API_KEY")10 if not api_key:11 print("Error: COHERE_API_KEY not found.")12 return13 14 print(f"Testing connection with API Key: {api_key[:4]}...{api_key[-4:]}")15 client = cohere.ClientV2(api_key=api_key)16 17 print("Sending request to command-a-reasoning-08-2025...")18 start_time = time.time()19 try:20 response = client.chat(21 messages=[{"role": "user", "content": "Say 'Hello, World!'"}],22 model="command-a-reasoning-08-2025",23 thinking={"type": "enabled"},24 temperature=0.725 )26 elapsed = time.time() - start_time27 print(f"Response received in {elapsed:.2f}s")28 print("Response object:", response)29 30 # Try to extract text31 if hasattr(response, 'message') and response.message.content:32 for block in response.message.content:33 if block.type == 'text':34 print(f"Text content: {block.text}")35 except Exception as e:36 print(f"Error: {e}")37 38if __name__ == "__main__":39 test_connection()40 41 