Skip to content

Commit d4ee767

Browse files
committed
Add coroutine check for non async clients.
1 parent bea1116 commit d4ee767

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

controller/attribute/llm_response_tmpl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,12 @@ async def get_chat_completion_async_4a90ecec_fc72_45af_ba0d_ae9a2dc4674c(
263263
response_format={"type": "json_object"},
264264
**kwargs,
265265
)
266+
266267
if close_after:
267-
await client.close()
268+
result = client.close()
269+
if asyncio.iscoroutine(result):
270+
await result
271+
268272
return completion
269273

270274

0 commit comments

Comments
 (0)