Artin2009 commited on
Commit
58e3b00
1 Parent(s): d8dd5dc

Update chain_app.py

Browse files
Files changed (1) hide show
  1. chain_app.py +28 -13
chain_app.py CHANGED
@@ -1322,21 +1322,36 @@ async def main(message: cl.Message):
1322
  # ).send()
1323
 
1324
  elif chat_profile == 'Llama-3.1-405B':
1325
- client = InferenceClient(
1326
- "meta-llama/Meta-Llama-3.1-405B-Instruct",
1327
- token=f'{hf_token_llama_3_1}',
1328
- )
1329
-
1330
- for message in client.chat_completion(
1331
- messages=[{"role": "user", "content": f'{message.content}'}],
1332
- max_tokens=500,
 
 
 
1333
  stream=True,
1334
- ):
1335
- complete_message += message.choiches[0].delta.content
1336
- await cl.Message(
1337
- content=complete_message,
1338
- ).send()
 
 
 
 
 
 
 
 
 
 
 
1339
 
 
1340
  elif chat_profile == 'Llama-3.1-70B':
1341
  completion = groq_client.chat.completions.create(
1342
  model="llama-3.1-70b-versatile",
 
1322
  # ).send()
1323
 
1324
  elif chat_profile == 'Llama-3.1-405B':
1325
+ completion = groq_client.chat.completions.create(
1326
+ model="llama-3.1-405b-reasoning",
1327
+ messages=[
1328
+ {
1329
+ "role": "user",
1330
+ "content": message.content
1331
+ }
1332
+ ],
1333
+ temperature=1,
1334
+ max_tokens=1024,
1335
+ top_p=1,
1336
  stream=True,
1337
+ stop=None,
1338
+ )
1339
+
1340
+ complete_content = ""
1341
+
1342
+ # Iterate over each chunk
1343
+ for chunk in completion:
1344
+ # Retrieve the content from the current chunk
1345
+ content = chunk.choices[0].delta.content
1346
+
1347
+ # Check if the content is not None before concatenating it
1348
+ if content is not None:
1349
+ complete_content += content
1350
+
1351
+ # Send the concatenated content as a message
1352
+ await cl.Message(content=complete_content).send()
1353
 
1354
+
1355
  elif chat_profile == 'Llama-3.1-70B':
1356
  completion = groq_client.chat.completions.create(
1357
  model="llama-3.1-70b-versatile",