Spaces:
Sleeping
Sleeping
Update function/agent/pipeline_agent.py
Browse files- function/agent/pipeline_agent.py +20 -27
function/agent/pipeline_agent.py
CHANGED
|
@@ -1,27 +1,20 @@
|
|
| 1 |
-
import os,sys
|
| 2 |
-
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))
|
| 3 |
-
sys.path.insert(0, BASE_DIR)
|
| 4 |
-
from function.file import extract_file as extract_file
|
| 5 |
-
import function.agent.function_call as fc
|
| 6 |
-
import function.function_agent.multi_agent as multi_agent
|
| 7 |
-
import function.function_agent.map_toolcall as map_toolcall
|
| 8 |
-
import function.gemini_response.response_all as response_all
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
async def multi_query_user(user_input:str, user_id:int,role,languages:str,chat_id,token)->str:
|
| 12 |
-
multi_tasks = await fc.process_user_query(user_input,user_id,role,languages,chat_id)
|
| 13 |
-
result_multi_task = await multi_agent.process_toolcalls_with_order(multi_tasks,token)
|
| 14 |
-
map_tool_result = map_toolcall.map_toolcalls_with_results(multi_tasks,result_multi_task)
|
| 15 |
-
result = await response_all.response_all(user_input,map_tool_result)
|
| 16 |
-
if result != None:
|
| 17 |
-
return result
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
# if __name__ == "__main__":
|
| 22 |
-
# token = "eyJhbGciOiJIUzI1NiJ9.eyJVc2VySWQiOiI0IiwiUm9sZXMiOiJDVVNUT01FUiIsInNlc3Npb25JZCI6ImJkM2M5MmNkLTczMzgtNDlmNS04NzIyLTUwMDU0Zjk5MjRhZSIsInN1YiI6ImxpbmgiLCJpYXQiOjE3NDg3NjcwNDUsImV4cCI6MTc0OTY2NzA0NX0.X4d4GcstDhaVC1nbPWWkN3sUEHNUltDtD5KgP_mzPrM"
|
| 23 |
-
# result = asyncio.run(multi_query_user("Tôi muốn thêm sản phẩm Yogurt Đào size S vào giỏ hàng và tôi quyết định mua sản phẩm này", 4 , "CUSTOMER", "VN","67d009fee0a638763885c195",token=token))
|
| 24 |
-
# print(result)
|
| 25 |
-
if __name__ == "__main__":
|
| 26 |
-
result = asyncio.run(multi_query_user("Tôi muốn thêm trà chanh size L vào giỏ", 4, "CUSTOMER", "ADMIN","67d2fc6607b51a01e3beb501",""))
|
| 27 |
-
print(result)
|
|
|
|
| 1 |
+
import os,sys
|
| 2 |
+
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))
|
| 3 |
+
sys.path.insert(0, BASE_DIR)
|
| 4 |
+
from function.file import extract_file as extract_file
|
| 5 |
+
import function.agent.function_call as fc
|
| 6 |
+
import function.function_agent.multi_agent as multi_agent
|
| 7 |
+
import function.function_agent.map_toolcall as map_toolcall
|
| 8 |
+
import function.gemini_response.response_all as response_all
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
async def multi_query_user(user_input:str, user_id:int,role,languages:str,chat_id,token)->str:
|
| 12 |
+
multi_tasks = await fc.process_user_query(user_input,user_id,role,languages,chat_id)
|
| 13 |
+
result_multi_task = await multi_agent.process_toolcalls_with_order(multi_tasks,token)
|
| 14 |
+
map_tool_result = map_toolcall.map_toolcalls_with_results(multi_tasks,result_multi_task)
|
| 15 |
+
result = await response_all.response_all(user_input,map_tool_result)
|
| 16 |
+
if result != None:
|
| 17 |
+
return result
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|