Skip to content

Building AI agents, atomically

add rudimentary docs

KennyVaneetvelde47e180c14c54
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000..418c104
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,27 @@
+# Atomic_agents_redux Index
+
+> Auto-generated documentation index.
+
+A full list of `Atomic_agents_redux` project modules.
+
+- [Atomic Agents](atomic_agents/index.md#atomic-agents)
+ - [Agents](atomic_agents/agents/index.md#agents)
+ - [BaseChatAgent](atomic_agents/agents/base_chat_agent.md#basechatagent)
+ - [ToolInterfaceAgent](atomic_agents/agents/tool_interface_agent.md#toolinterfaceagent)
+ - [Lib](atomic_agents/lib/index.md#lib)
+ - [Components](atomic_agents/lib/components/index.md#components)
+ - [ChatMemory](atomic_agents/lib/components/chat_memory.md#chatmemory)
+ - [SystemPromptGenerator](atomic_agents/lib/components/system_prompt_generator.md#systempromptgenerator)
+ - [Models](atomic_agents/lib/models/index.md#models)
+ - [WebDocument](atomic_agents/lib/models/web_document.md#webdocument)
+ - [Creating a New Tool](atomic_agents/lib/tools/index.md#creating-a-new-tool)
+ - [Base](atomic_agents/lib/tools/base.md#base)
+ - [CalculatorTool](atomic_agents/lib/tools/calculator_tool.md#calculatortool)
+ - [Searx](atomic_agents/lib/tools/searx.md#searx)
+ - [Web Scraping Tool](atomic_agents/lib/tools/web_scraping_tool.md#web-scraping-tool)
+ - [Utils](atomic_agents/lib/utils/index.md#utils)
+ - [Format Tool Message](atomic_agents/lib/utils/format_tool_message.md#format-tool-message)
+ - [Logger](atomic_agents/lib/utils/logger.md#logger)
+ - [Scraping](atomic_agents/lib/utils/scraping/index.md#scraping)
+ - [Pdf To Markdown](atomic_agents/lib/utils/scraping/pdf_to_markdown.md#pdf-to-markdown)
+ - [Url To Markdown](atomic_agents/lib/utils/scraping/url_to_markdown.md#url-to-markdown)
diff --git a/docs/atomic_agents/agents/base_chat_agent.md b/docs/atomic_agents/agents/base_chat_agent.md
new file mode 100644
index 0000000..54cabd7
--- /dev/null
+++ b/docs/atomic_agents/agents/base_chat_agent.md
@@ -0,0 +1,252 @@
+# BaseChatAgent
+
+[Atomic_agents_redux Index](../../README.md#atomic_agents_redux-index) / [Atomic Agents](../index.md#atomic-agents) / [Agents](./index.md#agents) / BaseChatAgent
+
+> Auto-generated documentation for [atomic_agents.agents.base_chat_agent](../../../atomic_agents/agents/base_chat_agent.py) module.
+
+- [BaseChatAgent](#basechatagent)
+ - [BaseChatAgent](#basechatagent-1)
+ - [BaseChatAgent()._get_and_handle_response](#basechatagent()_get_and_handle_response)
+ - [BaseChatAgent()._init_run](#basechatagent()_init_run)
+ - [BaseChatAgent()._plan_run](#basechatagent()_plan_run)
+ - [BaseChatAgent()._post_run](#basechatagent()_post_run)
+ - [BaseChatAgent()._pre_run](#basechatagent()_pre_run)
+ - [BaseChatAgent().get_response](#basechatagent()get_response)
+ - [BaseChatAgent().get_system_prompt](#basechatagent()get_system_prompt)
+ - [BaseChatAgent().reset_memory](#basechatagent()reset_memory)
+ - [BaseChatAgent().run](#basechatagent()run)
+ - [BaseChatAgentInputSchema](#basechatagentinputschema)
+ - [BaseChatAgentResponse](#basechatagentresponse)
+ - [GeneralPlanResponse](#generalplanresponse)
+ - [GeneralPlanStep](#generalplanstep)
+
+## BaseChatAgent
+
+[Show source in base_chat_agent.py:40](../../../atomic_agents/agents/base_chat_agent.py#L40)
+
+Base class for chat agents.
+
+This class provides the core functionality for handling chat interactions, including managing memory,
+generating system prompts, and obtaining responses from a language model.
+
+#### Attributes
+
+- `input_schema` *Type[BaseModel]* - Schema for the input data.
+- `output_schema` *Type[BaseModel]* - Schema for the output data.
+- `client` - Client for interacting with the language model.
+- `model` *str* - The model to use for generating responses.
+- `memory` *ChatMemory* - Memory component for storing chat history.
+- `system_prompt_generator` *SystemPromptGenerator* - Component for generating system prompts.
+- `include_planning_step` *bool* - Whether to include a planning step in the response generation.
+- `initial_memory` *ChatMemory* - Initial state of the memory.
+
+#### Signature
+
+```python
+class BaseChatAgent:
+ def __init__(
+ self,
+ client,
+ system_prompt_generator: SystemPromptGenerator = None,
+ model: str = "gpt-3.5-turbo",
+ memory: ChatMemory = None,
+ include_planning_step=False,
+ input_schema=BaseChatAgentInputSchema,
+ output_schema=BaseChatAgentResponse,
+ ): ...
+```
+
+#### See also
+
+- [BaseChatAgentInputSchema](#basechatagentinputschema)
+- [BaseChatAgentResponse](#basechatagentresponse)
+- [ChatMemory](../lib/components/chat_memory.md#chatmemory)
+- [SystemPromptGenerator](../lib/components/system_prompt_generator.md#systempromptgenerator)
+
+### BaseChatAgent()._get_and_handle_response
+
+[Show source in base_chat_agent.py:134](../../../atomic_agents/agents/base_chat_agent.py#L134)
+
+Handles obtaining and processing the response.
+
+#### Returns
+
+- `Type[BaseModel]` - The processed response.
+
+#### Signature
+
+```python
+def _get_and_handle_response(self): ...
+```
+
+### BaseChatAgent()._init_run
+
+[Show source in base_chat_agent.py:151](../../../atomic_agents/agents/base_chat_agent.py#L151)
+
+Initializes the run with the given user input.
+
+#### Arguments
+
+- `user_input` *str* - The input text from the user.
+
+#### Signature
+
+```python
+def _init_run(self, user_input): ...
+```
+
+### BaseChatAgent()._plan_run
+
+[Show source in base_chat_agent.py:143](../../../atomic_agents/agents/base_chat_agent.py#L143)
+
+Executes the planning step, if included.
+
+#### Signature
+
+```python
+def _plan_run(self): ...
+```
+
+### BaseChatAgent()._post_run
+
+[Show source in base_chat_agent.py:166](../../../atomic_agents/agents/base_chat_agent.py#L166)
+
+Finalizes the run with the given response.
+
+#### Arguments
+
+- `response` *Type[BaseModel]* - The response from the chat agent.
+
+#### Signature
+
+```python
+def _post_run(self, response): ...
+```
+
+### BaseChatAgent()._pre_run
+
+[Show source in base_chat_agent.py:160](../../../atomic_agents/agents/base_chat_agent.py#L160)
+
+Prepares for the run. This method can be overridden by subclasses to add custom pre-run logic.
+
+#### Signature
+
+```python
+def _pre_run(self): ...
+```
+
+### BaseChatAgent().get_response
+
+[Show source in base_chat_agent.py:95](../../../atomic_agents/agents/base_chat_agent.py#L95)
+
+Obtains a response from the language model.
+
+#### Arguments
+
+- `response_model` *Type[BaseModel], optional* - The schema for the response data. If not set, self.output_schema is used.
+
+#### Returns
+
+- `Type[BaseModel]` - The response from the language model.
+
+#### Signature
+
+```python
+def get_response(self, response_model=None) -> Type[BaseModel]: ...
+```
+
+### BaseChatAgent().get_system_prompt
+
+[Show source in base_chat_agent.py:86](../../../atomic_agents/agents/base_chat_agent.py#L86)
+
+Generates the system prompt.
+
+#### Returns
+
+- `str` - The generated system prompt.
+
+#### Signature
+
+```python
+def get_system_prompt(self) -> str: ...
+```
+
+### BaseChatAgent().reset_memory
+
+[Show source in base_chat_agent.py:80](../../../atomic_agents/agents/base_chat_agent.py#L80)
+
+Resets the memory to its initial state.
+
+#### Signature
+
+```python
+def reset_memory(self): ...
+```
+
+### BaseChatAgent().run
+
+[Show source in base_chat_agent.py:116](../../../atomic_agents/agents/base_chat_agent.py#L116)
+
+Runs the chat agent with the given user input.
+
+#### Arguments
+
+- `user_input` *str* - The input text from the user.
+
+#### Returns
+
+- `str` - The response from the chat agent.
+
+#### Signature
+
+```python
+def run(self, user_input: str) -> str: ...
+```
+
+
+
+## BaseChatAgentInputSchema
+
+[Show source in base_chat_agent.py:8](../../../atomic_agents/agents/base_chat_agent.py#L8)
+
+#### Signature
+
+```python
+class BaseChatAgentInputSchema(BaseModel): ...
+```
+
+
+
+## BaseChatAgentResponse
+
+[Show source in base_chat_agent.py:11](../../../atomic_agents/agents/base_chat_agent.py#L11)
+
+#### Signature
+
+```python
+class BaseChatAgentResponse(BaseModel): ...
+```
+
+
+
+## GeneralPlanResponse
+
+[Show source in base_chat_agent.py:27](../../../atomic_agents/agents/base_chat_agent.py#L27)
+
+#### Signature
+
+```python
+class GeneralPlanResponse(BaseModel): ...
+```
+
+
+
+## GeneralPlanStep
+
+[Show source in base_chat_agent.py:22](../../../atomic_agents/agents/base_chat_agent.py#L22)
+
+#### Signature
+
+```python
+class GeneralPlanStep(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/agents/index.md b/docs/atomic_agents/agents/index.md
new file mode 100644
index 0000000..d425ffb
--- /dev/null
+++ b/docs/atomic_agents/agents/index.md
@@ -0,0 +1,13 @@
+# Agents
+
+[Atomic_agents_redux Index](../../README.md#atomic_agents_redux-index) / [Atomic Agents](../index.md#atomic-agents) / Agents
+
+> Auto-generated documentation for [atomic_agents.agents](../../../atomic_agents/agents/__init__.py) module.
+
+- [Agents](#agents)
+ - [Modules](#modules)
+
+## Modules
+
+- [BaseChatAgent](./base_chat_agent.md)
+- [ToolInterfaceAgent](./tool_interface_agent.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/agents/tool_interface_agent.md b/docs/atomic_agents/agents/tool_interface_agent.md
new file mode 100644
index 0000000..eda69c1
--- /dev/null
+++ b/docs/atomic_agents/agents/tool_interface_agent.md
@@ -0,0 +1,54 @@
+# ToolInterfaceAgent
+
+[Atomic_agents_redux Index](../../README.md#atomic_agents_redux-index) / [Atomic Agents](../index.md#atomic-agents) / [Agents](./index.md#agents) / ToolInterfaceAgent
+
+> Auto-generated documentation for [atomic_agents.agents.tool_interface_agent](../../../atomic_agents/agents/tool_interface_agent.py) module.
+
+- [ToolInterfaceAgent](#toolinterfaceagent)
+ - [ToolInterfaceAgent](#toolinterfaceagent-1)
+ - [ToolInterfaceAgent()._get_and_handle_response](#toolinterfaceagent()_get_and_handle_response)
+
+## ToolInterfaceAgent
+
+[Show source in tool_interface_agent.py:6](../../../atomic_agents/agents/tool_interface_agent.py#L6)
+
+A specialized chat agent designed to interact with a specific tool.
+
+This agent extends the BaseChatAgent to include functionality for interacting with a tool instance.
+It generates system prompts, handles tool input and output, and can optionally return raw tool output.
+
+#### Attributes
+
+- `tool_instance` - The instance of the tool this agent will interact with.
+- `return_raw_output` *bool* - Whether to return the raw output from the tool.
+
+#### Signature
+
+```python
+class ToolInterfaceAgent(BaseChatAgent):
+ def __init__(self, tool_instance, return_raw_output=False, *args, **kwargs): ...
+```
+
+#### See also
+
+- [BaseChatAgent](./base_chat_agent.md#basechatagent)
+
+### ToolInterfaceAgent()._get_and_handle_response
+
+[Show source in tool_interface_agent.py:68](../../../atomic_agents/agents/tool_interface_agent.py#L68)
+
+Handles obtaining and processing the response from the tool.
+
+This method gets the response from the tool, formats the tool input, adds it to memory,
+runs the tool, and processes the tool output. If `return_raw_output` is True, it returns
+the raw tool output; otherwise, it processes the output and returns the response.
+
+#### Returns
+
+- `BaseModel` - The processed response or raw tool output.
+
+#### Signature
+
+```python
+def _get_and_handle_response(self): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/index.md b/docs/atomic_agents/index.md
new file mode 100644
index 0000000..131c0de
--- /dev/null
+++ b/docs/atomic_agents/index.md
@@ -0,0 +1,13 @@
+# Atomic Agents
+
+[Atomic_agents_redux Index](../README.md#atomic_agents_redux-index) / Atomic Agents
+
+> Auto-generated documentation for [atomic_agents](../../atomic_agents/__init__.py) module.
+
+- [Atomic Agents](#atomic-agents)
+ - [Modules](#modules)
+
+## Modules
+
+- [Agents](agents/index.md)
+- [Lib](lib/index.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/components/chat_memory.md b/docs/atomic_agents/lib/components/chat_memory.md
new file mode 100644
index 0000000..938958f
--- /dev/null
+++ b/docs/atomic_agents/lib/components/chat_memory.md
@@ -0,0 +1,145 @@
+# ChatMemory
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Components](./index.md#components) / ChatMemory
+
+> Auto-generated documentation for [atomic_agents.lib.components.chat_memory](../../../../atomic_agents/lib/components/chat_memory.py) module.
+
+- [ChatMemory](#chatmemory)
+ - [ChatMemory](#chatmemory-1)
+ - [ChatMemory().add_message](#chatmemory()add_message)
+ - [ChatMemory().copy](#chatmemory()copy)
+ - [ChatMemory().dump](#chatmemory()dump)
+ - [ChatMemory().get_history](#chatmemory()get_history)
+ - [ChatMemory().load](#chatmemory()load)
+ - [Message](#message)
+
+## ChatMemory
+
+[Show source in chat_memory.py:20](../../../../atomic_agents/lib/components/chat_memory.py#L20)
+
+Manages the chat history for an AI agent.
+
+#### Attributes
+
+- `history` *List[Message]* - A list of messages representing the chat history.
+
+#### Signature
+
+```python
+class ChatMemory:
+ def __init__(self): ...
+```
+
+### ChatMemory().add_message
+
+[Show source in chat_memory.py:34](../../../../atomic_agents/lib/components/chat_memory.py#L34)
+
+Adds a message to the chat history.
+
+#### Arguments
+
+- `role` *str* - The role of the message sender.
+content (Union[str, Dict]): The content of the message.
+- `tool_message` *Optional[Dict]* - Optional tool message to be included.
+- `tool_id` *Optional[str]* - Optional unique identifier for the tool call.
+
+#### Signature
+
+```python
+def add_message(
+ self,
+ role: str,
+ content: Union[str, Dict],
+ tool_message: Optional[Dict] = None,
+ tool_id: Optional[str] = None,
+) -> None: ...
+```
+
+### ChatMemory().copy
+
+[Show source in chat_memory.py:82](../../../../atomic_agents/lib/components/chat_memory.py#L82)
+
+Creates a copy of the chat memory.
+
+#### Returns
+
+- [ChatMemory](#chatmemory) - A copy of the chat memory.
+
+#### Signature
+
+```python
+def copy(self) -> "ChatMemory": ...
+```
+
+### ChatMemory().dump
+
+[Show source in chat_memory.py:64](../../../../atomic_agents/lib/components/chat_memory.py#L64)
+
+Converts the chat history to a list of dictionaries.
+
+#### Returns
+
+- `List[Dict]` - The list of messages as dictionaries.
+
+#### Signature
+
+```python
+def dump(self) -> List[Dict]: ...
+```
+
+### ChatMemory().get_history
+
+[Show source in chat_memory.py:55](../../../../atomic_agents/lib/components/chat_memory.py#L55)
+
+Retrieves the chat history.
+
+#### Returns
+
+- `List[Message]` - The list of messages in the chat history.
+
+#### Signature
+
+```python
+def get_history(self) -> List[Message]: ...
+```
+
+#### See also
+
+- [Message](#message)
+
+### ChatMemory().load
+
+[Show source in chat_memory.py:73](../../../../atomic_agents/lib/components/chat_memory.py#L73)
+
+Loads the chat history from a list of dictionaries.
+
+#### Arguments
+
+- `dict_list` *List[Dict]* - The list of messages as dictionaries.
+
+#### Signature
+
+```python
+def load(self, dict_list: List[Dict]) -> None: ...
+```
+
+
+
+## Message
+
+[Show source in chat_memory.py:5](../../../../atomic_agents/lib/components/chat_memory.py#L5)
+
+Represents a message in the chat history.
+
+#### Attributes
+
+- `role` *str* - The role of the message sender (e.g., 'user', 'system', 'tool').
+content (Union[str, Dict]): The content of the message.
+- `tool_calls` *Optional[List[Dict]]* - Optional list of tool call messages.
+- `tool_call_id` *Optional[str]* - Optional unique identifier for the tool call.
+
+#### Signature
+
+```python
+class Message(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/components/index.md b/docs/atomic_agents/lib/components/index.md
new file mode 100644
index 0000000..471ff90
--- /dev/null
+++ b/docs/atomic_agents/lib/components/index.md
@@ -0,0 +1,13 @@
+# Components
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / Components
+
+> Auto-generated documentation for [atomic_agents.lib.components](../../../../atomic_agents/lib/components/__init__.py) module.
+
+- [Components](#components)
+ - [Modules](#modules)
+
+## Modules
+
+- [ChatMemory](./chat_memory.md)
+- [SystemPromptGenerator](./system_prompt_generator.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/components/system_prompt_generator.md b/docs/atomic_agents/lib/components/system_prompt_generator.md
new file mode 100644
index 0000000..d129fb3
--- /dev/null
+++ b/docs/atomic_agents/lib/components/system_prompt_generator.md
@@ -0,0 +1,78 @@
+# SystemPromptGenerator
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Components](./index.md#components) / SystemPromptGenerator
+
+> Auto-generated documentation for [atomic_agents.lib.components.system_prompt_generator](../../../../atomic_agents/lib/components/system_prompt_generator.py) module.
+
+- [SystemPromptGenerator](#systempromptgenerator)
+ - [DynamicInfoProviderBase](#dynamicinfoproviderbase)
+ - [DynamicInfoProviderBase().get_info](#dynamicinfoproviderbase()get_info)
+ - [SystemPromptGenerator](#systempromptgenerator-1)
+ - [SystemPromptGenerator().generate_prompt](#systempromptgenerator()generate_prompt)
+ - [SystemPromptInfo](#systempromptinfo)
+
+## DynamicInfoProviderBase
+
+[Show source in system_prompt_generator.py:10](../../../../atomic_agents/lib/components/system_prompt_generator.py#L10)
+
+#### Signature
+
+```python
+class DynamicInfoProviderBase(ABC):
+ def __init__(self, title: str): ...
+```
+
+### DynamicInfoProviderBase().get_info
+
+[Show source in system_prompt_generator.py:14](../../../../atomic_agents/lib/components/system_prompt_generator.py#L14)
+
+#### Signature
+
+```python
+@abstractmethod
+def get_info(self) -> str: ...
+```
+
+
+
+## SystemPromptGenerator
+
+[Show source in system_prompt_generator.py:18](../../../../atomic_agents/lib/components/system_prompt_generator.py#L18)
+
+#### Signature
+
+```python
+class SystemPromptGenerator:
+ def __init__(
+ self,
+ system_prompt_info: SystemPromptInfo = None,
+ dynamic_info_providers: dict[str, DynamicInfoProviderBase] = None,
+ ): ...
+```
+
+#### See also
+
+- [DynamicInfoProviderBase](#dynamicinfoproviderbase)
+- [SystemPromptInfo](#systempromptinfo)
+
+### SystemPromptGenerator().generate_prompt
+
+[Show source in system_prompt_generator.py:27](../../../../atomic_agents/lib/components/system_prompt_generator.py#L27)
+
+#### Signature
+
+```python
+def generate_prompt(self) -> str: ...
+```
+
+
+
+## SystemPromptInfo
+
+[Show source in system_prompt_generator.py:5](../../../../atomic_agents/lib/components/system_prompt_generator.py#L5)
+
+#### Signature
+
+```python
+class SystemPromptInfo(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/index.md b/docs/atomic_agents/lib/index.md
new file mode 100644
index 0000000..1d6c6a5
--- /dev/null
+++ b/docs/atomic_agents/lib/index.md
@@ -0,0 +1,15 @@
+# Lib
+
+[Atomic_agents_redux Index](../../README.md#atomic_agents_redux-index) / [Atomic Agents](../index.md#atomic-agents) / Lib
+
+> Auto-generated documentation for [atomic_agents.lib](../../../atomic_agents/lib/__init__.py) module.
+
+- [Lib](#lib)
+ - [Modules](#modules)
+
+## Modules
+
+- [Components](components/index.md)
+- [Models](models/index.md)
+- [Creating a New Tool](tools/index.md)
+- [Utils](utils/index.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/models/index.md b/docs/atomic_agents/lib/models/index.md
new file mode 100644
index 0000000..47fb0b7
--- /dev/null
+++ b/docs/atomic_agents/lib/models/index.md
@@ -0,0 +1,12 @@
+# Models
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / Models
+
+> Auto-generated documentation for [atomic_agents.lib.models](../../../../atomic_agents/lib/models/__init__.py) module.
+
+- [Models](#models)
+ - [Modules](#modules)
+
+## Modules
+
+- [WebDocument](./web_document.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/models/web_document.md b/docs/atomic_agents/lib/models/web_document.md
new file mode 100644
index 0000000..5a2544a
--- /dev/null
+++ b/docs/atomic_agents/lib/models/web_document.md
@@ -0,0 +1,31 @@
+# WebDocument
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Models](./index.md#models) / WebDocument
+
+> Auto-generated documentation for [atomic_agents.lib.models.web_document](../../../../atomic_agents/lib/models/web_document.py) module.
+
+- [WebDocument](#webdocument)
+ - [WebDocument](#webdocument-1)
+ - [WebDocumentMetadata](#webdocumentmetadata)
+
+## WebDocument
+
+[Show source in web_document.py:10](../../../../atomic_agents/lib/models/web_document.py#L10)
+
+#### Signature
+
+```python
+class WebDocument(BaseModel): ...
+```
+
+
+
+## WebDocumentMetadata
+
+[Show source in web_document.py:3](../../../../atomic_agents/lib/models/web_document.py#L3)
+
+#### Signature
+
+```python
+class WebDocumentMetadata(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/tools/base.md b/docs/atomic_agents/lib/tools/base.md
new file mode 100644
index 0000000..2809470
--- /dev/null
+++ b/docs/atomic_agents/lib/tools/base.md
@@ -0,0 +1,53 @@
+# Base
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Creating a New Tool](./index.md#creating-a-new-tool) / Base
+
+> Auto-generated documentation for [atomic_agents.lib.tools.base](../../../../atomic_agents/lib/tools/base.py) module.
+
+- [Base](#base)
+ - [BaseTool](#basetool)
+ - [BaseTool().run](#basetool()run)
+
+## BaseTool
+
+[Show source in base.py:4](../../../../atomic_agents/lib/tools/base.py#L4)
+
+Base class for all tools in the Atomic Agents framework.
+
+#### Attributes
+
+- `input_schema` *Type[BaseModel]* - The schema for the input data.
+- `output_schema` *Type[BaseModel]* - The schema for the output data.
+- `tool_name` *str* - The name of the tool, derived from the input schema's title.
+- `tool_description` *str* - The description of the tool, derived from the input schema's description or overridden by the user.
+
+#### Signature
+
+```python
+class BaseTool:
+ def __init__(self, tool_description_override: Optional[str] = None): ...
+```
+
+### BaseTool().run
+
+[Show source in base.py:28](../../../../atomic_agents/lib/tools/base.py#L28)
+
+Runs the tool with the given parameters. This method should be implemented by subclasses.
+
+#### Arguments
+
+- `params` *BaseModel* - The input parameters for the tool, adhering to the input schema.
+
+#### Returns
+
+- `BaseModel` - The output of the tool, adhering to the output schema.
+
+#### Raises
+
+- `NotImplementedError` - If the method is not implemented by a subclass.
+
+#### Signature
+
+```python
+def run(self, params: BaseModel) -> BaseModel: ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/tools/calculator_tool.md b/docs/atomic_agents/lib/tools/calculator_tool.md
new file mode 100644
index 0000000..1454869
--- /dev/null
+++ b/docs/atomic_agents/lib/tools/calculator_tool.md
@@ -0,0 +1,93 @@
+# CalculatorTool
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Creating a New Tool](./index.md#creating-a-new-tool) / CalculatorTool
+
+> Auto-generated documentation for [atomic_agents.lib.tools.calculator_tool](../../../../atomic_agents/lib/tools/calculator_tool.py) module.
+
+#### Attributes
+
+- `client` - Initialize the client outside: instructor.from_openai(openai.OpenAI(api_key=os.getenv('OPENAI_API_KEY'), base_url=os.getenv('OPENAI_BASE_URL')))
+
+- `result` - Extract structured data from natural language: client.chat.completions.create(model='gpt-3.5-turbo', response_model=CalculatorTool.input_schema, messages=[{'role': 'user', 'content': 'Calculate 2 + 2'}])
+
+
+- [CalculatorTool](#calculatortool)
+ - [CalculatorTool](#calculatortool-1)
+ - [CalculatorTool().run](#calculatortool()run)
+ - [CalculatorToolOutputSchema](#calculatortooloutputschema)
+ - [CalculatorToolSchema](#calculatortoolschema)
+
+## CalculatorTool
+
+[Show source in calculator_tool.py:32](../../../../atomic_agents/lib/tools/calculator_tool.py#L32)
+
+Tool for performing calculations based on the provided mathematical expression.
+
+#### Attributes
+
+- `input_schema` *CalculatorToolSchema* - The schema for the input data.
+- `output_schema` *CalculatorToolOutputSchema* - The schema for the output data.
+
+#### Signature
+
+```python
+class CalculatorTool(BaseTool):
+ def __init__(self, *args, **kwargs): ...
+```
+
+#### See also
+
+- [BaseTool](./base.md#basetool)
+
+### CalculatorTool().run
+
+[Show source in calculator_tool.py:53](../../../../atomic_agents/lib/tools/calculator_tool.py#L53)
+
+Runs the CalculatorTool with the given parameters.
+
+#### Arguments
+
+- `params` *CalculatorToolSchema* - The input parameters for the tool, adhering to the input schema.
+
+#### Returns
+
+- [CalculatorToolOutputSchema](#calculatortooloutputschema) - The output of the tool, adhering to the output schema.
+
+#### Raises
+
+- `ValueError` - If there is an error evaluating the expression.
+
+#### Signature
+
+```python
+def run(self, params: CalculatorToolSchema) -> CalculatorToolOutputSchema: ...
+```
+
+#### See also
+
+- [CalculatorToolOutputSchema](#calculatortooloutputschema)
+- [CalculatorToolSchema](#calculatortoolschema)
+
+
+
+## CalculatorToolOutputSchema
+
+[Show source in calculator_tool.py:26](../../../../atomic_agents/lib/tools/calculator_tool.py#L26)
+
+#### Signature
+
+```python
+class CalculatorToolOutputSchema(BaseModel): ...
+```
+
+
+
+## CalculatorToolSchema
+
+[Show source in calculator_tool.py:12](../../../../atomic_agents/lib/tools/calculator_tool.py#L12)
+
+#### Signature
+
+```python
+class CalculatorToolSchema(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/tools/index.md b/docs/atomic_agents/lib/tools/index.md
new file mode 100644
index 0000000..aa96753
--- /dev/null
+++ b/docs/atomic_agents/lib/tools/index.md
@@ -0,0 +1,15 @@
+# Creating a New Tool
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / Creating a New Tool
+
+> Auto-generated documentation for [atomic_agents.lib.tools](../../../../atomic_agents/lib/tools/__init__.py) module.
+
+- [Creating a New Tool](#creating-a-new-tool)
+ - [Modules](#modules)
+
+## Modules
+
+- [Base](./base.md)
+- [CalculatorTool](./calculator_tool.md)
+- [Searx](./searx.md)
+- [Web Scraping Tool](./web_scraping_tool.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/tools/searx.md b/docs/atomic_agents/lib/tools/searx.md
new file mode 100644
index 0000000..71d2598
--- /dev/null
+++ b/docs/atomic_agents/lib/tools/searx.md
@@ -0,0 +1,113 @@
+# Searx
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Creating a New Tool](./index.md#creating-a-new-tool) / Searx
+
+> Auto-generated documentation for [atomic_agents.lib.tools.searx](../../../../atomic_agents/lib/tools/searx.py) module.
+
+#### Attributes
+
+- `client` - Initialize the client outside: instructor.from_openai(openai.OpenAI(api_key=os.getenv('OPENAI_API_KEY'), base_url=os.getenv('OPENAI_BASE_URL')))
+
+- `result` - Extract structured data from natural language: client.chat.completions.create(model='gpt-3.5-turbo', response_model=SearxNGSearchTool.input_schema, messages=[{'role': 'user', 'content': 'Search for the latest PC gaming news of May 2024 using 3 different queries.'}])
+
+- `output` - Print the result: SearxNGSearchTool(max_results=15).run(result)
+
+
+- [Searx](#searx)
+ - [SearxNGSearchResultSchema](#searxngsearchresultschema)
+ - [SearxNGSearchTool](#searxngsearchtool)
+ - [SearxNGSearchTool().run](#searxngsearchtool()run)
+ - [SearxNGSearchToolOutputSchema](#searxngsearchtooloutputschema)
+ - [SearxNGSearchToolSchema](#searxngsearchtoolschema)
+
+## SearxNGSearchResultSchema
+
+[Show source in searx.py:29](../../../../atomic_agents/lib/tools/searx.py#L29)
+
+#### Signature
+
+```python
+class SearxNGSearchResultSchema(BaseModel): ...
+```
+
+
+
+## SearxNGSearchTool
+
+[Show source in searx.py:41](../../../../atomic_agents/lib/tools/searx.py#L41)
+
+Tool for performing searches on SearxNG based on the provided queries and category.
+
+#### Attributes
+
+- `input_schema` *SearxNGSearchToolSchema* - The schema for the input data.
+- `output_schema` *SearxNGSearchToolOutputSchema* - The schema for the output data.
+- `max_results` *int* - The maximum number of search results to return.
+
+#### Signature
+
+```python
+class SearxNGSearchTool(BaseTool):
+ def __init__(self, max_results: int = 10, *args, **kwargs): ...
+```
+
+#### See also
+
+- [BaseTool](./base.md#basetool)
+
+### SearxNGSearchTool().run
+
+[Show source in searx.py:65](../../../../atomic_agents/lib/tools/searx.py#L65)
+
+Runs the SearxNGSearchTool with the given parameters.
+
+#### Arguments
+
+- `params` *SearxNGSearchToolSchema* - The input parameters for the tool, adhering to the input schema.
+- `max_results` *Optional[int]* - The maximum number of search results to return.
+
+#### Returns
+
+- [SearxNGSearchToolOutputSchema](#searxngsearchtooloutputschema) - The output of the tool, adhering to the output schema.
+
+#### Raises
+
+- `ValueError` - If the SEARXNG_BASE_URL environment variable is not set.
+- `Exception` - If the request to SearxNG fails.
+
+#### Signature
+
+```python
+def run(
+ self, params: SearxNGSearchToolSchema, max_results: Optional[int] = None
+) -> SearxNGSearchToolOutputSchema: ...
+```
+
+#### See also
+
+- [SearxNGSearchToolOutputSchema](#searxngsearchtooloutputschema)
+- [SearxNGSearchToolSchema](#searxngsearchtoolschema)
+
+
+
+## SearxNGSearchToolOutputSchema
+
+[Show source in searx.py:35](../../../../atomic_agents/lib/tools/searx.py#L35)
+
+#### Signature
+
+```python
+class SearxNGSearchToolOutputSchema(BaseModel): ...
+```
+
+
+
+## SearxNGSearchToolSchema
+
+[Show source in searx.py:14](../../../../atomic_agents/lib/tools/searx.py#L14)
+
+#### Signature
+
+```python
+class SearxNGSearchToolSchema(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/tools/web_scraping_tool.md b/docs/atomic_agents/lib/tools/web_scraping_tool.md
new file mode 100644
index 0000000..e83a362
--- /dev/null
+++ b/docs/atomic_agents/lib/tools/web_scraping_tool.md
@@ -0,0 +1,108 @@
+# Web Scraping Tool
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Creating a New Tool](./index.md#creating-a-new-tool) / Web Scraping Tool
+
+> Auto-generated documentation for [atomic_agents.lib.tools.web_scraping_tool](../../../../atomic_agents/lib/tools/web_scraping_tool.py) module.
+
+#### Attributes
+
+- `client` - Initialize the client outside: instructor.from_openai(openai.OpenAI(api_key=os.getenv('OPENAI_API_KEY'), base_url=os.getenv('OPENAI_BASE_URL')))
+
+- `result` - Extract from webpage: client.chat.completions.create(model='gpt-3.5-turbo', response_model=ContentScrapingTool.input_schema, messages=[{'role': 'user', 'content': 'Scrape the content of https://example.com'}])
+
+- `output` - Print the result: ContentScrapingTool().run(result)
+
+- `result` - Extract from PDF: client.chat.completions.create(model='gpt-3.5-turbo', response_model=ContentScrapingTool.input_schema, messages=[{'role': 'user', 'content': 'Scrape the content of https://pdfobject.com/pdf/sample.pdf'}])
+
+- `output` - Print the result: ContentScrapingTool().run(result)
+
+
+- [Web Scraping Tool](#web-scraping-tool)
+ - [ContentScrapingResultSchema](#contentscrapingresultschema)
+ - [ContentScrapingTool](#contentscrapingtool)
+ - [ContentScrapingTool().run](#contentscrapingtool()run)
+ - [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema)
+ - [ContentScrapingToolSchema](#contentscrapingtoolschema)
+
+## ContentScrapingResultSchema
+
+[Show source in web_scraping_tool.py:30](../../../../atomic_agents/lib/tools/web_scraping_tool.py#L30)
+
+#### Signature
+
+```python
+class ContentScrapingResultSchema(BaseModel): ...
+```
+
+
+
+## ContentScrapingTool
+
+[Show source in web_scraping_tool.py:40](../../../../atomic_agents/lib/tools/web_scraping_tool.py#L40)
+
+Tool for scraping web pages or PDFs and converting content to markdown.
+
+#### Attributes
+
+- `input_schema` *ContentScrapingToolSchema* - The schema for the input data.
+- `output_schema` *ContentScrapingToolOutputSchema* - The schema for the output data.
+
+#### Signature
+
+```python
+class ContentScrapingTool(BaseTool):
+ def __init__(self, *args, **kwargs): ...
+```
+
+#### See also
+
+- [BaseTool](./base.md#basetool)
+
+### ContentScrapingTool().run
+
+[Show source in web_scraping_tool.py:61](../../../../atomic_agents/lib/tools/web_scraping_tool.py#L61)
+
+Runs the ContentScrapingTool with the given parameters.
+
+#### Arguments
+
+- `params` *ContentScrapingToolSchema* - The input parameters for the tool, adhering to the input schema.
+
+#### Returns
+
+- [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema) - The output of the tool, adhering to the output schema.
+
+#### Signature
+
+```python
+def run(self, params: ContentScrapingToolSchema) -> ContentScrapingToolOutputSchema: ...
+```
+
+#### See also
+
+- [ContentScrapingToolOutputSchema](#contentscrapingtooloutputschema)
+- [ContentScrapingToolSchema](#contentscrapingtoolschema)
+
+
+
+## ContentScrapingToolOutputSchema
+
+[Show source in web_scraping_tool.py:34](../../../../atomic_agents/lib/tools/web_scraping_tool.py#L34)
+
+#### Signature
+
+```python
+class ContentScrapingToolOutputSchema(BaseModel): ...
+```
+
+
+
+## ContentScrapingToolSchema
+
+[Show source in web_scraping_tool.py:16](../../../../atomic_agents/lib/tools/web_scraping_tool.py#L16)
+
+#### Signature
+
+```python
+class ContentScrapingToolSchema(BaseModel): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/format_tool_message.md b/docs/atomic_agents/lib/utils/format_tool_message.md
new file mode 100644
index 0000000..de5e284
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/format_tool_message.md
@@ -0,0 +1,30 @@
+# Format Tool Message
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Utils](./index.md#utils) / Format Tool Message
+
+> Auto-generated documentation for [atomic_agents.lib.utils.format_tool_message](../../../../atomic_agents/lib/utils/format_tool_message.py) module.
+
+- [Format Tool Message](#format-tool-message)
+ - [format_tool_message](#format_tool_message)
+
+## format_tool_message
+
+[Show source in format_tool_message.py:8](../../../../atomic_agents/lib/utils/format_tool_message.py#L8)
+
+Formats a message for a tool call.
+
+#### Arguments
+
+- `tool_name` *str* - The type of the tool.
+- `tool_calls` *Dict* - A dictionary containing the tool calls.
+- `tool_id` *str, optional* - The unique identifier for the tool call. If not provided, a random UUID will be generated.
+
+#### Returns
+
+- `Dict` - A formatted message dictionary for the tool call.
+
+#### Signature
+
+```python
+def format_tool_message(tool_call: Type[BaseModel], tool_id: str = None) -> Dict: ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/index.md b/docs/atomic_agents/lib/utils/index.md
new file mode 100644
index 0000000..520f0ab
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/index.md
@@ -0,0 +1,14 @@
+# Utils
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / Utils
+
+> Auto-generated documentation for [atomic_agents.lib.utils](../../../../atomic_agents/lib/utils/__init__.py) module.
+
+- [Utils](#utils)
+ - [Modules](#modules)
+
+## Modules
+
+- [Format Tool Message](./format_tool_message.md)
+- [Logger](./logger.md)
+- [Scraping](scraping/index.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/logger.md b/docs/atomic_agents/lib/utils/logger.md
new file mode 100644
index 0000000..d933938
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/logger.md
@@ -0,0 +1,23 @@
+# Logger
+
+[Atomic_agents_redux Index](../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Utils](./index.md#utils) / Logger
+
+> Auto-generated documentation for [atomic_agents.lib.utils.logger](../../../../atomic_agents/lib/utils/logger.py) module.
+
+#### Attributes
+
+- `VERBOSE` - Step 1: Define a new logging level: 25
+
+
+- [Logger](#logger)
+ - [verbose](#verbose)
+
+## verbose
+
+[Show source in logger.py:9](../../../../atomic_agents/lib/utils/logger.py#L9)
+
+#### Signature
+
+```python
+def verbose(self, message, *args, **kwargs): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/scraping/index.md b/docs/atomic_agents/lib/utils/scraping/index.md
new file mode 100644
index 0000000..dc9e13b
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/scraping/index.md
@@ -0,0 +1,13 @@
+# Scraping
+
+[Atomic_agents_redux Index](../../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../../index.md#atomic-agents) / [Lib](../../index.md#lib) / [Utils](../index.md#utils) / Scraping
+
+> Auto-generated documentation for [atomic_agents.lib.utils.scraping](../../../../../atomic_agents/lib/utils/scraping/__init__.py) module.
+
+- [Scraping](#scraping)
+ - [Modules](#modules)
+
+## Modules
+
+- [Pdf To Markdown](./pdf_to_markdown.md)
+- [Url To Markdown](./url_to_markdown.md)
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/scraping/pdf_to_markdown.md b/docs/atomic_agents/lib/utils/scraping/pdf_to_markdown.md
new file mode 100644
index 0000000..01da498
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/scraping/pdf_to_markdown.md
@@ -0,0 +1,30 @@
+# Pdf To Markdown
+
+[Atomic_agents_redux Index](../../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../../index.md#atomic-agents) / [Lib](../../index.md#lib) / [Utils](../index.md#utils) / [Scraping](./index.md#scraping) / Pdf To Markdown
+
+> Auto-generated documentation for [atomic_agents.lib.utils.scraping.pdf_to_markdown](../../../../../atomic_agents/lib/utils/scraping/pdf_to_markdown.py) module.
+
+- [Pdf To Markdown](#pdf-to-markdown)
+ - [PdfToMarkdownConverter](#pdftomarkdownconverter)
+ - [PdfToMarkdownConverter.convert](#pdftomarkdownconverterconvert)
+
+## PdfToMarkdownConverter
+
+[Show source in pdf_to_markdown.py:8](../../../../../atomic_agents/lib/utils/scraping/pdf_to_markdown.py#L8)
+
+#### Signature
+
+```python
+class PdfToMarkdownConverter: ...
+```
+
+### PdfToMarkdownConverter.convert
+
+[Show source in pdf_to_markdown.py:28](../../../../../atomic_agents/lib/utils/scraping/pdf_to_markdown.py#L28)
+
+#### Signature
+
+```python
+@staticmethod
+def convert(url=None, file_path=None): ...
+```
\ No newline at end of file
diff --git a/docs/atomic_agents/lib/utils/scraping/url_to_markdown.md b/docs/atomic_agents/lib/utils/scraping/url_to_markdown.md
new file mode 100644
index 0000000..683b454
--- /dev/null
+++ b/docs/atomic_agents/lib/utils/scraping/url_to_markdown.md
@@ -0,0 +1,30 @@
+# Url To Markdown
+
+[Atomic_agents_redux Index](../../../../README.md#atomic_agents_redux-index) / [Atomic Agents](../../../index.md#atomic-agents) / [Lib](../../index.md#lib) / [Utils](../index.md#utils) / [Scraping](./index.md#scraping) / Url To Markdown
+
+> Auto-generated documentation for [atomic_agents.lib.utils.scraping.url_to_markdown](../../../../../atomic_agents/lib/utils/scraping/url_to_markdown.py) module.
+
+- [Url To Markdown](#url-to-markdown)
+ - [UrlToMarkdownConverter](#urltomarkdownconverter)
+ - [UrlToMarkdownConverter.convert](#urltomarkdownconverterconvert)
+
+## UrlToMarkdownConverter
+
+[Show source in url_to_markdown.py:8](../../../../../atomic_agents/lib/utils/scraping/url_to_markdown.py#L8)
+
+#### Signature
+
+```python
+class UrlToMarkdownConverter: ...
+```
+
+### UrlToMarkdownConverter.convert
+
+[Show source in url_to_markdown.py:55](../../../../../atomic_agents/lib/utils/scraping/url_to_markdown.py#L55)
+
+#### Signature
+
+```python
+@staticmethod
+def convert(url): ...
+```
\ No newline at end of file
diff --git a/examples/basic_custom_chatbot.py b/examples/basic_custom_chatbot.py
index 853d691..c70085c 100644
--- a/examples/basic_custom_chatbot.py
+++ b/examples/basic_custom_chatbot.py
@@ -5,8 +5,6 @@ from atomic_agents.agents.base_chat_agent import BaseChatAgent
from atomic_agents.lib.components.system_prompt_generator import DynamicInfoProviderBase, SystemPromptGenerator, SystemPromptInfo
import instructor
import openai
-from atomic_agents.lib.tools.searx import SearxNGSearchTool
-from atomic_agents.lib.utils.logger import logger
console = Console()
@@ -18,9 +16,8 @@ class CurrentDateProvider(DynamicInfoProviderBase):
def get_info(self) -> str:
return f'The current date, in the format "{self.format}", is {datetime.now().strftime(self.format)}'
-# Define dynamic info providers
dynamic_info_providers = {
- 'date': CurrentDateProvider('Current date', format='%Y-%m-%d %H:%M:%S'),
+ 'date': CurrentDateProvider('Current date', format='%Y-%m-%d'),
}
system_prompt = SystemPromptInfo(
diff --git a/examples/simple_tool_interface_agent.py b/examples/simple_tool_interface_agent.py
index 0ef02f9..8fca4bf 100644
--- a/examples/simple_tool_interface_agent.py
+++ b/examples/simple_tool_interface_agent.py
@@ -11,7 +11,7 @@ console = Console()
client = instructor.from_openai(openai.OpenAI())
# Initialize the SearxNGSearchTool
-searx_tool = SearxNGSearchTool(max_results=5)
+searx_tool = SearxNGSearchTool(max_results=10)
# Initialize the ToolInterfaceAgent with the SearxNGSearchTool
agent = ToolInterfaceAgent(