dungeon29 commited on
Commit
671191d
·
verified ·
1 Parent(s): 84d4eee

Update llm_client.py

Browse files
Files changed (1) hide show
  1. 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
- # ChatGroq returns a message object, we need the content string
81
- response = self.groq_client.invoke(prompt)
82
- return response.content
 
 
 
 
 
 
 
 
 
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