Update app.py
Browse files
app.py
CHANGED
@@ -30,20 +30,20 @@ def respond(
|
|
30 |
|
31 |
response = ""
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
yield
|
47 |
|
48 |
|
49 |
"""
|
|
|
30 |
|
31 |
response = ""
|
32 |
|
33 |
+
try:
|
34 |
+
# Chat completion, only parameters that are supported
|
35 |
+
for message in client.chat_completion(
|
36 |
+
messages=messages,
|
37 |
+
max_tokens=max_tokens,
|
38 |
+
stream=True,
|
39 |
+
temperature=temperature,
|
40 |
+
top_p=top_p,
|
41 |
+
):
|
42 |
+
token = message.choices[0].delta.content
|
43 |
+
response += token
|
44 |
+
yield response
|
45 |
+
except Exception as e:
|
46 |
+
yield f"Error: {e}"
|
47 |
|
48 |
|
49 |
"""
|