From a2ea6b1b5b4404fd51de06872edc2768a4290d7a Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 20 Jun 2024 20:40:03 -0700 Subject: [PATCH] enh: tool async support --- backend/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index bd24c369b..744c84b6d 100644 --- a/backend/main.py +++ b/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 = {