-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_evaluation.py
More file actions
28 lines (22 loc) · 796 Bytes
/
test_evaluation.py
File metadata and controls
28 lines (22 loc) · 796 Bytes
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
import os
import httpx
from dotenv import load_dotenv
load_dotenv() # load .env if not already loaded
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
GROQ_MODEL = os.getenv("LLM_MODEL", "llama-3.1-70b-versatile")
if not GROQ_API_KEY:
raise RuntimeError("❌ GROQ_API_KEY not set in environment!")
url = "https://api.groq.com/openai/v1/chat/completions"
headers = {
"Authorization": f"Bearer {GROQ_API_KEY}",
"Content-Type": "application/json",
}
payload = {
"model": GROQ_MODEL,
"messages": [{"role": "user", "content": "Hello Groq! Just say 'pong' if you can hear me."}],
"max_tokens": 20,
}
print("🔄 Sending test request to Groq...")
resp = httpx.post(url, headers=headers, json=payload, timeout=30)
print("Status:", resp.status_code)
print("Response:", resp.json())