Spaces:
Runtime error
Runtime error
Update ai_generate.py
Browse files- ai_generate.py +4 -5
ai_generate.py
CHANGED
@@ -27,12 +27,11 @@ def generate(text, model, api):
|
|
27 |
stream=True,
|
28 |
stop=None,
|
29 |
)
|
30 |
-
|
31 |
-
for chunk in completion:
|
32 |
-
print(chunk.choices[0].delta.content or "", end="")
|
33 |
|
34 |
-
|
35 |
-
|
|
|
|
|
36 |
elif model == "OpenAI GPT 3.5":
|
37 |
client = OpenAI(
|
38 |
api_key=api,
|
|
|
27 |
stream=True,
|
28 |
stop=None,
|
29 |
)
|
|
|
|
|
|
|
30 |
|
31 |
+
response = ""
|
32 |
+
for chunk in completion:
|
33 |
+
response += chunk.choices[0].delta.content or ""
|
34 |
+
return response
|
35 |
elif model == "OpenAI GPT 3.5":
|
36 |
client = OpenAI(
|
37 |
api_key=api,
|