How to do asynchronous calls with the latest api version?

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(
            model="gpt-4",
            messages=messages,
            tools=functions,
            temperature=0.0,
            tool_choice=None
        )
6 Likes