drift-detector / test_llm.py
HarshBhati's picture
registered agents are showing but groq is not working fine
0733fd6
raw
history blame contribute delete
908 Bytes
# test_llm.py - Create this as a separate file to test your LLM setup
import os
from dotenv import load_dotenv
print("=== Testing LLM Setup ===")
# Load environment variables
load_dotenv()
print(f"βœ… Environment loaded")
print(f"πŸ”‘ GROQ_API_KEY exists: {'GROQ_API_KEY' in os.environ}")
if 'GROQ_API_KEY' in os.environ:
key = os.environ['GROQ_API_KEY']
print(f"πŸ”‘ API Key starts with: {key[:10]}...")
# Test LLM import
try:
from ourllm import llm
print("βœ… Successfully imported LLM")
# Test LLM call
test_message = "Hello, please respond with 'LLM is working correctly'"
print(f"πŸ§ͺ Testing with message: {test_message}")
response = llm.invoke(test_message)
print(f"βœ… LLM Response: {response.content}")
except ImportError as e:
print(f"❌ Import error: {e}")
except Exception as e:
print(f"❌ LLM call error: {e}")
print("=== Test Complete ===")