How do we now handle asynchronous calls to the API now that acreate has been removed?
previously I could do this.
response = await openai.ChatCompletion.acreate
After the update, to call the chat completion API you’d use
response = client.chat.completions.create
I tried searching for acreate or asynchronous on the docs sites and there are no results, even for legacy.
Has asynchronous calls been removed?
Maybe below code is the replacement i have not tried yet though but found on github
from openai import AsyncOpenAI
client = AsyncOpenAI()
response = await client.chat.completions.create(
This worked. For those that come across this thread, you will also need to update how you handle the responses, as objects are now returned.
Something like this: