Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,20 @@ def respond(message, history):
|
|
| 9 |
if history:
|
| 10 |
messages.extend(history)
|
| 11 |
messages.append({"role":"user", "content": message})
|
| 12 |
-
response =
|
|
|
|
| 13 |
messages,
|
| 14 |
-
max_tokens =
|
| 15 |
temperature = 0.5,
|
| 16 |
-
top_p = 0.7
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def echo(message, history):
|
| 22 |
choices = ["Without a doubt", "Ask again later","Yes, definitely","Don't count on it"]
|
|
|
|
| 9 |
if history:
|
| 10 |
messages.extend(history)
|
| 11 |
messages.append({"role":"user", "content": message})
|
| 12 |
+
response = ""
|
| 13 |
+
for message in client.chat_completion(
|
| 14 |
messages,
|
| 15 |
+
max_tokens = 100, #change the length
|
| 16 |
temperature = 0.5,
|
| 17 |
+
top_p = 0.7,
|
| 18 |
+
stream=True
|
| 19 |
+
):
|
| 20 |
+
token = message.choices[0].delta.content
|
| 21 |
+
response += token
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
yield response["choices"][0]["message"]["content"].strip()
|
| 26 |
|
| 27 |
def echo(message, history):
|
| 28 |
choices = ["Without a doubt", "Ask again later","Yes, definitely","Don't count on it"]
|