Agent Zero AI framework
Update knowledge_tool.py
John Bollenbachere05d75a73088
diff --git a/python/tools/knowledge_tool.py b/python/tools/knowledge_tool.pyindex cc858e4f1..d274d7802 100644--- a/python/tools/knowledge_tool.py+++ b/python/tools/knowledge_tool.py@@ -17,7 +17,7 @@ class Knowledge(Tool):with concurrent.futures.ThreadPoolExecutor() as executor:# Schedule the two functions to be run in parallel- # perplexity search, if API provided+ # perplexity search, if API key providedif os.getenv("API_KEY_PERPLEXITY"):perplexity = executor.submit(perplexity_search.perplexity_search, question)else: perplexity = None@@ -29,14 +29,14 @@ class Knowledge(Tool):future_memory = executor.submit(memory_tool.search, self.agent, question)# Wait for both functions to complete- perplexity_result = (perplexity.result() if perplexity else "") or ""+ perplexity_result = (perplexity.result() if perplexity else "")duckduckgo_result = duckduckgo.result()memory_result = future_memory.result()msg = files.read_file("prompts/tool.knowledge.response.md",- online_sources = perplexity_result + "\n\n" + str(duckduckgo_result),+ online_sources = ((perplexity_result + "\n\n") if perplexity else "") + str(duckduckgo_result),memory = memory_result )if self.agent.handle_intervention(msg): pass # wait for intervention and handle it, if paused- return Response(message=msg, break_loop=False)\ No newline at end of file+ return Response(message=msg, break_loop=False)