Skip to content

Building AI agents, atomically

chore: Update SearxNGSearchTool initialization to use base URL from environment variable

KennyVaneetvelde33a9f4bfa840
diff --git a/examples/article_idea_outline_gen_with_search.py b/examples/article_idea_outline_gen_with_search.py
index 26430c7..0275e74 100644
--- a/examples/article_idea_outline_gen_with_search.py
+++ b/examples/article_idea_outline_gen_with_search.py
@@ -6,6 +6,7 @@ This can be useful if you only want to include the latest search results to save
"""
from datetime import datetime
+import os
from rich.console import Console
from atomic_agents.lib.components.chat_memory import ChatMemory
from atomic_agents.agents.base_chat_agent import BaseChatAgent
@@ -20,7 +21,7 @@ from atomic_agents.lib.utils.logger import logger
class MyChatAgent(BaseChatAgent):
def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.search_tool = SearxNGSearchTool(max_results=25)
+ self.search_tool = SearxNGSearchTool(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=25)
def _pre_run(self):
self.memory.add_message('assistant', 'First, I will perform a search with 3 different search queries to gather relevant information on the topic.')
diff --git a/examples/simple_tool_interface_agent.py b/examples/simple_tool_interface_agent.py
index 4c964e9..2b4711f 100644
--- a/examples/simple_tool_interface_agent.py
+++ b/examples/simple_tool_interface_agent.py
@@ -1,3 +1,4 @@
+import os
import instructor
import openai
from rich.console import Console
@@ -12,7 +13,7 @@ console = Console()
client = instructor.from_openai(openai.OpenAI())
# Initialize the SearxNGSearchTool
-searx_tool = SearxNGSearchTool(max_results=10)
+searx_tool = SearxNGSearchTool(base_url=os.getenv('SEARXNG_BASE_URL'), max_results=10)
# Initialize the ToolInterfaceAgent with the SearxNGSearchTool
agent = ToolInterfaceAgent(