bhavya-k commited on
Commit
d7b10f7
·
verified ·
1 Parent(s): c8f0bcc
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -10,10 +10,16 @@ def respond(message, history):
10
  messages.extend(history)
11
 
12
  messages.append({"role" : "user", "content" : message})
13
- response = client.chat_completion(messages, max_tokens = 100)
14
- temperature = 0.8
15
- top_p = 0.65
16
-
 
 
 
 
 
 
17
  print(response ["choices"][0]["message"]["content"].strip())
18
 
19
  return response ["choices"][0]["message"]["content"].strip()
 
10
  messages.extend(history)
11
 
12
  messages.append({"role" : "user", "content" : message})
13
+ response = ""
14
+ for messages in client.chat_completion(
15
+ messages,
16
+ max_tokens = 100
17
+ stream = True):
18
+ # temperature = 0.8
19
+ # top_p = 0.65
20
+ token = messages.choices[0].delta.content
21
+ yield response ["choices"][0]["message"]["content"].strip()
22
+
23
  print(response ["choices"][0]["message"]["content"].strip())
24
 
25
  return response ["choices"][0]["message"]["content"].strip()