Spaces:
Sleeping
Sleeping
Update groq_chat.py
Browse files- groq_chat.py +6 -1
groq_chat.py
CHANGED
|
@@ -7,10 +7,15 @@ import os
|
|
| 7 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY_simple_chatbot")
|
| 8 |
MODEL = "moonshotai/kimi-k2-instruct"
|
| 9 |
|
| 10 |
-
print("API Key loaded:", bool(GROQ_API_KEY_simple_chatbot))
|
| 11 |
|
| 12 |
|
| 13 |
def chat_with_groq(prompt, history=None, system_prompt="You are a helpful assistant.", temperature=0.7):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
url = "https://api.groq.com/openai/v1/chat/completions"
|
| 15 |
headers = {
|
| 16 |
"Authorization": f"Bearer {GROQ_API_KEY}",
|
|
|
|
| 7 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY_simple_chatbot")
|
| 8 |
MODEL = "moonshotai/kimi-k2-instruct"
|
| 9 |
|
| 10 |
+
# print("API Key loaded:", bool(GROQ_API_KEY_simple_chatbot))
|
| 11 |
|
| 12 |
|
| 13 |
def chat_with_groq(prompt, history=None, system_prompt="You are a helpful assistant.", temperature=0.7):
|
| 14 |
+
|
| 15 |
+
print("API Key loaded:", bool(GROQ_API_KEY_simple_chatbot))
|
| 16 |
+
if not GROQ_API_KEY:
|
| 17 |
+
raise RuntimeError("Missing GROQ_API_KEY — make sure it's set as a Hugging Face secret.")
|
| 18 |
+
|
| 19 |
url = "https://api.groq.com/openai/v1/chat/completions"
|
| 20 |
headers = {
|
| 21 |
"Authorization": f"Bearer {GROQ_API_KEY}",
|