소스 검색

enh: tool async support

Timothy J. Baek 11 달 전
부모
커밋
a2ea6b1b5b
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      backend/main.py

+ 4 - 1
backend/main.py

@@ -309,7 +309,10 @@ async def get_function_call_response(
                             "__id__": tool_id,
                         }
 
-                    function_result = function(**params)
+                    if inspect.iscoroutinefunction(function):
+                        function_result = await function(**params)
+                    else:
+                        function_result = function(**params)
 
                     if hasattr(toolkit_module, "citation") and toolkit_module.citation:
                         citation = {