File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ async def create_completion(
318
318
Iterator [llama_cpp .CreateCompletionStreamResponse ],
319
319
] = await run_in_threadpool (llama , ** kwargs )
320
320
except Exception as err :
321
- exit_stack .close ()
321
+ await exit_stack .aclose ()
322
322
raise err
323
323
324
324
if isinstance (iterator_or_completion , Iterator ):
@@ -475,7 +475,7 @@ async def create_chat_completion(
475
475
# is complete.
476
476
# https://github.com/tiangolo/fastapi/issues/11143
477
477
exit_stack = contextlib .AsyncExitStack ()
478
- llama_proxy = exit_stack .enter_async_context (contextlib .asynccontextmanager (get_llama_proxy )())
478
+ llama_proxy = await exit_stack .enter_async_context (contextlib .asynccontextmanager (get_llama_proxy )())
479
479
if llama_proxy is None :
480
480
raise HTTPException (
481
481
status_code = status .HTTP_503_SERVICE_UNAVAILABLE ,
@@ -513,7 +513,7 @@ async def create_chat_completion(
513
513
llama_cpp .ChatCompletion , Iterator [llama_cpp .ChatCompletionChunk ]
514
514
] = await run_in_threadpool (llama .create_chat_completion , ** kwargs )
515
515
except Exception as err :
516
- exit_stack .close ()
516
+ await exit_stack .aclose ()
517
517
raise err
518
518
519
519
if isinstance (iterator_or_completion , Iterator ):
You can’t perform that action at this time.
0 commit comments