Blood076 commited on
Commit
6924687
·
verified ·
1 Parent(s): a5d594b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -34,13 +34,16 @@ def respond(
34
  response = ""
35
 
36
 
37
- mensagens = client.chat_completion(
38
- messages,
39
- max_tokens=max_tokens,
40
- temperature=temperature,
41
- top_p=top_p,
42
- )
43
- response = mensagens.choices[0].message.content
 
 
 
44
 
45
  return response
46
 
 
34
  response = ""
35
 
36
 
37
+ # Chama a API do modelo de linguagem para gerar a resposta
38
+ try:
39
+ response = client.chat_completion(
40
+ messages=messages,
41
+ max_tokens=max_tokens,
42
+ temperature=temperature,
43
+ top_p=top_p,
44
+ ).choices[0].message.content
45
+ except Exception as e:
46
+ response = f"Error: {e}"
47
 
48
  return response
49