File size: 908 Bytes
0733fd6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 ===") |