Spaces:
Running
Running
a100 kh
commited on
Commit
•
104a909
1
Parent(s):
7ce28de
app.py
CHANGED
@@ -36,11 +36,21 @@ def respond(
|
|
36 |
|
37 |
response = ""
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
for message in client.chat.completions.create(
|
40 |
model=model_name,
|
41 |
messages=messages,
|
42 |
max_tokens=max_tokens,
|
43 |
-
|
44 |
temperature=temperature,
|
45 |
top_p=top_p,
|
46 |
):
|
|
|
36 |
|
37 |
response = ""
|
38 |
|
39 |
+
completion = client.chat.completions.create(model=model_name,
|
40 |
+
messages=messages,
|
41 |
+
temperature=temperature,
|
42 |
+
max_tokens=max_tokens,
|
43 |
+
top_p=top_p,
|
44 |
+
)
|
45 |
+
text = completion.choices[0].message.content.strip()
|
46 |
+
return text
|
47 |
+
|
48 |
+
# streamは一旦無効化
|
49 |
for message in client.chat.completions.create(
|
50 |
model=model_name,
|
51 |
messages=messages,
|
52 |
max_tokens=max_tokens,
|
53 |
+
stream=True,
|
54 |
temperature=temperature,
|
55 |
top_p=top_p,
|
56 |
):
|