close OpenAI client

This commit is contained in:
Abi Raja 2023-12-03 14:45:39 -05:00
parent 0cc2c78f55
commit a98b9d83f0
2 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,7 @@ async def generate_image(prompt, api_key, base_url):
"prompt": prompt, "prompt": prompt,
} }
res = await client.images.generate(**image_params) res = await client.images.generate(**image_params)
await client.close()
return res.data[0].url return res.data[0].url

View File

@ -30,4 +30,6 @@ async def stream_openai_response(
full_response += content full_response += content
await callback(content) await callback(content)
await client.close()
return full_response return full_response