refac: openai image async gen

This commit is contained in:
Timothy J. Baek 2024-09-20 03:16:08 +02:00
parent bd09b6dbad
commit d12b6cda4e

View File

@ -470,7 +470,9 @@ async def image_generations(
"response_format": "b64_json",
}
r = requests.post(
# Use asyncio.to_thread for the requests.post call
r = await asyncio.to_thread(
requests.post,
url=f"{app.state.config.OPENAI_API_BASE_URL}/images/generations",
json=data,
headers=headers,