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 ===")