Spaces:
Paused
Paused
Download python/tools/knowledge_tool.py from OnyxMunk/GravityFalls: direct link, hf CLI and curl.
- Browser
- Download file 877 Bytes
-
https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/c425c4043529634171dcfbb3aa5a94de613d28a8/python/tools/knowledge_tool.py
- Command line
-
hf download hf://spaces/OnyxMunk/GravityFalls@c425c4043529634171dcfbb3aa5a94de613d28a8/python/tools/knowledge_tool.py
-
curl -L -o knowledge_tool.py https://huggingface.co/spaces/OnyxMunk/GravityFalls/resolve/c425c4043529634171dcfbb3aa5a94de613d28a8/python/tools/knowledge_tool.py
877 Bytes
| from agent import Agent | |
| from . import online_knowledge_tool | |
| from . import memory_tool | |
| import concurrent.futures | |
| from python.helpers.tool import Tool, Response | |
| from python.helpers import files | |
| class Knowledge(Tool): | |
| def execute(self, question="", **kwargs): | |
| with concurrent.futures.ThreadPoolExecutor() as executor: | |
| # Schedule the two functions to be run in parallel | |
| future_online = executor.submit(online_knowledge_tool.process_question, question) | |
| future_memory = executor.submit(memory_tool.process_query, self.agent, question) | |
| # Wait for both functions to complete | |
| online_result = future_online.result() | |
| memory_result = future_memory.result() | |
| result = f"# Online sources:\n{online_result}\n\n# Memory:\n{memory_result}" | |
| return Response(message=result, break_loop=False) |