Spaces:
Runtime error
Runtime error
Update ai_generate.py
Browse files- ai_generate.py +3 -2
ai_generate.py
CHANGED
@@ -29,8 +29,9 @@ def generate(text, model, api):
|
|
29 |
)
|
30 |
|
31 |
response = ""
|
32 |
-
for chunk in completion:
|
33 |
-
|
|
|
34 |
return response
|
35 |
elif model == "OpenAI GPT 3.5":
|
36 |
client = OpenAI(
|
|
|
29 |
)
|
30 |
|
31 |
response = ""
|
32 |
+
for i, chunk in enumerate(completion):
|
33 |
+
if i != 0:
|
34 |
+
response += chunk.choices[0].delta.content or ""
|
35 |
return response
|
36 |
elif model == "OpenAI GPT 3.5":
|
37 |
client = OpenAI(
|