Spaces:
Paused
Paused
Update llm_client.py
Browse files- llm_client.py +12 -3
llm_client.py
CHANGED
|
@@ -77,9 +77,18 @@ class HybridLLM(LLM):
|
|
| 77 |
if self.groq_client:
|
| 78 |
try:
|
| 79 |
print("⚡ Using Groq API...")
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
except Exception as e:
|
| 84 |
print(f"⚠️ Groq API Failed: {e}")
|
| 85 |
# Continue to next fallback
|
|
|
|
| 77 |
if self.groq_client:
|
| 78 |
try:
|
| 79 |
print("⚡ Using Groq API...")
|
| 80 |
+
stop_seq = (stop or []) + ["<|im_end|>", "Input:", "Context:"]
|
| 81 |
+
|
| 82 |
+
chat_completion = self.groq_client.chat.completions.create(
|
| 83 |
+
messages=[
|
| 84 |
+
{"role": "user", "content": prompt}
|
| 85 |
+
],
|
| 86 |
+
model=self.groq_model,
|
| 87 |
+
temperature=0.3,
|
| 88 |
+
max_tokens=1024,
|
| 89 |
+
stop=stop_seq
|
| 90 |
+
)
|
| 91 |
+
return chat_completion.choices[0].message.content
|
| 92 |
except Exception as e:
|
| 93 |
print(f"⚠️ Groq API Failed: {e}")
|
| 94 |
# Continue to next fallback
|