minko186 commited on
Commit
db28377
·
verified ·
1 Parent(s): 6ebeb61

Update ai_generate.py

Browse files
Files changed (1) hide show
  1. 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
- print(response)
35
- return response[0]
 
 
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,