-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Description
Describe the bug
I have been using OpenAI API key for long time. When I give some question to the model, call the API and it'll return the answer, sometimes it won't return the complete answer due to token issues.
Recently, I saw that ChatGPT has come up with new feature, continue generation, where if i click on that, it is continuing the generation in the same block. Below is the picture,
Is there any way to do that for the API code as well?
To Reproduce
- Completion of the answer
- Limitation of tokens
Code snippets
import openai
messages = [
{"role": "system", "content": "You are a kind helpful assistant."},
]
while True:
message = input("User : ")
if message:
messages.append(
{"role": "user", "content": message},
)
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
print(f"ChatGPT: {reply}")
messages.append({"role": "assistant", "content": reply})
OS
WindowsOS
Python version
Python 3.8.5
Library version
latest version
bhaktatejas922, satoooh and EliahKagan