-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
According to How_to_stream_completions
response = openai.ChatCompletion.create(
model='gpt-3.5-turbo',
messages=[
{'role': 'user', 'content': "What's 1+1? Answer in one word."}
],
temperature=0,
stream=True
)
for chunk in response:
print(chunk)
we can stream a chat completion via ChatCompletion.create
but when I use ChatCompletion.acreate
, it failed.
TypeError: 'async_generator' object is not iterable
To Reproduce
response = openai.ChatCompletion.acreate(
model='gpt-3.5-turbo',
messages=[
{'role': 'user', 'content': "What's 1+1? Answer in one word."}
],
temperature=0,
stream=True
)
for chunk in response:
print(chunk)
Code snippets
response = openai.ChatCompletion.acreate(
model='gpt-3.5-turbo',
messages=[
{'role': 'user', 'content': "What's 1+1? Answer in one word."}
],
temperature=0,
stream=True
)
for chunk in response:
print(chunk)
### OS
macOS
### Python version
Python 3.11
### Library version
0.27.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working