CoolFace
Modelpublic

MuratcanKoylan/Marketing-Memory-Routing-8B

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
1likes
debug_key.py29 linesDownload Raw Back to synthetic_data
1import os2from dotenv import load_dotenv3import cohere4 5load_dotenv()6 7key = os.getenv("CO_API_KEY")8 9if key:10    print(f"Key found. Length: {len(key)}")11    print(f"Prefix: {key[:4]}...")12    13    try:14        client = cohere.ClientV2(api_key=key)15        print("Client initialized.")16        # Simple test call17        print("Testing simple chat...")18        response = client.chat(19            model="command-r-plus", # Use a cheaper/standard model for quick test20            messages=[{"role": "user", "content": "Hello"}]21        )22        print("Response received!")23        print(response)24    except Exception as e:25        print(f"Error: {e}")26else:27    print("Key NOT found in environment.")28 29