Skip to content

Building AI agents, atomically

Changed the name from ChatMemory to AgentMemory for consistent naming

w3bwizar05c5c45dcae3
diff --git a/atomic_agents/agents/base_chat_agent.py b/atomic_agents/agents/base_chat_agent.py
index 06ffab6..f2289c6 100644
--- a/atomic_agents/agents/base_chat_agent.py
+++ b/atomic_agents/agents/base_chat_agent.py
@@ -4,7 +4,7 @@ import instructor
from pydantic import BaseModel, Field
from rich.json import JSON
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGenerator
@@ -57,7 +57,7 @@ class BaseChatAgentOutputSchema(BaseAgentIO):
class BaseChatAgentConfig(BaseModel):
client: instructor.client.Instructor = Field(..., description="Client for interacting with the language model.")
model: str = Field("gpt-3.5-turbo", description="The model to use for generating responses.")
- memory: Optional[ChatMemory] = Field(None, description="Memory component for storing chat history.")
+ memory: Optional[AgentMemory] = Field(None, description="Memory component for storing chat history.")
system_prompt_generator: Optional[SystemPromptGenerator] = Field(
None, description="Component for generating system prompts."
)
@@ -80,9 +80,9 @@ class BaseChatAgent:
output_schema (Type[BaseAgentIO]): 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.
+ memory (AgentMemory): Memory component for storing chat history.
system_prompt_generator (SystemPromptGenerator): Component for generating system prompts.
- initial_memory (ChatMemory): Initial state of the memory.
+ initial_memory (AgentMemory): Initial state of the memory.
"""
input_schema = BaseChatAgentInputSchema
@@ -99,7 +99,7 @@ class BaseChatAgent:
self.output_schema = config.output_schema or self.output_schema
self.client = config.client
self.model = config.model
- self.memory = config.memory or ChatMemory()
+ self.memory = config.memory or AgentMemory()
self.system_prompt_generator = config.system_prompt_generator or SystemPromptGenerator()
self.initial_memory = self.memory.copy()
self.current_user_input = None
diff --git a/atomic_agents/lib/components/chat_memory.py b/atomic_agents/lib/components/agent_memory.py
similarity index 94%
rename from atomic_agents/lib/components/chat_memory.py
rename to atomic_agents/lib/components/agent_memory.py
index 91fcf7e..5704cfc 100644
--- a/atomic_agents/lib/components/chat_memory.py
+++ b/atomic_agents/lib/components/agent_memory.py
@@ -20,7 +20,7 @@ class Message(BaseModel):
tool_call_id: Optional[str] = None
-class ChatMemory:
+class AgentMemory:
"""
Manages the chat history for an AI agent.
@@ -31,7 +31,7 @@ class ChatMemory:
def __init__(self, max_messages: Optional[int] = None):
"""
- Initializes the ChatMemory with an empty history and optional constraints.
+ Initializes the AgentMemory with an empty history and optional constraints.
Args:
max_messages (Optional[int]): Maximum number of turns to keep in history.
@@ -116,14 +116,14 @@ class ChatMemory:
# Optionally, manage overflow after loading all messages
self._manage_overflow()
- def copy(self) -> "ChatMemory":
+ def copy(self) -> "AgentMemory":
"""
Creates a copy of the chat memory.
Returns:
- ChatMemory: A copy of the chat memory.
+ AgentMemory: A copy of the chat memory.
"""
- new_memory = ChatMemory(max_messages=self.max_messages)
+ new_memory = AgentMemory(max_messages=self.max_messages)
new_memory.load(self.dump())
return new_memory
diff --git a/docs/api/README.md b/docs/api/README.md
index 1729a46..f92a94c 100644
--- a/docs/api/README.md
+++ b/docs/api/README.md
@@ -10,7 +10,7 @@ A full list of `Atomic_agents` project modules.
- [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)
+ - [AgentMemory](atomic_agents/lib/components/agent_memory.md#AgentMemory)
- [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)
diff --git a/docs/api/atomic_agents/agents/base_chat_agent.md b/docs/api/atomic_agents/agents/base_chat_agent.md
index f0cc0fd..40fb145 100644
--- a/docs/api/atomic_agents/agents/base_chat_agent.md
+++ b/docs/api/atomic_agents/agents/base_chat_agent.md
@@ -51,9 +51,9 @@ generating system prompts, and obtaining responses from a language model.
- `output_schema` *Type[BaseAgentIO]* - 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.
+- `memory` *AgentMemory* - Memory component for storing chat history.
- `system_prompt_generator` *SystemPromptGenerator* - Component for generating system prompts.
-- `initial_memory` *ChatMemory* - Initial state of the memory.
+- `initial_memory` *AgentMemory* - Initial state of the memory.
#### Signature
diff --git a/docs/api/atomic_agents/lib/components/chat_memory.md b/docs/api/atomic_agents/lib/components/chat_memory.md
index 72db5cc..f66dd3b 100644
--- a/docs/api/atomic_agents/lib/components/chat_memory.md
+++ b/docs/api/atomic_agents/lib/components/chat_memory.md
@@ -1,12 +1,12 @@
-# ChatMemory
+# AgentMemory
-[Atomic_agents Index](../../../README.md#atomic_agents-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Components](./index.md#components) / ChatMemory
+[Atomic_agents Index](../../../README.md#atomic_agents-index) / [Atomic Agents](../../index.md#atomic-agents) / [Lib](../index.md#lib) / [Components](./index.md#components) / AgentMemory
-> Auto-generated documentation for [atomic_agents.lib.components.chat_memory](../../../../../atomic_agents/lib/components/chat_memory.py) module.
+> Auto-generated documentation for [atomic_agents.lib.components.agent_memory](../../../../../atomic_agents/lib/components/agent_memory.py) module.
#### Attributes
-- `memory` - Create a ChatMemory with a maximum of 5 messages: ChatMemory(max_messages=5)
+- `memory` - Create a AgentMemory with a maximum of 5 messages: AgentMemory(max_messages=5)
- `content` - Test Case 1: Text()
@@ -25,21 +25,21 @@
- `content` - Test Case 8: Text()
-- [ChatMemory](#chatmemory)
- - [ChatMemory](#chatmemory-1)
- - [ChatMemory()._manage_overflow](#chatmemory()_manage_overflow)
- - [ChatMemory().add_message](#chatmemory()add_message)
- - [ChatMemory().copy](#chatmemory()copy)
- - [ChatMemory().dump](#chatmemory()dump)
- - [ChatMemory().get_history](#chatmemory()get_history)
- - [ChatMemory().get_message_count](#chatmemory()get_message_count)
- - [ChatMemory().load](#chatmemory()load)
+- [AgentMemory](#AgentMemory)
+ - [AgentMemory](#AgentMemory-1)
+ - [AgentMemory()._manage_overflow](#AgentMemory()_manage_overflow)
+ - [AgentMemory().add_message](#AgentMemory()add_message)
+ - [AgentMemory().copy](#AgentMemory()copy)
+ - [AgentMemory().dump](#AgentMemory()dump)
+ - [AgentMemory().get_history](#AgentMemory()get_history)
+ - [AgentMemory().get_message_count](#AgentMemory()get_message_count)
+ - [AgentMemory().load](#AgentMemory()load)
- [Message](#message)
- [print_panel](#print_panel)
-## ChatMemory
+## AgentMemory
-[Show source in chat_memory.py:19](../../../../../atomic_agents/lib/components/chat_memory.py#L19)
+[Show source in agent_memory.py:19](../../../../../atomic_agents/lib/components/agent_memory.py#L19)
Manages the chat history for an AI agent.
@@ -51,13 +51,13 @@ Manages the chat history for an AI agent.
#### Signature
```python
-class ChatMemory:
+class AgentMemory:
def __init__(self, max_messages: Optional[int] = None): ...
```
-### ChatMemory()._manage_overflow
+### AgentMemory()._manage_overflow
-[Show source in chat_memory.py:61](../../../../../atomic_agents/lib/components/chat_memory.py#L61)
+[Show source in agent_memory.py:61](../../../../../atomic_agents/lib/components/agent_memory.py#L61)
Manages the chat history overflow based on max_messages constraint.
@@ -67,9 +67,9 @@ Manages the chat history overflow based on max_messages constraint.
def _manage_overflow(self) -> None: ...
```
-### ChatMemory().add_message
+### AgentMemory().add_message
-[Show source in chat_memory.py:38](../../../../../atomic_agents/lib/components/chat_memory.py#L38)
+[Show source in agent_memory.py:38](../../../../../atomic_agents/lib/components/agent_memory.py#L38)
Adds a message to the chat history and manages overflow.
@@ -77,7 +77,7 @@ Adds a message to the chat history and manages overflow.
- `role` *str* - The role of the message sender.
content (Union[str, Dict]): The content of the message.
-- [tool_message](#chatmemory) *Optional[Dict]* - Optional tool message to be included.
+- [tool_message](#AgentMemory) *Optional[Dict]* - Optional tool message to be included.
- `tool_id` *Optional[str]* - Optional unique identifier for the tool call.
#### Signature
@@ -92,25 +92,25 @@ def add_message(
) -> None: ...
```
-### ChatMemory().copy
+### AgentMemory().copy
-[Show source in chat_memory.py:109](../../../../../atomic_agents/lib/components/chat_memory.py#L109)
+[Show source in agent_memory.py:109](../../../../../atomic_agents/lib/components/agent_memory.py#L109)
Creates a copy of the chat memory.
#### Returns
-- [ChatMemory](#chatmemory) - A copy of the chat memory.
+- [AgentMemory](#AgentMemory) - A copy of the chat memory.
#### Signature
```python
-def copy(self) -> "ChatMemory": ...
+def copy(self) -> "AgentMemory": ...
```
-### ChatMemory().dump
+### AgentMemory().dump
-[Show source in chat_memory.py:78](../../../../../atomic_agents/lib/components/chat_memory.py#L78)
+[Show source in agent_memory.py:78](../../../../../atomic_agents/lib/components/agent_memory.py#L78)
Converts the chat history to a list of dictionaries.
@@ -124,9 +124,9 @@ Converts the chat history to a list of dictionaries.
def dump(self) -> List[Dict]: ...
```
-### ChatMemory().get_history
+### AgentMemory().get_history
-[Show source in chat_memory.py:69](../../../../../atomic_agents/lib/components/chat_memory.py#L69)
+[Show source in agent_memory.py:69](../../../../../atomic_agents/lib/components/agent_memory.py#L69)
Retrieves the chat history.
@@ -144,9 +144,9 @@ def get_history(self) -> List[Message]: ...
- [Message](#message)
-### ChatMemory().get_message_count
+### AgentMemory().get_message_count
-[Show source in chat_memory.py:121](../../../../../atomic_agents/lib/components/chat_memory.py#L121)
+[Show source in agent_memory.py:121](../../../../../atomic_agents/lib/components/agent_memory.py#L121)
Returns the number of messages in the chat history.
@@ -160,9 +160,9 @@ Returns the number of messages in the chat history.
def get_message_count(self) -> int: ...
```
-### ChatMemory().load
+### AgentMemory().load
-[Show source in chat_memory.py:87](../../../../../atomic_agents/lib/components/chat_memory.py#L87)
+[Show source in agent_memory.py:87](../../../../../atomic_agents/lib/components/agent_memory.py#L87)
Loads the chat history from a list of dictionaries using Pydantic's parsing.
@@ -180,7 +180,7 @@ def load(self, dict_list: List[Dict]) -> None: ...
## Message
-[Show source in chat_memory.py:4](../../../../../atomic_agents/lib/components/chat_memory.py#L4)
+[Show source in agent_memory.py:4](../../../../../atomic_agents/lib/components/agent_memory.py#L4)
Represents a message in the chat history.
@@ -201,7 +201,7 @@ class Message(BaseModel): ...
## print_panel
-[Show source in chat_memory.py:139](../../../../../atomic_agents/lib/components/chat_memory.py#L139)
+[Show source in agent_memory.py:139](../../../../../atomic_agents/lib/components/agent_memory.py#L139)
#### Signature
diff --git a/docs/api/atomic_agents/lib/components/index.md b/docs/api/atomic_agents/lib/components/index.md
index 04949f6..f181501 100644
--- a/docs/api/atomic_agents/lib/components/index.md
+++ b/docs/api/atomic_agents/lib/components/index.md
@@ -9,5 +9,5 @@
## Modules
-- [ChatMemory](./chat_memory.md)
+- [AgentMemory](./agent_memory.md)
- [SystemPromptGenerator](./system_prompt_generator.md)
\ No newline at end of file
diff --git a/examples/basic_custom_chatbot.py b/examples/basic_custom_chatbot.py
index f68216a..a6fc345 100644
--- a/examples/basic_custom_chatbot.py
+++ b/examples/basic_custom_chatbot.py
@@ -4,7 +4,7 @@ This example demonstrates how to create a custom chatbot with custom personality
import os
from rich.console import Console
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
import instructor
@@ -29,7 +29,7 @@ system_prompt = SystemPromptInfo(
system_prompt_generator = SystemPromptGenerator(system_prompt)
# Initialize chat memory to store conversation history
-memory = ChatMemory()
+memory = AgentMemory()
# Define initial memory with a greeting message from the assistant
initial_memory = [
{'role': 'assistant', 'content': 'How do you do? What can I do for you? Tell me, pray, what is your need today?'}
diff --git a/examples/memory_demo.py b/examples/memory_demo.py
index 0f616e3..bb48aa8 100644
--- a/examples/memory_demo.py
+++ b/examples/memory_demo.py
@@ -3,17 +3,17 @@ from rich.panel import Panel
from rich.text import Text
from rich.table import Table
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
console = Console()
def print_panel(title, content):
console.print(Panel(content, title=title, expand=False, border_style="cyan"))
-# Create a ChatMemory with a maximum of 5 messages
-memory = ChatMemory(max_messages=5)
+# Create a AgentMemory with a maximum of 5 messages
+memory = AgentMemory(max_messages=5)
-console.print("[bold magenta]ChatMemory Test Cases[/bold magenta]", justify="center")
+console.print("[bold magenta]AgentMemory Test Cases[/bold magenta]", justify="center")
console.print()
# Test Case 1
@@ -67,7 +67,7 @@ dumped_data = memory.dump()
content.append("Dumped data:\n")
content.append(str(dumped_data), style="dim")
content.append("\n\n")
-new_memory = ChatMemory(max_messages=5)
+new_memory = AgentMemory(max_messages=5)
new_memory.load(dumped_data)
content.append("Loaded memory:\n")
for msg in new_memory.get_history():
@@ -91,7 +91,7 @@ content = Text()
large_buffer = [
{"role": "user", "content": f"Message {i}"} for i in range(10)
]
-large_memory = ChatMemory(max_messages=5)
+large_memory = AgentMemory(max_messages=5)
large_memory.load(large_buffer)
content.append(f"Total messages after loading large buffer: {large_memory.get_message_count()}\n\n")
content.append("Current history (should only have 5 most recent messages):\n")
@@ -101,7 +101,7 @@ print_panel("7. Testing loading a larger buffer than max_messages", content)
# Test Case 8
content = Text()
-mixed_memory = ChatMemory(max_messages=10)
+mixed_memory = AgentMemory(max_messages=10)
mixed_memory.add_message("user", "Hello")
mixed_memory.add_message("assistant", {"text": "Hi there!", "confidence": 0.95})
mixed_memory.add_message("system", {"command": "reset_conversation"})
diff --git a/examples/notebooks/multi_agent_quickstart.ipynb b/examples/notebooks/multi_agent_quickstart.ipynb
index 68c527f..62d9b92 100644
--- a/examples/notebooks/multi_agent_quickstart.ipynb
+++ b/examples/notebooks/multi_agent_quickstart.ipynb
@@ -36,9 +36,68 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: atomic-agents in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (0.1.45)\n",
+ "Requirement already satisfied: openai in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.35.12)\n",
+ "Requirement already satisfied: instructor in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.3.4)\n",
+ "Requirement already satisfied: aiohttp in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (3.9.5)\n",
+ "Requirement already satisfied: beautifulsoup4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (4.12.3)\n",
+ "Requirement already satisfied: huggingface-hub in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (0.23.4)\n",
+ "Requirement already satisfied: scikit-learn in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.5.1)\n",
+ "Requirement already satisfied: sympy in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.13.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.4.0)\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.9.0)\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (0.27.0)\n",
+ "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (2.8.2)\n",
+ "Requirement already satisfied: sniffio in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.3.1)\n",
+ "Requirement already satisfied: tqdm>4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.66.4)\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.12.2)\n",
+ "Requirement already satisfied: docstring-parser<0.17,>=0.16 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.16)\n",
+ "Requirement already satisfied: jiter<0.5.0,>=0.4.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.4.2)\n",
+ "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (2.20.1)\n",
+ "Requirement already satisfied: rich<14.0.0,>=13.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (13.7.1)\n",
+ "Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (8.5.0)\n",
+ "Requirement already satisfied: typer<1.0.0,>=0.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.12.3)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.3.1)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (23.2.0)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (4.0.3)\n",
+ "Requirement already satisfied: idna>=2.8 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
+ "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.1)\n",
+ "Requirement already satisfied: certifi in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
+ "Requirement already satisfied: httpcore==1.* in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (3.0.0)\n",
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (2.18.0)\n",
+ "Requirement already satisfied: click>=8.0.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (8.1.7)\n",
+ "Requirement already satisfied: shellingham>=1.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (1.5.4)\n",
+ "Requirement already satisfied: soupsieve>1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from beautifulsoup4->atomic-agents) (2.5)\n",
+ "Requirement already satisfied: filelock in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (3.15.4)\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2024.6.1)\n",
+ "Requirement already satisfied: packaging>=20.9 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (24.1)\n",
+ "Requirement already satisfied: pyyaml>=5.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (6.0.1)\n",
+ "Requirement already satisfied: requests in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2.32.3)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.14.0)\n",
+ "Requirement already satisfied: joblib>=1.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.4.2)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (3.5.0)\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from sympy->atomic-agents) (1.3.0)\n",
+ "Requirement already satisfied: mdurl~=0.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->instructor) (0.1.2)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (3.3.2)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (2.2.2)\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# Install necessary packages\n",
"%pip install atomic-agents openai instructor"
@@ -55,7 +114,7 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -82,9 +141,22 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": 6,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "ValidationError",
+ "evalue": "1 validation error for SearxNGSearchToolConfig\nbase_url\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit https://errors.pydantic.dev/2.8/v/string_type",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mValidationError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 8\u001b[0m\n\u001b[1;32m 5\u001b[0m client \u001b[38;5;241m=\u001b[39m instructor\u001b[38;5;241m.\u001b[39mfrom_openai(openai\u001b[38;5;241m.\u001b[39mOpenAI())\n\u001b[1;32m 7\u001b[0m \u001b[38;5;66;03m# Initialize the SearxNG search tool\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m searx_tool \u001b[38;5;241m=\u001b[39m SearxNGSearchTool(\u001b[43mSearxNGSearchToolConfig\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbase_url\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetenv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mSEARXNG_BASE_URL\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_results\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m10\u001b[39;49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;66;03m# Initialize the calculator tool\u001b[39;00m\n\u001b[1;32m 11\u001b[0m calc_tool \u001b[38;5;241m=\u001b[39m CalculatorTool(CalculatorToolConfig())\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/pydantic/main.py:193\u001b[0m, in \u001b[0;36mBaseModel.__init__\u001b[0;34m(self, **data)\u001b[0m\n\u001b[1;32m 191\u001b[0m \u001b[38;5;66;03m# `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks\u001b[39;00m\n\u001b[1;32m 192\u001b[0m __tracebackhide__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m--> 193\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__pydantic_validator__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalidate_python\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mself_instance\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mValidationError\u001b[0m: 1 validation error for SearxNGSearchToolConfig\nbase_url\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit https://errors.pydantic.dev/2.8/v/string_type"
+ ]
+ }
+ ],
"source": [
"# Initialize the console for output\n",
"console = Console()\n",
@@ -110,7 +182,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -136,7 +208,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -162,7 +234,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -232,7 +304,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.3"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/examples/notebooks/quickstart.ipynb b/examples/notebooks/quickstart.ipynb
index ace0ff4..14ae5f9 100644
--- a/examples/notebooks/quickstart.ipynb
+++ b/examples/notebooks/quickstart.ipynb
@@ -36,9 +36,69 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: atomic-agents in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (0.1.45)\n",
+ "Requirement already satisfied: openai in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.35.12)\n",
+ "Requirement already satisfied: instructor in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.3.4)\n",
+ "Requirement already satisfied: jsonref in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.1.0)\n",
+ "Requirement already satisfied: aiohttp in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (3.9.5)\n",
+ "Requirement already satisfied: beautifulsoup4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (4.12.3)\n",
+ "Requirement already satisfied: huggingface-hub in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (0.23.4)\n",
+ "Requirement already satisfied: scikit-learn in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.5.1)\n",
+ "Requirement already satisfied: sympy in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.13.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.4.0)\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.9.0)\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (0.27.0)\n",
+ "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (2.8.2)\n",
+ "Requirement already satisfied: sniffio in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.3.1)\n",
+ "Requirement already satisfied: tqdm>4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.66.4)\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.12.2)\n",
+ "Requirement already satisfied: docstring-parser<0.17,>=0.16 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.16)\n",
+ "Requirement already satisfied: jiter<0.5.0,>=0.4.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.4.2)\n",
+ "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (2.20.1)\n",
+ "Requirement already satisfied: rich<14.0.0,>=13.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (13.7.1)\n",
+ "Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (8.5.0)\n",
+ "Requirement already satisfied: typer<1.0.0,>=0.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.12.3)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.3.1)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (23.2.0)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (4.0.3)\n",
+ "Requirement already satisfied: idna>=2.8 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
+ "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.1)\n",
+ "Requirement already satisfied: certifi in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
+ "Requirement already satisfied: httpcore==1.* in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (3.0.0)\n",
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (2.18.0)\n",
+ "Requirement already satisfied: click>=8.0.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (8.1.7)\n",
+ "Requirement already satisfied: shellingham>=1.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (1.5.4)\n",
+ "Requirement already satisfied: soupsieve>1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from beautifulsoup4->atomic-agents) (2.5)\n",
+ "Requirement already satisfied: filelock in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (3.15.4)\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2024.6.1)\n",
+ "Requirement already satisfied: packaging>=20.9 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (24.1)\n",
+ "Requirement already satisfied: pyyaml>=5.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (6.0.1)\n",
+ "Requirement already satisfied: requests in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2.32.3)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.14.0)\n",
+ "Requirement already satisfied: joblib>=1.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.4.2)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (3.5.0)\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from sympy->atomic-agents) (1.3.0)\n",
+ "Requirement already satisfied: mdurl~=0.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->instructor) (0.1.2)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (3.3.2)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (2.2.2)\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# Install necessary packages\n",
"%pip install atomic-agents openai instructor jsonref"
@@ -51,21 +111,21 @@
"## Step 2: Import Libraries\n",
"\n",
"We will import the necessary libraries for creating the chatbot. Each library serves a specific purpose:\n",
- "- `ChatMemory`: Manages the chat history.\n",
+ "- `AgentMemory`: Manages the chat history.\n",
"- `BaseChatAgent`: The base class to create a custom chatbot. Can be extended for additional functionality if needed.\n",
"- `SystemPromptGenerator` and `SystemPromptInfo`: To define and generate system prompts."
]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import instructor\n",
"import openai\n",
- "from atomic_agents.lib.components.chat_memory import ChatMemory\n",
+ "from atomic_agents.lib.components.agent_memory import AgentMemory\n",
"from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentConfig\n",
"from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo"
]
@@ -84,9 +144,66 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ <span style=\"font-weight: bold\">IDENTITY and PURPOSE</span> ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>This assistant is a general-purpose AI designed to be helpful and friendly. \n",
+ "\n",
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ <span style=\"font-weight: bold\">INTERNAL ASSISTANT STEPS</span> ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Understand the user's input and provide a relevant response. \n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Respond to the user. \n",
+ "\n",
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ <span style=\"font-weight: bold\">OUTPUT INSTRUCTIONS</span> ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Provide helpful and relevant information to assist the user. \n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Be friendly and respectful in all interactions. \n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Always answer in rhyming verse. \n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Always respond using the proper JSON schema. \n",
+ "<span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> • </span>Always use the available additional information and context to enhance the response. \n",
+ "</pre>\n"
+ ],
+ "text/plain": [
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ \u001b[1mIDENTITY and PURPOSE\u001b[0m ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "\u001b[1;33m • \u001b[0mThis assistant is a general-purpose AI designed to be helpful and friendly. \n",
+ "\n",
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ \u001b[1mINTERNAL ASSISTANT STEPS\u001b[0m ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "\u001b[1;33m • \u001b[0mUnderstand the user's input and provide a relevant response. \n",
+ "\u001b[1;33m • \u001b[0mRespond to the user. \n",
+ "\n",
+ "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
+ "┃ \u001b[1mOUTPUT INSTRUCTIONS\u001b[0m ┃\n",
+ "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n",
+ "\n",
+ "\u001b[1;33m • \u001b[0mProvide helpful and relevant information to assist the user. \n",
+ "\u001b[1;33m • \u001b[0mBe friendly and respectful in all interactions. \n",
+ "\u001b[1;33m • \u001b[0mAlways answer in rhyming verse. \n",
+ "\u001b[1;33m • \u001b[0mAlways respond using the proper JSON schema. \n",
+ "\u001b[1;33m • \u001b[0mAlways use the available additional information and context to enhance the response. \n"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
"source": [
"system_prompt = SystemPromptInfo(\n",
" background=[\n",
@@ -119,11 +236,11 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
- "memory = ChatMemory()\n",
+ "memory = AgentMemory()\n",
"initial_memory = [\n",
" {'role': 'assistant', 'content': 'How do you do? What can I do for you? Tell me, pray, what is your need today?'}\n",
"]\n",
@@ -141,7 +258,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -180,9 +297,18 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Agent: How do you do? What can I do for you? Tell me, pray, what is your need today?\n",
+ "Exiting chat...\n"
+ ]
+ }
+ ],
"source": [
"print(f'Agent: {initial_memory[0][\"content\"]}')\n",
"\n",
diff --git a/examples/notebooks/what_is_atomic_agents.ipynb b/examples/notebooks/what_is_atomic_agents.ipynb
index a3f44f3..c800b2e 100644
--- a/examples/notebooks/what_is_atomic_agents.ipynb
+++ b/examples/notebooks/what_is_atomic_agents.ipynb
@@ -68,9 +68,68 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: atomic-agents in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (0.1.45)\n",
+ "Requirement already satisfied: openai in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.35.12)\n",
+ "Requirement already satisfied: instructor in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.3.4)\n",
+ "Requirement already satisfied: aiohttp in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (3.9.5)\n",
+ "Requirement already satisfied: beautifulsoup4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (4.12.3)\n",
+ "Requirement already satisfied: huggingface-hub in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (0.23.4)\n",
+ "Requirement already satisfied: scikit-learn in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.5.1)\n",
+ "Requirement already satisfied: sympy in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.13.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.4.0)\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.9.0)\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (0.27.0)\n",
+ "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (2.8.2)\n",
+ "Requirement already satisfied: sniffio in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.3.1)\n",
+ "Requirement already satisfied: tqdm>4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.66.4)\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.12.2)\n",
+ "Requirement already satisfied: docstring-parser<0.17,>=0.16 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.16)\n",
+ "Requirement already satisfied: jiter<0.5.0,>=0.4.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.4.2)\n",
+ "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (2.20.1)\n",
+ "Requirement already satisfied: rich<14.0.0,>=13.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (13.7.1)\n",
+ "Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (8.5.0)\n",
+ "Requirement already satisfied: typer<1.0.0,>=0.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.12.3)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.3.1)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (23.2.0)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (4.0.3)\n",
+ "Requirement already satisfied: idna>=2.8 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
+ "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.1)\n",
+ "Requirement already satisfied: certifi in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
+ "Requirement already satisfied: httpcore==1.* in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (3.0.0)\n",
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (2.18.0)\n",
+ "Requirement already satisfied: click>=8.0.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (8.1.7)\n",
+ "Requirement already satisfied: shellingham>=1.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (1.5.4)\n",
+ "Requirement already satisfied: soupsieve>1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from beautifulsoup4->atomic-agents) (2.5)\n",
+ "Requirement already satisfied: filelock in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (3.15.4)\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2024.6.1)\n",
+ "Requirement already satisfied: packaging>=20.9 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (24.1)\n",
+ "Requirement already satisfied: pyyaml>=5.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (6.0.1)\n",
+ "Requirement already satisfied: requests in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2.32.3)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.14.0)\n",
+ "Requirement already satisfied: joblib>=1.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.4.2)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (3.5.0)\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from sympy->atomic-agents) (1.3.0)\n",
+ "Requirement already satisfied: mdurl~=0.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->instructor) (0.1.2)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (3.3.2)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (2.2.2)\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# Install necessary packages\n",
"%pip install atomic-agents openai instructor"
@@ -88,14 +147,14 @@
"metadata": {},
"source": [
"Next, we will import the necessary components for creating the chatbot. Each component serves a specific purpose:\n",
- "- `ChatMemory`: Manages the chat history.\n",
+ "- `AgentMemory`: Manages the chat history.\n",
"- `BaseChatAgent`: The base class to create a custom chatbot. Can be extended for additional functionality if needed.\n",
"- `SystemPromptGenerator` and `SystemPromptInfo`: To define and generate system prompts."
]
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -114,9 +173,47 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"># IDENTITY and PURPOSE\n",
+ "- This assistant is a general-purpose AI designed to be helpful and friendly.\n",
+ "\n",
+ "# INTERNAL ASSISTANT STEPS\n",
+ "- Understand the user's input and provide a relevant response.\n",
+ "- Respond to the user.\n",
+ "\n",
+ "# OUTPUT INSTRUCTIONS\n",
+ "- Provide helpful and relevant information to assist the user.\n",
+ "- Be friendly and respectful in all interactions.\n",
+ "- Always answer in rhyming verse.\n",
+ "- Always respond using the proper JSON schema.\n",
+ "- Always use the available additional information and context to enhance the response.\n",
+ "</pre>\n"
+ ],
+ "text/plain": [
+ "# IDENTITY and PURPOSE\n",
+ "- This assistant is a general-purpose AI designed to be helpful and friendly.\n",
+ "\n",
+ "# INTERNAL ASSISTANT STEPS\n",
+ "- Understand the user's input and provide a relevant response.\n",
+ "- Respond to the user.\n",
+ "\n",
+ "# OUTPUT INSTRUCTIONS\n",
+ "- Provide helpful and relevant information to assist the user.\n",
+ "- Be friendly and respectful in all interactions.\n",
+ "- Always answer in rhyming verse.\n",
+ "- Always respond using the proper JSON schema.\n",
+ "- Always use the available additional information and context to enhance the response.\n"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
"source": [
"from rich.console import Console\n",
"\n",
@@ -173,13 +270,13 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
- "from atomic_agents.lib.components.chat_memory import ChatMemory\n",
+ "from atomic_agents.lib.components.agent_memory import AgentMemory\n",
"\n",
- "memory = ChatMemory()\n",
+ "memory = AgentMemory()\n",
"initial_memory = [\n",
" {'role': 'assistant', 'content': 'How do you do? What can I do for you? Tell me, pray, what is your need today?'}\n",
"]\n",
@@ -199,7 +296,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -221,7 +318,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -260,9 +357,50 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Agent: How do you do? What can I do for you? Tell me, pray, what is your need today?\n"
+ ]
+ },
+ {
+ "ename": "RateLimitError",
+ "evalue": "Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mRateLimitError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[7], line 9\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mExiting chat...\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[0;32m----> 9\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43magent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43magent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minput_schema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mchat_message\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muser_input\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mAgent: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mresponse\u001b[38;5;241m.\u001b[39mchat_message\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/atomic_agents/agents/base_chat_agent.py:149\u001b[0m, in \u001b[0;36mBaseChatAgent.run\u001b[0;34m(self, user_input)\u001b[0m\n\u001b[1;32m 147\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_init_run(user_input)\n\u001b[1;32m 148\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_pre_run()\n\u001b[0;32m--> 149\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_and_handle_response\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 150\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_post_run(response)\n\u001b[1;32m 151\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/atomic_agents/agents/base_chat_agent.py:160\u001b[0m, in \u001b[0;36mBaseChatAgent._get_and_handle_response\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 153\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_get_and_handle_response\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[1;32m 154\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 155\u001b[0m \u001b[38;5;124;03m Handles obtaining and processing the response.\u001b[39;00m\n\u001b[1;32m 156\u001b[0m \n\u001b[1;32m 157\u001b[0m \u001b[38;5;124;03m Returns:\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \u001b[38;5;124;03m Type[BaseModel]: The processed response.\u001b[39;00m\n\u001b[1;32m 159\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 160\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_response\u001b[49m\u001b[43m(\u001b[49m\u001b[43mresponse_model\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43moutput_schema\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/atomic_agents/agents/base_chat_agent.py:133\u001b[0m, in \u001b[0;36mBaseChatAgent.get_response\u001b[0;34m(self, response_model)\u001b[0m\n\u001b[1;32m 125\u001b[0m response_model \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39moutput_schema\n\u001b[1;32m 127\u001b[0m messages \u001b[38;5;241m=\u001b[39m [\n\u001b[1;32m 128\u001b[0m {\n\u001b[1;32m 129\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrole\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msystem\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 130\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcontent\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msystem_prompt_generator\u001b[38;5;241m.\u001b[39mgenerate_prompt(),\n\u001b[1;32m 131\u001b[0m }\n\u001b[1;32m 132\u001b[0m ] \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmemory\u001b[38;5;241m.\u001b[39mget_history()\n\u001b[0;32m--> 133\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mchat\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcompletions\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mresponse_model\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_model\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 134\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/instructor/client.py:91\u001b[0m, in \u001b[0;36mInstructor.create\u001b[0;34m(self, response_model, messages, max_retries, validation_context, strict, **kwargs)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate\u001b[39m(\n\u001b[1;32m 81\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 82\u001b[0m response_model: \u001b[38;5;28mtype\u001b[39m[T],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 87\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: Any,\n\u001b[1;32m 88\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T \u001b[38;5;241m|\u001b[39m Awaitable[T]:\n\u001b[1;32m 89\u001b[0m kwargs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhandle_kwargs(kwargs)\n\u001b[0;32m---> 91\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_fn\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 92\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_model\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_model\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 93\u001b[0m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 94\u001b[0m \u001b[43m \u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 95\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalidation_context\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalidation_context\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 96\u001b[0m \u001b[43m \u001b[49m\u001b[43mstrict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstrict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 97\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 98\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/instructor/patch.py:143\u001b[0m, in \u001b[0;36mpatch.<locals>.new_create_sync\u001b[0;34m(response_model, validation_context, max_retries, strict, *args, **kwargs)\u001b[0m\n\u001b[1;32m 131\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(func)\n\u001b[1;32m 132\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mnew_create_sync\u001b[39m(\n\u001b[1;32m 133\u001b[0m response_model: \u001b[38;5;28mtype\u001b[39m[T_Model] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 138\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs: T_ParamSpec\u001b[38;5;241m.\u001b[39mkwargs,\n\u001b[1;32m 139\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T_Model:\n\u001b[1;32m 140\u001b[0m response_model, new_kwargs \u001b[38;5;241m=\u001b[39m handle_response_model(\n\u001b[1;32m 141\u001b[0m response_model\u001b[38;5;241m=\u001b[39mresponse_model, mode\u001b[38;5;241m=\u001b[39mmode, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs\n\u001b[1;32m 142\u001b[0m )\n\u001b[0;32m--> 143\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mretry_sync\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 144\u001b[0m \u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 145\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_model\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_model\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 146\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalidation_context\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalidation_context\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 147\u001b[0m \u001b[43m \u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 148\u001b[0m \u001b[43m \u001b[49m\u001b[43margs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 149\u001b[0m \u001b[43m \u001b[49m\u001b[43mstrict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstrict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 150\u001b[0m \u001b[43m \u001b[49m\u001b[43mkwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnew_kwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 151\u001b[0m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 152\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 153\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/instructor/retry.py:162\u001b[0m, in \u001b[0;36mretry_sync\u001b[0;34m(func, response_model, validation_context, args, kwargs, max_retries, strict, mode)\u001b[0m\n\u001b[1;32m 160\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 161\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 162\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m attempt \u001b[38;5;129;01min\u001b[39;00m max_retries:\n\u001b[1;32m 163\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m attempt:\n\u001b[1;32m 164\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/tenacity/__init__.py:443\u001b[0m, in \u001b[0;36mBaseRetrying.__iter__\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 441\u001b[0m retry_state \u001b[38;5;241m=\u001b[39m RetryCallState(\u001b[38;5;28mself\u001b[39m, fn\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, args\u001b[38;5;241m=\u001b[39m(), kwargs\u001b[38;5;241m=\u001b[39m{})\n\u001b[1;32m 442\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 443\u001b[0m do \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43miter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mretry_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretry_state\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 444\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(do, DoAttempt):\n\u001b[1;32m 445\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m AttemptManager(retry_state\u001b[38;5;241m=\u001b[39mretry_state)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/tenacity/__init__.py:376\u001b[0m, in \u001b[0;36mBaseRetrying.iter\u001b[0;34m(self, retry_state)\u001b[0m\n\u001b[1;32m 374\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 375\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m action \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39miter_state\u001b[38;5;241m.\u001b[39mactions:\n\u001b[0;32m--> 376\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43maction\u001b[49m\u001b[43m(\u001b[49m\u001b[43mretry_state\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 377\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/tenacity/__init__.py:418\u001b[0m, in \u001b[0;36mBaseRetrying._post_stop_check_actions.<locals>.exc_check\u001b[0;34m(rs)\u001b[0m\n\u001b[1;32m 416\u001b[0m retry_exc \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretry_error_cls(fut)\n\u001b[1;32m 417\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mreraise:\n\u001b[0;32m--> 418\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[43mretry_exc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreraise\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 419\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m retry_exc \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mfut\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexception\u001b[39;00m()\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/tenacity/__init__.py:185\u001b[0m, in \u001b[0;36mRetryError.reraise\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 183\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mreraise\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m t\u001b[38;5;241m.\u001b[39mNoReturn:\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlast_attempt\u001b[38;5;241m.\u001b[39mfailed:\n\u001b[0;32m--> 185\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlast_attempt\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresult\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 186\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\n",
+ "File \u001b[0;32m/usr/lib/python3.10/concurrent/futures/_base.py:451\u001b[0m, in \u001b[0;36mFuture.result\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m CancelledError()\n\u001b[1;32m 450\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_state \u001b[38;5;241m==\u001b[39m FINISHED:\n\u001b[0;32m--> 451\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__get_result\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 453\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_condition\u001b[38;5;241m.\u001b[39mwait(timeout)\n\u001b[1;32m 455\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_state \u001b[38;5;129;01min\u001b[39;00m [CANCELLED, CANCELLED_AND_NOTIFIED]:\n",
+ "File \u001b[0;32m/usr/lib/python3.10/concurrent/futures/_base.py:403\u001b[0m, in \u001b[0;36mFuture.__get_result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 401\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception:\n\u001b[1;32m 402\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 403\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[1;32m 404\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 405\u001b[0m \u001b[38;5;66;03m# Break a reference cycle with the exception in self._exception\u001b[39;00m\n\u001b[1;32m 406\u001b[0m \u001b[38;5;28mself\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/instructor/retry.py:165\u001b[0m, in \u001b[0;36mretry_sync\u001b[0;34m(func, response_model, validation_context, args, kwargs, max_retries, strict, mode)\u001b[0m\n\u001b[1;32m 163\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m attempt:\n\u001b[1;32m 164\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 165\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 166\u001b[0m stream \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstream\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[1;32m 167\u001b[0m response \u001b[38;5;241m=\u001b[39m update_total_usage(response, total_usage)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_utils/_utils.py:277\u001b[0m, in \u001b[0;36mrequired_args.<locals>.inner.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 275\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mMissing required argument: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mquote(missing[\u001b[38;5;241m0\u001b[39m])\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 276\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg)\n\u001b[0;32m--> 277\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/resources/chat/completions.py:643\u001b[0m, in \u001b[0;36mCompletions.create\u001b[0;34m(self, messages, model, frequency_penalty, function_call, functions, logit_bias, logprobs, max_tokens, n, parallel_tool_calls, presence_penalty, response_format, seed, service_tier, stop, stream, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, extra_headers, extra_query, extra_body, timeout)\u001b[0m\n\u001b[1;32m 609\u001b[0m \u001b[38;5;129m@required_args\u001b[39m([\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m], [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstream\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 610\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcreate\u001b[39m(\n\u001b[1;32m 611\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 641\u001b[0m timeout: \u001b[38;5;28mfloat\u001b[39m \u001b[38;5;241m|\u001b[39m httpx\u001b[38;5;241m.\u001b[39mTimeout \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m|\u001b[39m NotGiven \u001b[38;5;241m=\u001b[39m NOT_GIVEN,\n\u001b[1;32m 642\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ChatCompletion \u001b[38;5;241m|\u001b[39m Stream[ChatCompletionChunk]:\n\u001b[0;32m--> 643\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_post\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 644\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/chat/completions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 645\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmaybe_transform\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 646\u001b[0m \u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 647\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmessages\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 648\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmodel\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 649\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfrequency_penalty\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrequency_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 650\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfunction_call\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunction_call\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 651\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mfunctions\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunctions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 652\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlogit_bias\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogit_bias\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 653\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mlogprobs\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 654\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmax_tokens\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 655\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mn\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 656\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mparallel_tool_calls\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mparallel_tool_calls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 657\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mpresence_penalty\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mpresence_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 658\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mresponse_format\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mresponse_format\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 659\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mseed\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mseed\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 660\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mservice_tier\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mservice_tier\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 661\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mstop\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 662\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mstream\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 663\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mstream_options\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 664\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtemperature\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtemperature\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 665\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtool_choice\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtool_choice\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 666\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtools\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtools\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 667\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtop_logprobs\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_logprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mtop_p\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_p\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43muser\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43muser\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompletion_create_params\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mCompletionCreateParams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 673\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmake_request_options\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 674\u001b[0m \u001b[43m \u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_headers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_query\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_query\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_body\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mextra_body\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\n\u001b[1;32m 675\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mChatCompletion\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mStream\u001b[49m\u001b[43m[\u001b[49m\u001b[43mChatCompletionChunk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 679\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1266\u001b[0m, in \u001b[0;36mSyncAPIClient.post\u001b[0;34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1252\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost\u001b[39m(\n\u001b[1;32m 1253\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1254\u001b[0m path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1261\u001b[0m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1262\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ResponseT \u001b[38;5;241m|\u001b[39m _StreamT:\n\u001b[1;32m 1263\u001b[0m opts \u001b[38;5;241m=\u001b[39m FinalRequestOptions\u001b[38;5;241m.\u001b[39mconstruct(\n\u001b[1;32m 1264\u001b[0m method\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpost\u001b[39m\u001b[38;5;124m\"\u001b[39m, url\u001b[38;5;241m=\u001b[39mpath, json_data\u001b[38;5;241m=\u001b[39mbody, files\u001b[38;5;241m=\u001b[39mto_httpx_files(files), \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions\n\u001b[1;32m 1265\u001b[0m )\n\u001b[0;32m-> 1266\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m)\u001b[49m)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:942\u001b[0m, in \u001b[0;36mSyncAPIClient.request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 933\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrequest\u001b[39m(\n\u001b[1;32m 934\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 935\u001b[0m cast_to: Type[ResponseT],\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 940\u001b[0m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 941\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ResponseT \u001b[38;5;241m|\u001b[39m _StreamT:\n\u001b[0;32m--> 942\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 943\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 944\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 945\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 946\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43mremaining_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremaining_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 948\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1031\u001b[0m, in \u001b[0;36mSyncAPIClient._request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1029\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m retries \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_should_retry(err\u001b[38;5;241m.\u001b[39mresponse):\n\u001b[1;32m 1030\u001b[0m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mclose()\n\u001b[0;32m-> 1031\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_retry_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1032\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1033\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1034\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1035\u001b[0m \u001b[43m \u001b[49m\u001b[43merr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1036\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1037\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1038\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1040\u001b[0m \u001b[38;5;66;03m# If the response is streamed then we need to explicitly read the response\u001b[39;00m\n\u001b[1;32m 1041\u001b[0m \u001b[38;5;66;03m# to completion before attempting to access the response text.\u001b[39;00m\n\u001b[1;32m 1042\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mis_closed:\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1079\u001b[0m, in \u001b[0;36mSyncAPIClient._retry_request\u001b[0;34m(self, options, cast_to, remaining_retries, response_headers, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1075\u001b[0m \u001b[38;5;66;03m# In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a\u001b[39;00m\n\u001b[1;32m 1076\u001b[0m \u001b[38;5;66;03m# different thread if necessary.\u001b[39;00m\n\u001b[1;32m 1077\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(timeout)\n\u001b[0;32m-> 1079\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1080\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1081\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1082\u001b[0m \u001b[43m \u001b[49m\u001b[43mremaining_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremaining\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1083\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1084\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1085\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1031\u001b[0m, in \u001b[0;36mSyncAPIClient._request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1029\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m retries \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_should_retry(err\u001b[38;5;241m.\u001b[39mresponse):\n\u001b[1;32m 1030\u001b[0m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mclose()\n\u001b[0;32m-> 1031\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_retry_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1032\u001b[0m \u001b[43m \u001b[49m\u001b[43minput_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1033\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1034\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1035\u001b[0m \u001b[43m \u001b[49m\u001b[43merr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1036\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1037\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1038\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1040\u001b[0m \u001b[38;5;66;03m# If the response is streamed then we need to explicitly read the response\u001b[39;00m\n\u001b[1;32m 1041\u001b[0m \u001b[38;5;66;03m# to completion before attempting to access the response text.\u001b[39;00m\n\u001b[1;32m 1042\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mis_closed:\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1079\u001b[0m, in \u001b[0;36mSyncAPIClient._retry_request\u001b[0;34m(self, options, cast_to, remaining_retries, response_headers, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1075\u001b[0m \u001b[38;5;66;03m# In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a\u001b[39;00m\n\u001b[1;32m 1076\u001b[0m \u001b[38;5;66;03m# different thread if necessary.\u001b[39;00m\n\u001b[1;32m 1077\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(timeout)\n\u001b[0;32m-> 1079\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1080\u001b[0m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moptions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1081\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1082\u001b[0m \u001b[43m \u001b[49m\u001b[43mremaining_retries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremaining\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1083\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1084\u001b[0m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstream_cls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1085\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/openai/_base_client.py:1046\u001b[0m, in \u001b[0;36mSyncAPIClient._request\u001b[0;34m(self, cast_to, options, remaining_retries, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1043\u001b[0m err\u001b[38;5;241m.\u001b[39mresponse\u001b[38;5;241m.\u001b[39mread()\n\u001b[1;32m 1045\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRe-raising status error\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m-> 1046\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_make_status_error_from_response(err\u001b[38;5;241m.\u001b[39mresponse) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 1048\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_process_response(\n\u001b[1;32m 1049\u001b[0m cast_to\u001b[38;5;241m=\u001b[39mcast_to,\n\u001b[1;32m 1050\u001b[0m options\u001b[38;5;241m=\u001b[39moptions,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1053\u001b[0m stream_cls\u001b[38;5;241m=\u001b[39mstream_cls,\n\u001b[1;32m 1054\u001b[0m )\n",
+ "\u001b[0;31mRateLimitError\u001b[0m: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}"
+ ]
+ }
+ ],
"source": [
"print(f'Agent: {initial_memory[0][\"content\"]}')\n",
"\n",
@@ -291,7 +429,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -692,7 +830,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.3"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/examples/notebooks/yelp_agent.ipynb b/examples/notebooks/yelp_agent.ipynb
index 6c22891..298dd65 100644
--- a/examples/notebooks/yelp_agent.ipynb
+++ b/examples/notebooks/yelp_agent.ipynb
@@ -36,9 +36,68 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: atomic-agents in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (0.1.45)\n",
+ "Requirement already satisfied: openai in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.35.12)\n",
+ "Requirement already satisfied: instructor in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.3.4)\n",
+ "Requirement already satisfied: aiohttp in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (3.9.5)\n",
+ "Requirement already satisfied: beautifulsoup4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (4.12.3)\n",
+ "Requirement already satisfied: huggingface-hub in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (0.23.4)\n",
+ "Requirement already satisfied: scikit-learn in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.5.1)\n",
+ "Requirement already satisfied: sympy in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.13.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.4.0)\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.9.0)\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (0.27.0)\n",
+ "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (2.8.2)\n",
+ "Requirement already satisfied: sniffio in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.3.1)\n",
+ "Requirement already satisfied: tqdm>4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.66.4)\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.12.2)\n",
+ "Requirement already satisfied: docstring-parser<0.17,>=0.16 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.16)\n",
+ "Requirement already satisfied: jiter<0.5.0,>=0.4.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.4.2)\n",
+ "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (2.20.1)\n",
+ "Requirement already satisfied: rich<14.0.0,>=13.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (13.7.1)\n",
+ "Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (8.5.0)\n",
+ "Requirement already satisfied: typer<1.0.0,>=0.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.12.3)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.3.1)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (23.2.0)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (4.0.3)\n",
+ "Requirement already satisfied: idna>=2.8 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
+ "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.1)\n",
+ "Requirement already satisfied: certifi in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
+ "Requirement already satisfied: httpcore==1.* in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (3.0.0)\n",
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (2.18.0)\n",
+ "Requirement already satisfied: click>=8.0.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (8.1.7)\n",
+ "Requirement already satisfied: shellingham>=1.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (1.5.4)\n",
+ "Requirement already satisfied: soupsieve>1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from beautifulsoup4->atomic-agents) (2.5)\n",
+ "Requirement already satisfied: filelock in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (3.15.4)\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2024.6.1)\n",
+ "Requirement already satisfied: packaging>=20.9 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (24.1)\n",
+ "Requirement already satisfied: pyyaml>=5.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (6.0.1)\n",
+ "Requirement already satisfied: requests in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2.32.3)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.14.0)\n",
+ "Requirement already satisfied: joblib>=1.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.4.2)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (3.5.0)\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from sympy->atomic-agents) (1.3.0)\n",
+ "Requirement already satisfied: mdurl~=0.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->instructor) (0.1.2)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (3.3.2)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (2.2.2)\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# Install necessary packages\n",
"%pip install atomic-agents openai instructor"
@@ -55,7 +114,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -67,7 +126,7 @@
"import openai\n",
"from rich.console import Console\n",
"\n",
- "from atomic_agents.lib.components.chat_memory import ChatMemory\n",
+ "from atomic_agents.lib.components.agent_memory import AgentMemory\n",
"from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo\n",
"from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfig\n",
"from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema"
@@ -84,7 +143,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -120,7 +179,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -128,7 +187,7 @@
"system_prompt_generator = SystemPromptGenerator(system_prompt)\n",
"\n",
"# Initialize chat memory to store conversation history\n",
- "memory = ChatMemory()\n",
+ "memory = AgentMemory()\n",
"# Define initial memory with a greeting message from the assistant\n",
"initial_memory = [\n",
" {'role': 'assistant', 'content': 'Hello, can I help you find a restaurant?'}\n",
@@ -150,7 +209,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -169,9 +228,22 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "ValidationError",
+ "evalue": "1 validation error for YelpSearchToolConfig\napi_key\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit https://errors.pydantic.dev/2.8/v/string_type",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mValidationError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[6], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# Initialize the YelpSearchTool\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m yelp_tool \u001b[38;5;241m=\u001b[39m YelpSearchTool(\u001b[43mYelpSearchToolConfig\u001b[49m\u001b[43m(\u001b[49m\u001b[43mapi_key\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mos\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetenv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mYELP_API_KEY\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_results\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m10\u001b[39;49m\u001b[43m)\u001b[49m)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/pydantic/main.py:193\u001b[0m, in \u001b[0;36mBaseModel.__init__\u001b[0;34m(self, **data)\u001b[0m\n\u001b[1;32m 191\u001b[0m \u001b[38;5;66;03m# `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks\u001b[39;00m\n\u001b[1;32m 192\u001b[0m __tracebackhide__ \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m--> 193\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__pydantic_validator__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvalidate_python\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mself_instance\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n",
+ "\u001b[0;31mValidationError\u001b[0m: 1 validation error for YelpSearchToolConfig\napi_key\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\n For further information visit https://errors.pydantic.dev/2.8/v/string_type"
+ ]
+ }
+ ],
"source": [
"# Initialize the YelpSearchTool\n",
"yelp_tool = YelpSearchTool(YelpSearchToolConfig(api_key=os.getenv('YELP_API_KEY'), max_results=10))"
@@ -190,7 +262,18 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "",
+ "evalue": "",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31mRunning cells with 'venv (Python 3.10.12)' requires the ipykernel package.\n",
+ "\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
+ "\u001b[1;31mCommand: '/home/w3bwizar/Development/AI/atomic_agents/venv/bin/python -m pip install ipykernel -U --force-reinstall'"
+ ]
+ }
+ ],
"source": [
"# Define a custom response schema that can handle both chat responses and Yelp search tool responses\n",
"class ResponseSchema(BaseModel):\n",
@@ -218,7 +301,18 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "",
+ "evalue": "",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31mRunning cells with 'venv (Python 3.10.12)' requires the ipykernel package.\n",
+ "\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
+ "\u001b[1;31mCommand: '/home/w3bwizar/Development/AI/atomic_agents/venv/bin/python -m pip install ipykernel -U --force-reinstall'"
+ ]
+ }
+ ],
"source": [
"# Create a chat agent with the specified model, system prompt generator, and memory\n",
"agent = BaseChatAgent(\n",
@@ -249,7 +343,18 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "",
+ "evalue": "",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31mRunning cells with 'venv (Python 3.10.12)' requires the ipykernel package.\n",
+ "\u001b[1;31mRun the following command to install 'ipykernel' into the Python environment. \n",
+ "\u001b[1;31mCommand: '/home/w3bwizar/Development/AI/atomic_agents/venv/bin/python -m pip install ipykernel -U --force-reinstall'"
+ ]
+ }
+ ],
"source": [
"while True:\n",
" user_input = input('You: ')\n",
@@ -296,7 +401,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.3"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/examples/notebooks/youtube_knowledge_extraction.ipynb b/examples/notebooks/youtube_knowledge_extraction.ipynb
index 9496ffa..9e91083 100644
--- a/examples/notebooks/youtube_knowledge_extraction.ipynb
+++ b/examples/notebooks/youtube_knowledge_extraction.ipynb
@@ -31,9 +31,69 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Requirement already satisfied: atomic-agents in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (0.1.45)\n",
+ "Requirement already satisfied: openai in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.35.12)\n",
+ "Requirement already satisfied: instructor in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.3.4)\n",
+ "Requirement already satisfied: python-dotenv in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (1.0.1)\n",
+ "Requirement already satisfied: aiohttp in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (3.9.5)\n",
+ "Requirement already satisfied: beautifulsoup4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (4.12.3)\n",
+ "Requirement already satisfied: huggingface-hub in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (0.23.4)\n",
+ "Requirement already satisfied: scikit-learn in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.5.1)\n",
+ "Requirement already satisfied: sympy in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from atomic-agents) (1.13.0)\n",
+ "Requirement already satisfied: anyio<5,>=3.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.4.0)\n",
+ "Requirement already satisfied: distro<2,>=1.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.9.0)\n",
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (0.27.0)\n",
+ "Requirement already satisfied: pydantic<3,>=1.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (2.8.2)\n",
+ "Requirement already satisfied: sniffio in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (1.3.1)\n",
+ "Requirement already satisfied: tqdm>4 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.66.4)\n",
+ "Requirement already satisfied: typing-extensions<5,>=4.7 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from openai) (4.12.2)\n",
+ "Requirement already satisfied: docstring-parser<0.17,>=0.16 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.16)\n",
+ "Requirement already satisfied: jiter<0.5.0,>=0.4.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.4.2)\n",
+ "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (2.20.1)\n",
+ "Requirement already satisfied: rich<14.0.0,>=13.7.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (13.7.1)\n",
+ "Requirement already satisfied: tenacity<9.0.0,>=8.2.3 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (8.5.0)\n",
+ "Requirement already satisfied: typer<1.0.0,>=0.9.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from instructor) (0.12.3)\n",
+ "Requirement already satisfied: aiosignal>=1.1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.3.1)\n",
+ "Requirement already satisfied: attrs>=17.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (23.2.0)\n",
+ "Requirement already satisfied: frozenlist>=1.1.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.4.1)\n",
+ "Requirement already satisfied: multidict<7.0,>=4.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (6.0.5)\n",
+ "Requirement already satisfied: yarl<2.0,>=1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (1.9.4)\n",
+ "Requirement already satisfied: async-timeout<5.0,>=4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from aiohttp->atomic-agents) (4.0.3)\n",
+ "Requirement already satisfied: idna>=2.8 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.7)\n",
+ "Requirement already satisfied: exceptiongroup>=1.0.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.1)\n",
+ "Requirement already satisfied: certifi in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.7.4)\n",
+ "Requirement already satisfied: httpcore==1.* in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
+ "Requirement already satisfied: h11<0.15,>=0.13 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
+ "Requirement already satisfied: annotated-types>=0.4.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.7.0)\n",
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (3.0.0)\n",
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from rich<14.0.0,>=13.7.0->instructor) (2.18.0)\n",
+ "Requirement already satisfied: click>=8.0.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (8.1.7)\n",
+ "Requirement already satisfied: shellingham>=1.3.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from typer<1.0.0,>=0.9.0->instructor) (1.5.4)\n",
+ "Requirement already satisfied: soupsieve>1.2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from beautifulsoup4->atomic-agents) (2.5)\n",
+ "Requirement already satisfied: filelock in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (3.15.4)\n",
+ "Requirement already satisfied: fsspec>=2023.5.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2024.6.1)\n",
+ "Requirement already satisfied: packaging>=20.9 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (24.1)\n",
+ "Requirement already satisfied: pyyaml>=5.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (6.0.1)\n",
+ "Requirement already satisfied: requests in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from huggingface-hub->atomic-agents) (2.32.3)\n",
+ "Requirement already satisfied: numpy>=1.19.5 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.26.4)\n",
+ "Requirement already satisfied: scipy>=1.6.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.14.0)\n",
+ "Requirement already satisfied: joblib>=1.2.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (1.4.2)\n",
+ "Requirement already satisfied: threadpoolctl>=3.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from scikit-learn->atomic-agents) (3.5.0)\n",
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from sympy->atomic-agents) (1.3.0)\n",
+ "Requirement already satisfied: mdurl~=0.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->instructor) (0.1.2)\n",
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (3.3.2)\n",
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/w3bwizar/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages (from requests->huggingface-hub->atomic-agents) (2.2.2)\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
"source": [
"# Install required packages\n",
"%pip install atomic-agents openai instructor python-dotenv"
@@ -56,7 +116,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@@ -89,7 +149,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@@ -116,7 +176,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
@@ -136,7 +196,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
@@ -180,7 +240,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
@@ -206,7 +266,7 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
@@ -231,9 +291,29 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 8,
"metadata": {},
- "outputs": [],
+ "outputs": [
+ {
+ "ename": "DefaultCredentialsError",
+ "evalue": "Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mDefaultCredentialsError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[8], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m video_url \u001b[38;5;241m=\u001b[39m \u001b[38;5;28minput\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEnter the YouTube video URL: \u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m----> 2\u001b[0m scraped_transcript \u001b[38;5;241m=\u001b[39m \u001b[43myt_scraper_tool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mYouTubeTranscriptToolSchema\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvideo_url\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvideo_url\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3\u001b[0m transcript_provider\u001b[38;5;241m.\u001b[39mtranscript \u001b[38;5;241m=\u001b[39m scraped_transcript\u001b[38;5;241m.\u001b[39mtranscript\n\u001b[1;32m 4\u001b[0m transcript_provider\u001b[38;5;241m.\u001b[39mduration \u001b[38;5;241m=\u001b[39m scraped_transcript\u001b[38;5;241m.\u001b[39mduration\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/atomic_agents/lib/tools/yt_transcript_scraper.py:106\u001b[0m, in \u001b[0;36mYouTubeTranscriptTool.run\u001b[0;34m(self, params)\u001b[0m\n\u001b[1;32m 103\u001b[0m transcript_text \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mjoin([transcript[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m transcript \u001b[38;5;129;01min\u001b[39;00m transcripts])\n\u001b[1;32m 104\u001b[0m total_duration \u001b[38;5;241m=\u001b[39m \u001b[38;5;28msum\u001b[39m([transcript[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mduration\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01mfor\u001b[39;00m transcript \u001b[38;5;129;01min\u001b[39;00m transcripts])\n\u001b[0;32m--> 106\u001b[0m metadata \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfetch_video_metadata\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvideo_id\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 108\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m YouTubeTranscriptToolOutputSchema(\n\u001b[1;32m 109\u001b[0m transcript\u001b[38;5;241m=\u001b[39mtranscript_text,\n\u001b[1;32m 110\u001b[0m duration\u001b[38;5;241m=\u001b[39mtotal_duration,\n\u001b[1;32m 111\u001b[0m comments\u001b[38;5;241m=\u001b[39m[],\n\u001b[1;32m 112\u001b[0m metadata\u001b[38;5;241m=\u001b[39mmetadata,\n\u001b[1;32m 113\u001b[0m )\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/atomic_agents/lib/tools/yt_transcript_scraper.py:138\u001b[0m, in \u001b[0;36mYouTubeTranscriptTool.fetch_video_metadata\u001b[0;34m(self, video_id)\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mfetch_video_metadata\u001b[39m(\u001b[38;5;28mself\u001b[39m, video_id: \u001b[38;5;28mstr\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mdict\u001b[39m:\n\u001b[1;32m 129\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 130\u001b[0m \u001b[38;5;124;03m Fetches metadata for a YouTube video.\u001b[39;00m\n\u001b[1;32m 131\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 136\u001b[0m \u001b[38;5;124;03m dict: The metadata of the video.\u001b[39;00m\n\u001b[1;32m 137\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 138\u001b[0m youtube \u001b[38;5;241m=\u001b[39m \u001b[43mbuild\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43myoutube\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mv3\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdeveloperKey\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mapi_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 139\u001b[0m request \u001b[38;5;241m=\u001b[39m youtube\u001b[38;5;241m.\u001b[39mvideos()\u001b[38;5;241m.\u001b[39mlist(part\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msnippet\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39mvideo_id)\n\u001b[1;32m 140\u001b[0m response \u001b[38;5;241m=\u001b[39m request\u001b[38;5;241m.\u001b[39mexecute()\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/googleapiclient/_helpers.py:130\u001b[0m, in \u001b[0;36mpositional.<locals>.positional_decorator.<locals>.positional_wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m positional_parameters_enforcement \u001b[38;5;241m==\u001b[39m POSITIONAL_WARNING:\n\u001b[1;32m 129\u001b[0m logger\u001b[38;5;241m.\u001b[39mwarning(message)\n\u001b[0;32m--> 130\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/googleapiclient/discovery.py:315\u001b[0m, in \u001b[0;36mbuild\u001b[0;34m(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options, adc_cert_path, adc_key_path, num_retries, static_discovery, always_use_jwt_access)\u001b[0m\n\u001b[1;32m 303\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 304\u001b[0m content \u001b[38;5;241m=\u001b[39m _retrieve_discovery_doc(\n\u001b[1;32m 305\u001b[0m requested_url,\n\u001b[1;32m 306\u001b[0m discovery_http,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 313\u001b[0m static_discovery\u001b[38;5;241m=\u001b[39mstatic_discovery,\n\u001b[1;32m 314\u001b[0m )\n\u001b[0;32m--> 315\u001b[0m service \u001b[38;5;241m=\u001b[39m \u001b[43mbuild_from_document\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 316\u001b[0m \u001b[43m \u001b[49m\u001b[43mcontent\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 317\u001b[0m \u001b[43m \u001b[49m\u001b[43mbase\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdiscovery_url\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 318\u001b[0m \u001b[43m \u001b[49m\u001b[43mhttp\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhttp\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 319\u001b[0m \u001b[43m \u001b[49m\u001b[43mdeveloperKey\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdeveloperKey\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 320\u001b[0m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 321\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequestBuilder\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequestBuilder\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 322\u001b[0m \u001b[43m \u001b[49m\u001b[43mcredentials\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcredentials\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 323\u001b[0m \u001b[43m \u001b[49m\u001b[43mclient_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 324\u001b[0m \u001b[43m \u001b[49m\u001b[43madc_cert_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43madc_cert_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 325\u001b[0m \u001b[43m \u001b[49m\u001b[43madc_key_path\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43madc_key_path\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 326\u001b[0m \u001b[43m \u001b[49m\u001b[43malways_use_jwt_access\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43malways_use_jwt_access\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 327\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 328\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m \u001b[38;5;66;03m# exit if a service was created\u001b[39;00m\n\u001b[1;32m 329\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m HttpError \u001b[38;5;28;01mas\u001b[39;00m e:\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/googleapiclient/_helpers.py:130\u001b[0m, in \u001b[0;36mpositional.<locals>.positional_decorator.<locals>.positional_wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 128\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m positional_parameters_enforcement \u001b[38;5;241m==\u001b[39m POSITIONAL_WARNING:\n\u001b[1;32m 129\u001b[0m logger\u001b[38;5;241m.\u001b[39mwarning(message)\n\u001b[0;32m--> 130\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mwrapped\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/googleapiclient/discovery.py:616\u001b[0m, in \u001b[0;36mbuild_from_document\u001b[0;34m(service, base, future, http, developerKey, model, requestBuilder, credentials, client_options, adc_cert_path, adc_key_path, always_use_jwt_access)\u001b[0m\n\u001b[1;32m 613\u001b[0m \u001b[38;5;66;03m# If the user didn't pass in credentials, attempt to acquire application\u001b[39;00m\n\u001b[1;32m 614\u001b[0m \u001b[38;5;66;03m# default credentials.\u001b[39;00m\n\u001b[1;32m 615\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m credentials \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 616\u001b[0m credentials \u001b[38;5;241m=\u001b[39m \u001b[43m_auth\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault_credentials\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 617\u001b[0m \u001b[43m \u001b[49m\u001b[43mscopes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient_options\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mscopes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 618\u001b[0m \u001b[43m \u001b[49m\u001b[43mquota_project_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mclient_options\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mquota_project_id\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 619\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 621\u001b[0m \u001b[38;5;66;03m# Check google-api-core >= 2.18.0 if credentials' universe != \"googleapis.com\".\u001b[39;00m\n\u001b[1;32m 622\u001b[0m _check_api_core_compatible_with_credentials_universe(credentials)\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/googleapiclient/_auth.py:57\u001b[0m, in \u001b[0;36mdefault_credentials\u001b[0;34m(scopes, quota_project_id)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Returns Application Default Credentials.\"\"\"\u001b[39;00m\n\u001b[1;32m 56\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m HAS_GOOGLE_AUTH:\n\u001b[0;32m---> 57\u001b[0m credentials, _ \u001b[38;5;241m=\u001b[39m \u001b[43mgoogle\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 58\u001b[0m \u001b[43m \u001b[49m\u001b[43mscopes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mscopes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mquota_project_id\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mquota_project_id\u001b[49m\n\u001b[1;32m 59\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 60\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m credentials\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m HAS_OAUTH2CLIENT:\n",
+ "File \u001b[0;32m~/Development/AI/atomic_agents/.venv/lib/python3.10/site-packages/google/auth/_default.py:691\u001b[0m, in \u001b[0;36mdefault\u001b[0;34m(scopes, request, quota_project_id, default_scopes)\u001b[0m\n\u001b[1;32m 683\u001b[0m _LOGGER\u001b[38;5;241m.\u001b[39mwarning(\n\u001b[1;32m 684\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNo project ID could be determined. Consider running \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 685\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m`gcloud config set project` or setting the \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 686\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124menvironment variable\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 687\u001b[0m environment_vars\u001b[38;5;241m.\u001b[39mPROJECT,\n\u001b[1;32m 688\u001b[0m )\n\u001b[1;32m 689\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m credentials, effective_project_id\n\u001b[0;32m--> 691\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exceptions\u001b[38;5;241m.\u001b[39mDefaultCredentialsError(_CLOUD_SDK_MISSING_CREDENTIALS)\n",
+ "\u001b[0;31mDefaultCredentialsError\u001b[0m: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information."
+ ]
+ }
+ ],
"source": [
"video_url = input('Enter the YouTube video URL: ')\n",
"scraped_transcript = yt_scraper_tool.run(YouTubeTranscriptToolSchema(video_url=video_url))\n",
@@ -336,7 +416,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.12.3"
+ "version": "3.10.12"
}
},
"nbformat": 4,
diff --git a/examples/product_finder.py b/examples/product_finder.py
index 0570ee9..9ba7e6a 100644
--- a/examples/product_finder.py
+++ b/examples/product_finder.py
@@ -6,7 +6,7 @@ import instructor
import openai
from rich.console import Console
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfig
from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchTool, SearxNGSearchToolConfig, SearxNGSearchToolSchema
@@ -38,7 +38,7 @@ system_prompt = SystemPromptInfo(
system_prompt_generator = SystemPromptGenerator(system_prompt)
# Initialize chat memory
-memory = ChatMemory()
+memory = AgentMemory()
initial_memory = [
{'role': 'assistant', 'content': 'Hello! I\'m your product finder assistant. What kind of product are you looking for today?'}
]
diff --git a/examples/yelp_restaurant_finder.py b/examples/yelp_restaurant_finder.py
index 96a4206..7b6b7dd 100644
--- a/examples/yelp_restaurant_finder.py
+++ b/examples/yelp_restaurant_finder.py
@@ -6,7 +6,7 @@ import instructor
import openai
from rich.console import Console
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
from atomic_agents.agents.base_chat_agent import BaseChatAgent, BaseChatAgentOutputSchema, BaseChatAgentConfig
from atomic_agents.lib.tools.yelp_restaurant_finder_tool import YelpSearchTool, YelpSearchToolConfig, YelpSearchToolSchema
@@ -38,7 +38,7 @@ system_prompt = SystemPromptInfo(
system_prompt_generator = SystemPromptGenerator(system_prompt)
# Initialize chat memory to store conversation history
-memory = ChatMemory()
+memory = AgentMemory()
# Define initial memory with a greeting message from the assistant
initial_memory = [
{'role': 'assistant', 'content': 'Hello, can I help you find a restaurant?'}
diff --git a/tests/agents/test_base_chat_agent.py b/tests/agents/test_base_chat_agent.py
index c5fbfcf..6d69e24 100644
--- a/tests/agents/test_base_chat_agent.py
+++ b/tests/agents/test_base_chat_agent.py
@@ -9,7 +9,7 @@ from atomic_agents.agents.base_chat_agent import (
BaseChatAgentInputSchema,
BaseChatAgentOutputSchema,
SystemPromptGenerator,
- ChatMemory,
+ AgentMemory,
SystemPromptContextProviderBase
)
from atomic_agents.lib.components.system_prompt_generator import SystemPromptInfo
@@ -22,10 +22,10 @@ def mock_instructor():
@pytest.fixture
def mock_memory():
- mock = Mock(spec=ChatMemory)
+ mock = Mock(spec=AgentMemory)
mock.get_history.return_value = []
mock.add_message = Mock()
- mock.copy = Mock(return_value=Mock(spec=ChatMemory))
+ mock.copy = Mock(return_value=Mock(spec=AgentMemory))
return mock
@pytest.fixture
diff --git a/tests/agents/test_tool_interface_agent.py b/tests/agents/test_tool_interface_agent.py
index c093dd1..4e537c0 100644
--- a/tests/agents/test_tool_interface_agent.py
+++ b/tests/agents/test_tool_interface_agent.py
@@ -5,7 +5,7 @@ from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgent, ToolIn
from atomic_agents.agents.base_chat_agent import BaseAgentIO, BaseChatAgentConfig
from atomic_agents.lib.tools.base import BaseTool
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator, SystemPromptInfo
-from atomic_agents.lib.components.chat_memory import ChatMemory
+from atomic_agents.lib.components.agent_memory import AgentMemory
import instructor
class MockToolInputSchema(BaseAgentIO):
@@ -33,7 +33,7 @@ def mock_instructor():
@pytest.fixture
def mock_memory():
- return Mock(spec=ChatMemory)
+ return Mock(spec=AgentMemory)
@pytest.fixture
def mock_tool():
diff --git a/tests/lib/components/test_chat_memory.py b/tests/lib/components/test_chat_memory.py
index 28490af..1dc5d60 100644
--- a/tests/lib/components/test_chat_memory.py
+++ b/tests/lib/components/test_chat_memory.py
@@ -1,64 +1,64 @@
import pytest
-from atomic_agents.lib.components.chat_memory import ChatMemory, Message
+from atomic_agents.lib.components.agent_memory import AgentMemory, Message
@pytest.fixture
-def chat_memory():
- return ChatMemory(max_messages=5)
+def agent_memory():
+ return AgentMemory(max_messages=5)
-def test_initialization(chat_memory):
- assert chat_memory.history == []
- assert chat_memory.max_messages == 5
+def test_initialization(agent_memory):
+ assert agent_memory.history == []
+ assert agent_memory.max_messages == 5
-def test_add_message(chat_memory):
- chat_memory.add_message("user", "Hello")
- assert len(chat_memory.history) == 1
- assert chat_memory.history[0].role == "user"
- assert chat_memory.history[0].content == "Hello"
+def test_add_message(agent_memory):
+ agent_memory.add_message("user", "Hello")
+ assert len(agent_memory.history) == 1
+ assert agent_memory.history[0].role == "user"
+ assert agent_memory.history[0].content == "Hello"
-def test_add_message_with_tool(chat_memory):
+def test_add_message_with_tool(agent_memory):
tool_message = {
"id": "weather_1",
"type": "function",
"function": {"name": "get_weather", "arguments": '{"location": "New York"}'}
}
- chat_memory.add_message("assistant", "Checking weather", tool_message=tool_message)
- assert len(chat_memory.history) == 1
- assert chat_memory.history[0].role == "assistant"
- assert chat_memory.history[0].content == "Checking weather"
- assert chat_memory.history[0].tool_calls == [tool_message]
- assert chat_memory.history[0].tool_call_id == "weather_1"
+ agent_memory.add_message("assistant", "Checking weather", tool_message=tool_message)
+ assert len(agent_memory.history) == 1
+ assert agent_memory.history[0].role == "assistant"
+ assert agent_memory.history[0].content == "Checking weather"
+ assert agent_memory.history[0].tool_calls == [tool_message]
+ assert agent_memory.history[0].tool_call_id == "weather_1"
-def test_add_tool_response(chat_memory):
- chat_memory.add_message("tool", "Weather is sunny", tool_id="weather_1")
- assert len(chat_memory.history) == 1
- assert chat_memory.history[0].role == "tool"
- assert chat_memory.history[0].content == "Weather is sunny"
- assert chat_memory.history[0].tool_call_id == "weather_1"
+def test_add_tool_response(agent_memory):
+ agent_memory.add_message("tool", "Weather is sunny", tool_id="weather_1")
+ assert len(agent_memory.history) == 1
+ assert agent_memory.history[0].role == "tool"
+ assert agent_memory.history[0].content == "Weather is sunny"
+ assert agent_memory.history[0].tool_call_id == "weather_1"
-def test_manage_overflow(chat_memory):
+def test_manage_overflow(agent_memory):
for i in range(7):
- chat_memory.add_message("user", f"Message {i}")
- assert len(chat_memory.history) == 5
- assert chat_memory.history[0].content == "Message 2"
- assert chat_memory.history[-1].content == "Message 6"
+ agent_memory.add_message("user", f"Message {i}")
+ assert len(agent_memory.history) == 5
+ assert agent_memory.history[0].content == "Message 2"
+ assert agent_memory.history[-1].content == "Message 6"
-def test_get_history(chat_memory):
- chat_memory.add_message("user", "Hello")
- chat_memory.add_message("assistant", "Hi there")
- history = chat_memory.get_history()
+def test_get_history(agent_memory):
+ agent_memory.add_message("user", "Hello")
+ agent_memory.add_message("assistant", "Hi there")
+ history = agent_memory.get_history()
assert len(history) == 2
assert isinstance(history[0], Message)
assert history[0].role == "user"
assert history[1].role == "assistant"
def test_dump_and_load():
- original_memory = ChatMemory(max_messages=3)
+ original_memory = AgentMemory(max_messages=3)
original_memory.add_message("user", "Hello")
original_memory.add_message("assistant", "Hi there")
dumped_data = original_memory.dump()
- new_memory = ChatMemory(max_messages=3)
+ new_memory = AgentMemory(max_messages=3)
new_memory.load(dumped_data)
assert len(new_memory.history) == 2
@@ -67,27 +67,27 @@ def test_dump_and_load():
assert new_memory.history[1].role == "assistant"
assert new_memory.history[1].content == "Hi there"
-def test_copy(chat_memory):
- chat_memory.add_message("user", "Hello")
- copied_memory = chat_memory.copy()
+def test_copy(agent_memory):
+ agent_memory.add_message("user", "Hello")
+ copied_memory = agent_memory.copy()
assert len(copied_memory.history) == 1
assert copied_memory.history[0].role == "user"
assert copied_memory.history[0].content == "Hello"
- assert copied_memory.max_messages == chat_memory.max_messages
+ assert copied_memory.max_messages == agent_memory.max_messages
- chat_memory.add_message("assistant", "Hi there")
- assert len(chat_memory.history) == 2
+ agent_memory.add_message("assistant", "Hi there")
+ assert len(agent_memory.history) == 2
assert len(copied_memory.history) == 1
-def test_get_message_count(chat_memory):
- assert chat_memory.get_message_count() == 0
- chat_memory.add_message("user", "Hello")
- chat_memory.add_message("assistant", "Hi there")
- assert chat_memory.get_message_count() == 2
+def test_get_message_count(agent_memory):
+ assert agent_memory.get_message_count() == 0
+ agent_memory.add_message("user", "Hello")
+ agent_memory.add_message("assistant", "Hi there")
+ assert agent_memory.get_message_count() == 2
def test_load_with_invalid_data():
- memory = ChatMemory()
+ memory = AgentMemory()
invalid_data = [
{"role": "user", "content": "Valid message"},
{"role": "invalid_role", "content": "Invalid role"},
@@ -100,12 +100,12 @@ def test_load_with_invalid_data():
assert memory.history[1].role == "invalid_role"
assert memory.history[1].content == "Invalid role"
-def test_add_message_with_dict_content(chat_memory):
+def test_add_message_with_dict_content(agent_memory):
dict_content = {"text": "Hello", "confidence": 0.95}
- chat_memory.add_message("assistant", dict_content)
- assert len(chat_memory.history) == 1
- assert chat_memory.history[0].role == "assistant"
- assert chat_memory.history[0].content == dict_content
+ agent_memory.add_message("assistant", dict_content)
+ assert len(agent_memory.history) == 1
+ assert agent_memory.history[0].role == "assistant"
+ assert agent_memory.history[0].content == dict_content
if __name__ == "__main__":
pytest.main()