With AsyncOpenAI, openai.images.generate does not work correctly when it is used with await, but it works without await. This seems to work perfectly in NodeJS, but not here in Python.
Example code:
response = await openai.images.generate(
model="dall-e-3",
prompt=prompt,
n=1,
quality="hd",
response_format="b64_json",
size=("792x1024"
)
And here is the traceback:
Traceback (most recent call last):
File "app.py", line 83, in dall_e
response = await openai.images.generate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object ImagesResponse can't be used in 'await' expression
By removing await, it works correctly, but it is obviously not running asynchronously.