Skip to content

Building AI agents, atomically

Modified some files in atomic-examples/

Koichi KAWAMURAc0966477c58d
diff --git a/atomic-examples/quickstart/README.md b/atomic-examples/quickstart/README.md
index 2fe4fa8..d60b9a4 100644
--- a/atomic-examples/quickstart/README.md
+++ b/atomic-examples/quickstart/README.md
@@ -7,60 +7,92 @@ This directory contains quickstart examples for the Atomic Agents project. These
To run these examples:
1. Clone the main Atomic Agents repository:
- ```
+
+ ```bash
git clone https://github.com/BrainBlend-AI/atomic-agents
```
2. Navigate to the quickstart directory:
- ```
+
+ ```bash
cd atomic-agents/atomic-examples/quickstart
```
3. Install the dependencies using Poetry:
- ```
+
+ ```bash
poetry install
```
4. Run the examples using Poetry:
- ```
+
+ ```bash
poetry run python quickstart/1_basic_chatbot.py
```
## Example Files
-### 1. Basic Chatbot (1_basic_chatbot.py)
+### 1_0. Basic Chatbot (1_0_basic_chatbot.py)
This example demonstrates a simple chatbot using the Atomic Agents framework. It includes:
+
- Setting up the OpenAI API client
- Initializing a basic agent with default configurations
- Running a chat loop where the user can interact with the agent
+### 1_1. Basic Streaming Chatbot (1_1_basic_chatbot_streaming.py)
+
+This example is similar to 1_0 but it uses `run_stream` method.
+
+### 1_2. Basic Async Streaming Chatbot (1_2_basic_chatbot_async_streaming.py)
+
+This example is similar to 1_0 but it uses an async client and `run_async_stream` method.
+
### 2. Custom Chatbot (2_basic_custom_chatbot.py)
This example shows how to create a custom chatbot with:
+
- A custom system prompt
- Customized agent configuration
- A chat loop with rhyming responses
-### 3. Custom Chatbot with Custom Schema (3_basic_custom_chatbot_with_custom_schema.py)
+### 3_0. Custom Chatbot with Custom Schema (3_0_basic_custom_chatbot_with_custom_schema.py)
This example demonstrates:
+
- Creating a custom output schema for the agent
- Implementing suggested follow-up questions in the agent's responses
- Using a custom system prompt and agent configuration
+### 3_1. Custom Streaming Chatbot with Custom Schema
+
+This example is similar to 3_0 but uses an async client and `run_async_stream` method.
+
### 4. Chatbot with Different Providers (4_basic_chatbot_different_providers.py)
This example showcases:
+
- How to use different AI providers (OpenAI, Groq, Ollama)
- Dynamically selecting a provider at runtime
- Adapting the agent configuration based on the chosen provider
+### 5. Custom System Role (5_custom_system_role_for_reasoning_models.py)
+
+This example showcases a usage of `system_role` parameter for a reasoning model.
+
+### 6_0. Asynchronous Processing (6_0_asynchronous_processing.py)
+
+This example showcases a utilization of `run_async` method for a concurrent processing of multiple data.
+
+### 6_1. Asynchronous Streaming Processing
+
+This example adds streaming to 6_0.
+
## Running the Examples
To run any of the examples, use the following command:
-```
+```bash
poetry run python quickstart/<example_file_name>.py
```
diff --git a/atomic-examples/quickstart/quickstart/1_0_basic_chatbot.py b/atomic-examples/quickstart/quickstart/1_0_basic_chatbot.py
new file mode 100644
index 0000000..0d3c577
--- /dev/null
+++ b/atomic-examples/quickstart/quickstart/1_0_basic_chatbot.py
@@ -0,0 +1,66 @@
+import os
+import instructor
+import openai
+from rich.console import Console
+from rich.panel import Panel
+from rich.text import Text
+from atomic_agents.lib.components.agent_memory import AgentMemory
+from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
+
+# API Key setup
+API_KEY = ""
+if not API_KEY:
+ API_KEY = os.getenv("OPENAI_API_KEY")
+
+if not API_KEY:
+ raise ValueError(
+ "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
+ )
+
+# Initialize a Rich Console for pretty console outputs
+console = Console()
+
+# Memory setup
+memory = AgentMemory()
+
+# Initialize memory with an initial message from the assistant
+initial_message = BaseAgentOutputSchema(chat_message="Hello! How can I assist you today?")
+memory.add_message("assistant", initial_message)
+
+# OpenAI client setup using the Instructor library
+client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
+
+# Agent setup with specified configuration
+agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
+ config=BaseAgentConfig(
+ client=client,
+ model="gpt-4o-mini",
+ memory=memory,
+ )
+)
+
+# Generate the default system prompt for the agent
+default_system_prompt = agent.system_prompt_generator.generate_prompt()
+# Display the system prompt in a styled panel
+console.print(Panel(default_system_prompt, width=console.width, style="bold cyan"), style="bold cyan")
+
+# Display the initial message from the assistant
+console.print(Text("Agent:", style="bold green"), end=" ")
+console.print(Text(initial_message.chat_message, style="bold green"))
+
+# Start an infinite loop to handle user inputs and agent responses
+while True:
+ # Prompt the user for input with a styled prompt
+ user_input = console.input("[bold blue]You:[/bold blue] ")
+ # Check if the user wants to exit the chat
+ if user_input.lower() in ["/exit", "/quit"]:
+ console.print("Exiting chat...")
+ break
+
+ # Process the user's input through the agent and get the response
+ input_schema = BaseAgentInputSchema(chat_message=user_input)
+ response = agent.run(input_schema)
+
+ agent_message = Text(response.chat_message, style="bold green")
+ console.print(Text("Agent:", style="bold green"), end=" ")
+ console.print(agent_message)
diff --git a/atomic-examples/quickstart/quickstart/1_1_basic_chatbot_streaming.py b/atomic-examples/quickstart/quickstart/1_1_basic_chatbot_streaming.py
index c5479f5..1d379c8 100644
--- a/atomic-examples/quickstart/quickstart/1_1_basic_chatbot_streaming.py
+++ b/atomic-examples/quickstart/quickstart/1_1_basic_chatbot_streaming.py
@@ -4,7 +4,6 @@ import openai
from rich.console import Console
from rich.panel import Panel
from rich.text import Text
-from rich.live import Live
from atomic_agents.lib.components.agent_memory import AgentMemory
from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
@@ -28,8 +27,8 @@ memory = AgentMemory()
initial_message = BaseAgentOutputSchema(chat_message="Hello! How can I assist you today?")
memory.add_message("assistant", initial_message)
-# OpenAI client setup using the Instructor library for async operations
-client = instructor.from_openai(openai.AsyncOpenAI(api_key=API_KEY))
+# OpenAI client setup using the Instructor library for synchronous operations
+client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
# Agent setup with specified configuration
agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
@@ -50,7 +49,11 @@ console.print(Text("Agent:", style="bold green"), end=" ")
console.print(Text(initial_message.chat_message, style="green"))
-async def main():
+def main():
+ """
+ Main function to handle the chat loop using synchronous streaming.
+ This demonstrates how to use BaseAgent.run_stream() instead of the async version.
+ """
# Start an infinite loop to handle user inputs and agent responses
while True:
# Prompt the user for input with a styled prompt
@@ -60,25 +63,36 @@ async def main():
console.print("Exiting chat...")
break
- # Process the user's input through the agent and get the streaming response
+ # Process the user's input through the agent
input_schema = BaseAgentInputSchema(chat_message=user_input)
console.print() # Add newline before response
-
- # Use Live display to show streaming response
- with Live("", refresh_per_second=10, auto_refresh=True) as live:
- current_response = ""
- # Use run_async_stream instead of run_async for streaming functionality
- async for partial_response in agent.run_async_stream(input_schema):
- if hasattr(partial_response, "chat_message") and partial_response.chat_message:
- # Only update if we have new content
- if partial_response.chat_message != current_response:
- current_response = partial_response.chat_message
- # Combine the label and response in the live display
- display_text = Text.assemble(("Agent: ", "bold green"), (current_response, "green"))
- live.update(display_text)
+ console.print(Text("Agent: ", style="bold green"), end="")
+
+ # Current display string to avoid repeating output
+ current_display = ""
+
+ # Use run_stream for synchronous streaming responses
+ for partial_response in agent.run_stream(input_schema):
+ if hasattr(partial_response, "chat_message") and partial_response.chat_message:
+ # Only output the incremental part of the message
+ new_content = partial_response.chat_message
+ if new_content != current_display:
+ # Only print the new part since the last update
+ if new_content.startswith(current_display):
+ incremental_text = new_content[len(current_display) :]
+ console.print(Text(incremental_text, style="green"), end="")
+ current_display = new_content
+ else:
+ # If there's a mismatch, print the full message
+ # (this should rarely happen with most LLMs)
+ console.print(Text(new_content, style="green"), end="")
+ current_display = new_content
+
+ # Flush to ensure output is displayed immediately
+ console.file.flush()
+
+ console.print() # Add a newline after the response is complete
if __name__ == "__main__":
- import asyncio
-
- asyncio.run(main())
+ main()
diff --git a/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_async_streaming.py b/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_async_streaming.py
new file mode 100644
index 0000000..c5479f5
--- /dev/null
+++ b/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_async_streaming.py
@@ -0,0 +1,84 @@
+import os
+import instructor
+import openai
+from rich.console import Console
+from rich.panel import Panel
+from rich.text import Text
+from rich.live import Live
+from atomic_agents.lib.components.agent_memory import AgentMemory
+from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
+
+# API Key setup
+API_KEY = ""
+if not API_KEY:
+ API_KEY = os.getenv("OPENAI_API_KEY")
+
+if not API_KEY:
+ raise ValueError(
+ "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
+ )
+
+# Initialize a Rich Console for pretty console outputs
+console = Console()
+
+# Memory setup
+memory = AgentMemory()
+
+# Initialize memory with an initial message from the assistant
+initial_message = BaseAgentOutputSchema(chat_message="Hello! How can I assist you today?")
+memory.add_message("assistant", initial_message)
+
+# OpenAI client setup using the Instructor library for async operations
+client = instructor.from_openai(openai.AsyncOpenAI(api_key=API_KEY))
+
+# Agent setup with specified configuration
+agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
+ config=BaseAgentConfig(
+ client=client,
+ model="gpt-4o-mini",
+ memory=memory,
+ )
+)
+
+# Generate the default system prompt for the agent
+default_system_prompt = agent.system_prompt_generator.generate_prompt()
+# Display the system prompt in a styled panel
+console.print(Panel(default_system_prompt, width=console.width, style="bold cyan"), style="bold cyan")
+
+# Display the initial message from the assistant
+console.print(Text("Agent:", style="bold green"), end=" ")
+console.print(Text(initial_message.chat_message, style="green"))
+
+
+async def main():
+ # Start an infinite loop to handle user inputs and agent responses
+ while True:
+ # Prompt the user for input with a styled prompt
+ user_input = console.input("\n[bold blue]You:[/bold blue] ")
+ # Check if the user wants to exit the chat
+ if user_input.lower() in ["/exit", "/quit"]:
+ console.print("Exiting chat...")
+ break
+
+ # Process the user's input through the agent and get the streaming response
+ input_schema = BaseAgentInputSchema(chat_message=user_input)
+ console.print() # Add newline before response
+
+ # Use Live display to show streaming response
+ with Live("", refresh_per_second=10, auto_refresh=True) as live:
+ current_response = ""
+ # Use run_async_stream instead of run_async for streaming functionality
+ async for partial_response in agent.run_async_stream(input_schema):
+ if hasattr(partial_response, "chat_message") and partial_response.chat_message:
+ # Only update if we have new content
+ if partial_response.chat_message != current_response:
+ current_response = partial_response.chat_message
+ # Combine the label and response in the live display
+ display_text = Text.assemble(("Agent: ", "bold green"), (current_response, "green"))
+ live.update(display_text)
+
+
+if __name__ == "__main__":
+ import asyncio
+
+ asyncio.run(main())
diff --git a/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_sync_streaming.py b/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_sync_streaming.py
index 1d379c8..e69de29 100644
--- a/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_sync_streaming.py
+++ b/atomic-examples/quickstart/quickstart/1_2_basic_chatbot_sync_streaming.py
@@ -1,98 +0,0 @@
-import os
-import instructor
-import openai
-from rich.console import Console
-from rich.panel import Panel
-from rich.text import Text
-from atomic_agents.lib.components.agent_memory import AgentMemory
-from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
-
-# API Key setup
-API_KEY = ""
-if not API_KEY:
- API_KEY = os.getenv("OPENAI_API_KEY")
-
-if not API_KEY:
- raise ValueError(
- "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
- )
-
-# Initialize a Rich Console for pretty console outputs
-console = Console()
-
-# Memory setup
-memory = AgentMemory()
-
-# Initialize memory with an initial message from the assistant
-initial_message = BaseAgentOutputSchema(chat_message="Hello! How can I assist you today?")
-memory.add_message("assistant", initial_message)
-
-# OpenAI client setup using the Instructor library for synchronous operations
-client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
-
-# Agent setup with specified configuration
-agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
- config=BaseAgentConfig(
- client=client,
- model="gpt-4o-mini",
- memory=memory,
- )
-)
-
-# Generate the default system prompt for the agent
-default_system_prompt = agent.system_prompt_generator.generate_prompt()
-# Display the system prompt in a styled panel
-console.print(Panel(default_system_prompt, width=console.width, style="bold cyan"), style="bold cyan")
-
-# Display the initial message from the assistant
-console.print(Text("Agent:", style="bold green"), end=" ")
-console.print(Text(initial_message.chat_message, style="green"))
-
-
-def main():
- """
- Main function to handle the chat loop using synchronous streaming.
- This demonstrates how to use BaseAgent.run_stream() instead of the async version.
- """
- # Start an infinite loop to handle user inputs and agent responses
- while True:
- # Prompt the user for input with a styled prompt
- user_input = console.input("\n[bold blue]You:[/bold blue] ")
- # Check if the user wants to exit the chat
- if user_input.lower() in ["/exit", "/quit"]:
- console.print("Exiting chat...")
- break
-
- # Process the user's input through the agent
- input_schema = BaseAgentInputSchema(chat_message=user_input)
- console.print() # Add newline before response
- console.print(Text("Agent: ", style="bold green"), end="")
-
- # Current display string to avoid repeating output
- current_display = ""
-
- # Use run_stream for synchronous streaming responses
- for partial_response in agent.run_stream(input_schema):
- if hasattr(partial_response, "chat_message") and partial_response.chat_message:
- # Only output the incremental part of the message
- new_content = partial_response.chat_message
- if new_content != current_display:
- # Only print the new part since the last update
- if new_content.startswith(current_display):
- incremental_text = new_content[len(current_display) :]
- console.print(Text(incremental_text, style="green"), end="")
- current_display = new_content
- else:
- # If there's a mismatch, print the full message
- # (this should rarely happen with most LLMs)
- console.print(Text(new_content, style="green"), end="")
- current_display = new_content
-
- # Flush to ensure output is displayed immediately
- console.file.flush()
-
- console.print() # Add a newline after the response is complete
-
-
-if __name__ == "__main__":
- main()
diff --git a/atomic-examples/quickstart/quickstart/1_basic_chatbot.py b/atomic-examples/quickstart/quickstart/1_basic_chatbot.py
index 0d3c577..e69de29 100644
--- a/atomic-examples/quickstart/quickstart/1_basic_chatbot.py
+++ b/atomic-examples/quickstart/quickstart/1_basic_chatbot.py
@@ -1,66 +0,0 @@
-import os
-import instructor
-import openai
-from rich.console import Console
-from rich.panel import Panel
-from rich.text import Text
-from atomic_agents.lib.components.agent_memory import AgentMemory
-from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
-
-# API Key setup
-API_KEY = ""
-if not API_KEY:
- API_KEY = os.getenv("OPENAI_API_KEY")
-
-if not API_KEY:
- raise ValueError(
- "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
- )
-
-# Initialize a Rich Console for pretty console outputs
-console = Console()
-
-# Memory setup
-memory = AgentMemory()
-
-# Initialize memory with an initial message from the assistant
-initial_message = BaseAgentOutputSchema(chat_message="Hello! How can I assist you today?")
-memory.add_message("assistant", initial_message)
-
-# OpenAI client setup using the Instructor library
-client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
-
-# Agent setup with specified configuration
-agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
- config=BaseAgentConfig(
- client=client,
- model="gpt-4o-mini",
- memory=memory,
- )
-)
-
-# Generate the default system prompt for the agent
-default_system_prompt = agent.system_prompt_generator.generate_prompt()
-# Display the system prompt in a styled panel
-console.print(Panel(default_system_prompt, width=console.width, style="bold cyan"), style="bold cyan")
-
-# Display the initial message from the assistant
-console.print(Text("Agent:", style="bold green"), end=" ")
-console.print(Text(initial_message.chat_message, style="bold green"))
-
-# Start an infinite loop to handle user inputs and agent responses
-while True:
- # Prompt the user for input with a styled prompt
- user_input = console.input("[bold blue]You:[/bold blue] ")
- # Check if the user wants to exit the chat
- if user_input.lower() in ["/exit", "/quit"]:
- console.print("Exiting chat...")
- break
-
- # Process the user's input through the agent and get the response
- input_schema = BaseAgentInputSchema(chat_message=user_input)
- response = agent.run(input_schema)
-
- agent_message = Text(response.chat_message, style="bold green")
- console.print(Text("Agent:", style="bold green"), end=" ")
- console.print(agent_message)
diff --git a/atomic-examples/quickstart/quickstart/3_basic_custom_chatbot_with_custom_schema.py b/atomic-examples/quickstart/quickstart/3_0_basic_custom_chatbot_with_custom_schema.py
similarity index 95%
rename from atomic-examples/quickstart/quickstart/3_basic_custom_chatbot_with_custom_schema.py
rename to atomic-examples/quickstart/quickstart/3_0_basic_custom_chatbot_with_custom_schema.py
index 1d74b5a..9dfb8dc 100644
--- a/atomic-examples/quickstart/quickstart/3_basic_custom_chatbot_with_custom_schema.py
+++ b/atomic-examples/quickstart/quickstart/3_0_basic_custom_chatbot_with_custom_schema.py
@@ -62,6 +62,7 @@ system_prompt_generator = SystemPromptGenerator(
"Analyze the user's input to understand the context and intent.",
"Formulate a relevant and informative response based on the assistant's knowledge.",
"Generate 3 suggested follow-up questions for the user to explore the topic further.",
+ "When you get a simple number from the user, choose the corresponding question from the last list of suggested questions and answer it. Note that the first question is 1, the second is 2, and so on."
],
output_instructions=[
"Provide clear, concise, and accurate information in response to user queries.",
diff --git a/atomic-examples/quickstart/quickstart/3_1_basic_custom_chatbot_with_custom_schema_streaming.py b/atomic-examples/quickstart/quickstart/3_1_basic_custom_chatbot_with_custom_schema_streaming.py
index a6d3983..898571a 100644
--- a/atomic-examples/quickstart/quickstart/3_1_basic_custom_chatbot_with_custom_schema_streaming.py
+++ b/atomic-examples/quickstart/quickstart/3_1_basic_custom_chatbot_with_custom_schema_streaming.py
@@ -63,6 +63,7 @@ system_prompt_generator = SystemPromptGenerator(
"Analyze the user's input to understand the context and intent.",
"Formulate a relevant and informative response based on the assistant's knowledge.",
"Generate 3 suggested follow-up questions for the user to explore the topic further.",
+ "When you get a simple number from the user, choose the corresponding question from the last list of suggested questions and answer it. Note that the first question is 1, the second is 2, and so on."
],
output_instructions=[
"Provide clear, concise, and accurate information in response to user queries.",
diff --git a/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models copy.py b/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models copy.py
index 97c6f57..e69de29 100644
--- a/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models copy.py
+++ b/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models copy.py
@@ -1,54 +0,0 @@
-import os
-import instructor
-import openai
-from rich.console import Console
-from rich.text import Text
-from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
-
-# API Key setup
-API_KEY = ""
-if not API_KEY:
- API_KEY = os.getenv("OPENAI_API_KEY")
-
-if not API_KEY:
- raise ValueError(
- "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
- )
-
-# Initialize a Rich Console for pretty console outputs
-console = Console()
-
-# OpenAI client setup using the Instructor library
-client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
-
-# System prompt generator setup
-sysyem_prompt_generator = SystemPromptGenerator(
- background=["You are a math genious."],
- steps=["Think logically step by step and solve a math problem."],
- output_instructions=["Answer in plain English plus formulas."],
-)
-# Agent setup with specified configuration
-agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
- config=BaseAgentConfig(
- client=client,
- model="o3-mini",
- sysyem_prompt_generator=sysyem_prompt_generator,
- # It is a convention to use "developer" as the system role for reasoning models from OpenAI such as o1, o3-mini.
- # Also these models are often used without a system prompt, which you can do by setting system_role=None
- system_role="developer",
- )
-)
-
-# Prompt the user for input with a styled prompt
-user_input = "Decompose this number to prime factors: 1234567890"
-console.print(Text("User:", style="bold green"), end=" ")
-console.print(user_input)
-
-# Process the user's input through the agent and get the response
-input_schema = BaseAgentInputSchema(chat_message=user_input)
-response = agent.run(input_schema)
-
-agent_message = Text(response.chat_message, style="bold green")
-console.print(Text("Agent:", style="bold green"), end=" ")
-console.print(agent_message)
diff --git a/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models.py b/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models.py
new file mode 100644
index 0000000..97c6f57
--- /dev/null
+++ b/atomic-examples/quickstart/quickstart/5_custom_system_role_for_reasoning_models.py
@@ -0,0 +1,54 @@
+import os
+import instructor
+import openai
+from rich.console import Console
+from rich.text import Text
+from atomic_agents.agents.base_agent import BaseAgent, BaseAgentConfig, BaseAgentInputSchema, BaseAgentOutputSchema
+from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
+
+# API Key setup
+API_KEY = ""
+if not API_KEY:
+ API_KEY = os.getenv("OPENAI_API_KEY")
+
+if not API_KEY:
+ raise ValueError(
+ "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
+ )
+
+# Initialize a Rich Console for pretty console outputs
+console = Console()
+
+# OpenAI client setup using the Instructor library
+client = instructor.from_openai(openai.OpenAI(api_key=API_KEY))
+
+# System prompt generator setup
+sysyem_prompt_generator = SystemPromptGenerator(
+ background=["You are a math genious."],
+ steps=["Think logically step by step and solve a math problem."],
+ output_instructions=["Answer in plain English plus formulas."],
+)
+# Agent setup with specified configuration
+agent = BaseAgent[BaseAgentInputSchema, BaseAgentOutputSchema](
+ config=BaseAgentConfig(
+ client=client,
+ model="o3-mini",
+ sysyem_prompt_generator=sysyem_prompt_generator,
+ # It is a convention to use "developer" as the system role for reasoning models from OpenAI such as o1, o3-mini.
+ # Also these models are often used without a system prompt, which you can do by setting system_role=None
+ system_role="developer",
+ )
+)
+
+# Prompt the user for input with a styled prompt
+user_input = "Decompose this number to prime factors: 1234567890"
+console.print(Text("User:", style="bold green"), end=" ")
+console.print(user_input)
+
+# Process the user's input through the agent and get the response
+input_schema = BaseAgentInputSchema(chat_message=user_input)
+response = agent.run(input_schema)
+
+agent_message = Text(response.chat_message, style="bold green")
+console.print(Text("Agent:", style="bold green"), end=" ")
+console.print(agent_message)
diff --git a/atomic-examples/quickstart/quickstart/7_asynchronous_processing.py b/atomic-examples/quickstart/quickstart/6_0_asynchronous_processing.py
similarity index 100%
rename from atomic-examples/quickstart/quickstart/7_asynchronous_processing.py
rename to atomic-examples/quickstart/quickstart/6_0_asynchronous_processing.py
diff --git a/atomic-examples/quickstart/quickstart/6_1_asynchronous_processing_streaming.py b/atomic-examples/quickstart/quickstart/6_1_asynchronous_processing_streaming.py
new file mode 100644
index 0000000..78ec17d
--- /dev/null
+++ b/atomic-examples/quickstart/quickstart/6_1_asynchronous_processing_streaming.py
@@ -0,0 +1,180 @@
+import os
+import asyncio
+import instructor
+import openai
+from rich.console import Console
+from rich.live import Live
+from rich.panel import Panel
+from rich.progress import Progress, SpinnerColumn, TextColumn, BarColumn, TimeElapsedColumn
+from rich.table import Table
+from rich.text import Text
+from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig, BaseAgentInputSchema
+from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
+
+# API Key setup
+API_KEY = ""
+if not API_KEY:
+ API_KEY = os.getenv("OPENAI_API_KEY")
+
+if not API_KEY:
+ raise ValueError(
+ "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
+ )
+
+# Initialize a Rich Console for pretty console outputs
+console = Console()
+
+# OpenAI client setup using the Instructor library
+client = instructor.from_openai(openai.AsyncOpenAI(api_key=API_KEY))
+
+
+# Define a schema for the output data
+class PersonSchema(BaseIOSchema):
+ """Schema for person information."""
+
+ name: str
+ age: int
+ pronouns: list[str]
+ profession: str
+
+
+# System prompt generator setup
+system_prompt_generator = SystemPromptGenerator(
+ background=["You parse a sentence and extract elements."],
+ steps=[],
+ output_instructions=[],
+)
+
+dataset = [
+ "My name is Mike, I am 30 years old, my pronouns are he/him, and I am a software engineer.",
+ "My name is Sarah, I am 25 years old, my pronouns are she/her, and I am a data scientist.",
+ "My name is John, I am 40 years old, my pronouns are he/him, and I am a product manager.",
+ "My name is Emily, I am 35 years old, my pronouns are she/her, and I am a UX designer.",
+ "My name is David, I am 28 years old, my pronouns are he/him, and I am a web developer.",
+ "My name is Anna, I am 32 years old, my pronouns are she/her, and I am a graphic designer.",
+]
+
+# Max concurrent requests - adjust this to see performance differences
+MAX_CONCURRENT = 3
+sem = asyncio.Semaphore(MAX_CONCURRENT)
+
+# Agent setup with specified configuration
+agent = BaseAgent[BaseAgentInputSchema, PersonSchema](
+ config=BaseAgentConfig(client=client, model="gpt-4o-mini", system_prompt_generator=system_prompt_generator)
+)
+
+
+async def exec_agent(message: str, idx: int, progress_dict: dict):
+ """Execute the agent with the provided message and update progress in real-time."""
+ # Acquire the semaphore to limit concurrent executions
+ async with sem:
+ user_input = BaseAgentInputSchema(chat_message=message)
+ agent.reset_memory()
+
+ # Track streaming progress
+ partial_data = {}
+ progress_dict[idx] = {"status": "Processing", "data": partial_data, "message": message}
+
+ partial_response = None
+ # Actually demonstrate streaming by processing each partial response
+ async for partial_response in agent.run_async_stream(user_input):
+ if partial_response:
+ # Extract any available fields from the partial response
+ response_dict = partial_response.model_dump()
+ for field in ["name", "age", "pronouns", "profession"]:
+ if field in response_dict and response_dict[field]:
+ partial_data[field] = response_dict[field]
+
+ # Update progress dictionary to display changes in real-time
+ progress_dict[idx]["data"] = partial_data.copy()
+ # Small sleep to simulate processing and make streaming more visible
+ await asyncio.sleep(0.05)
+
+ assert partial_response
+ # Final response with complete data
+ response = PersonSchema(**partial_response.model_dump())
+ progress_dict[idx]["status"] = "Complete"
+ progress_dict[idx]["data"] = response.model_dump()
+
+ return response
+
+
+def generate_status_table(progress_dict: dict) -> Table:
+ """Generate a rich table showing the current processing status."""
+ table = Table(title="Asynchronous Stream Processing Demo")
+
+ table.add_column("ID", justify="center")
+ table.add_column("Status", justify="center")
+ table.add_column("Input", style="cyan")
+ table.add_column("Current Data", style="green")
+
+ for idx, info in progress_dict.items():
+ # Format the partial data nicely
+ data_str = ""
+ if info["data"]:
+ for k, v in info["data"].items():
+ data_str += f"{k}: {v}\n"
+
+ status_style = "yellow" if info["status"] == "Processing" else "green"
+
+ # Add row with current processing information
+ table.add_row(
+ f"{idx + 1}",
+ f"[{status_style}]{info['status']}[/{status_style}]",
+ Text(info["message"][:30] + "..." if len(info["message"]) > 30 else info["message"]),
+ data_str or "Waiting..."
+ )
+
+ return table
+
+
+async def process_all(dataset: list[str]):
+ """Process all items in dataset with visual progress tracking."""
+ progress_dict = {} # Track processing status for visualization
+
+ # Create tasks for each message processing
+ tasks = []
+ for idx, message in enumerate(dataset):
+ # Initialize entry in progress dictionary
+ progress_dict[idx] = {"status": "Waiting", "data": {}, "message": message}
+ # Create task without awaiting it
+ task = asyncio.create_task(exec_agent(message, idx, progress_dict))
+ tasks.append(task)
+
+ # Display live updating status while tasks run
+ with Live(generate_status_table(progress_dict), refresh_per_second=10) as live:
+ while not all(task.done() for task in tasks):
+ # Update the live display with current progress
+ live.update(generate_status_table(progress_dict))
+ await asyncio.sleep(0.1)
+
+ # Final update after all tasks complete
+ live.update(generate_status_table(progress_dict))
+
+ # Gather all results when complete
+ responses = await asyncio.gather(*tasks)
+ return responses
+
+
+if __name__ == "__main__":
+ console.print("[bold blue]Starting Asynchronous Stream Processing Demo[/bold blue]")
+ console.print(f"Processing {len(dataset)} items with max {MAX_CONCURRENT} concurrent requests\n")
+
+ responses = asyncio.run(process_all(dataset))
+
+ # Display final results in a structured table
+ results_table = Table(title="Processing Results")
+ results_table.add_column("Name", style="cyan")
+ results_table.add_column("Age", justify="center")
+ results_table.add_column("Pronouns")
+ results_table.add_column("Profession")
+
+ for resp in responses:
+ results_table.add_row(
+ resp.name,
+ str(resp.age),
+ "/".join(resp.pronouns),
+ resp.profession
+ )
+
+ console.print(results_table)
diff --git a/atomic-examples/quickstart/quickstart/6_asynchronous_processing_streaming.py b/atomic-examples/quickstart/quickstart/6_asynchronous_processing_streaming.py
deleted file mode 100644
index f9597ba..0000000
--- a/atomic-examples/quickstart/quickstart/6_asynchronous_processing_streaming.py
+++ /dev/null
@@ -1,89 +0,0 @@
-import os
-import asyncio
-import instructor
-import openai
-from rich.console import Console
-from rich.live import Live
-from rich.text import Text
-from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig, BaseAgentInputSchema
-from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
-
-# API Key setup
-API_KEY = ""
-if not API_KEY:
- API_KEY = os.getenv("OPENAI_API_KEY")
-
-if not API_KEY:
- raise ValueError(
- "API key is not set. Please set the API key as a static variable or in the environment variable OPENAI_API_KEY."
- )
-
-# Initialize a Rich Console for pretty console outputs
-console = Console()
-
-# OpenAI client setup using the Instructor library
-client = instructor.from_openai(openai.AsyncOpenAI(api_key=API_KEY))
-
-
-# Define a schema for the output data
-class PersonSchema(BaseIOSchema):
- """Schema for person information."""
-
- name: str
- age: int
- pronouns: list[str]
- profession: str
-
-
-# System prompt generator setup
-sysyem_prompt_generator = SystemPromptGenerator(
- background=["You parse a sentence and extract elements."],
- steps=[],
- output_instructions=[],
-)
-
-dataset = [
- "My name is Mike, I am 30 years old, my pronouns are he/him, and I am a software engineer.",
- "My name is Sarah, I am 25 years old, my pronouns are she/her, and I am a data scientist.",
- "My name is John, I am 40 years old, my pronouns are he/him, and I am a product manager.",
- "My name is Emily, I am 35 years old, my pronouns are she/her, and I am a UX designer.",
- "My name is David, I am 28 years old, my pronouns are he/him, and I am a web developer.",
- "My name is Anna, I am 32 years old, my pronouns are she/her, and I am a graphic designer.",
-]
-
-sem = asyncio.Semaphore(2)
-
-# Agent setup with specified configuration
-agent = BaseAgent[BaseAgentInputSchema, PersonSchema](
- config=BaseAgentConfig(client=client, model="gpt-4o-mini", sysyem_prompt_generator=sysyem_prompt_generator)
-)
-
-
-async def exec_agent(message: str):
- """Execute the agent with the provided message."""
- user_input = BaseAgentInputSchema(chat_message=message)
- agent.reset_memory()
- partial_response = None
- async for partial_response in agent.run_async_stream(user_input):
- pass
-
- assert partial_response
- response = PersonSchema(**partial_response.model_dump())
-
- return response
-
-
-async def process(dataset: list[str]):
- """Process the dataset asynchronously."""
- async with sem:
- # Run the agent asynchronously for each message in the dataset
- # and collect the responses
- responses = await asyncio.gather(*(exec_agent(message) for message in dataset))
-
- # Prompt the user for input with a styled prompt
- return responses
-
-
-if __name__ == "__main__":
- responses = asyncio.run(process(dataset))
- console.print(f"\n[bold green]Responses: {responses}[/bold green]")
diff --git a/atomic-examples/web-search-agent/README.md b/atomic-examples/web-search-agent/README.md
index 341178d..3eedcc4 100644
--- a/atomic-examples/web-search-agent/README.md
+++ b/atomic-examples/web-search-agent/README.md
@@ -5,7 +5,7 @@ This project demonstrates an intelligent web search agent built using the Atomic
## Features
1. Query Generation: Automatically generates relevant search queries based on user input.
-2. Web Search: Utilizes SearxNG to perform web searches across multiple search engines.
+2. Web Search: Utilizes SearXNG to perform web searches across multiple search engines.
3. Question Answering: Provides detailed answers to user questions based on search results.
4. Follow-up Questions: Suggests related questions to encourage further exploration of the topic.
@@ -14,7 +14,7 @@ This project demonstrates an intelligent web search agent built using the Atomic
The Web Search Agent consists of several key components:
1. Query Agent (`query_agent.py`): Generates diverse and relevant search queries based on user input.
-2. SearxNG Search Tool (`searxng_search.py`): Performs web searches using the SearxNG meta-search engine.
+2. SearXNG Search Tool (`searxng_search.py`): Performs web searches using the SearxNG meta-search engine.
3. Question Answering Agent (`question_answering_agent.py`): Analyzes search results and provides detailed answers to user questions.
4. Main Script (`main.py`): Orchestrates the entire process, from query generation to final answer presentation.
@@ -23,30 +23,36 @@ The Web Search Agent consists of several key components:
To run the Web Search Agent:
1. Clone the Atomic Agents repository:
- ```
+
+ ```bash
git clone https://github.com/BrainBlend-AI/atomic-agents
```
-2. Navigate to the web-search-agent directory:
- ```
+1. Navigate to the web-search-agent directory:
+
+ ```bash
cd atomic-agents/atomic-examples/web-search-agent
```
-3. Install dependencies using Poetry:
- ```
+1. Install dependencies using Poetry:
+
+ ```bash
poetry install
```
-4. Set up environment variables:
+1. Set up environment variables:
Create a `.env` file in the `web-search-agent` directory with the following content:
- ```
+
+ ```bash
OPENAI_API_KEY=your_openai_api_key
SEARXNG_BASE_URL=your_searxng_instance_url
```
+
Replace `your_openai_api_key` with your actual OpenAI API key and `your_searxng_instance_url` with the URL of your SearxNG instance.
-5. Run the Web Search Agent:
- ```
+1. Run the Web Search Agent:
+
+ ```bash
poetry run python web_search_agent/main.py
```
diff --git a/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py b/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
index fd5342f..8797017 100644
--- a/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
+++ b/atomic-examples/web-search-agent/web_search_agent/agents/question_answering_agent.py
@@ -36,7 +36,6 @@ question_answering_agent = BaseAgent[QuestionAnsweringAgentInputSchema, Question
],
steps=[
"You will receive a question and the context information.",
- "Generate a detailed and accurate answer based on the context.",
"Provide up to 3 relevant references (HTTP URLs) used in formulating the answer.",
"Generate up to 3 follow-up questions related to the answer.",
],
diff --git a/atomic-examples/web-search-agent/web_search_agent/main.py b/atomic-examples/web-search-agent/web_search_agent/main.py
index cd2ed3a..dfc73ea 100644
--- a/atomic-examples/web-search-agent/web_search_agent/main.py
+++ b/atomic-examples/web-search-agent/web_search_agent/main.py
@@ -12,6 +12,7 @@ from web_search_agent.tools.searxng_search import (
SearxNGSearchTool,
SearxNGSearchToolConfig,
SearxNGSearchToolInputSchema,
+ SearxNGSearchToolOutputSchema
)
from web_search_agent.agents.query_agent import QueryAgentInputSchema, query_agent
@@ -32,6 +33,15 @@ memory = AgentMemory()
search_tool = SearxNGSearchTool(config=SearxNGSearchToolConfig(base_url=os.getenv("SEARXNG_BASE_URL"), max_results=5))
+class SearchResultsProvider(SystemPromptContextProviderBase):
+ def __init__(self, title: str, search_results: SearxNGSearchToolOutputSchema|Exception):
+ super().__init__(title=title)
+ self.search_results = search_results
+
+ def get_info(self) -> str:
+ return f"{self.title}: {self.search_results}"
+
+
# Define input/output schemas for the main agent
class MainAgentInputSchema(BaseIOSchema):
"""Input schema for the main agent."""
@@ -57,32 +67,25 @@ agent = BaseAgent[MainAgentInputSchema, MainAgentOutputSchema](
# Example usage
instruction = "Tell me about the Atomic Agents AI agent framework."
num_queries = 3
+console.print(f"[bold blue]Instruction:[/bold blue] {instruction}")
-# Generate queries using the query agent
-query_input = QueryAgentInputSchema(instruction=instruction, num_queries=num_queries)
-generated_queries = query_agent.run(query_input)
-
-console.print("[bold blue]Generated Queries:[/bold blue]")
-for query in generated_queries.queries:
- console.print(f"- {query}")
-
-# Perform searches using the generated queries
-search_input = SearxNGSearchToolInputSchema(queries=generated_queries.queries, category="general")
+while True:
+ # Generate queries using the query agent
+ query_input = QueryAgentInputSchema(instruction=instruction, num_queries=num_queries)
+ generated_queries = query_agent.run(query_input)
+ console.print("[bold blue]Generated Queries:[/bold blue]")
+ for query in generated_queries.queries:
+ console.print(f"- {query}")
-class SearchResultsProvider(SystemPromptContextProviderBase):
- def __init__(self, title: str):
- super().__init__(title=title)
- self.search_results = []
-
- def get_info(self) -> str:
- return f"SEARCH RESULTS: {self.search_results}"
+ # Perform searches using the generated queries
+ search_input = SearxNGSearchToolInputSchema(queries=generated_queries.queries, category="general")
-
-try:
- search_results = search_tool.run(search_input)
- search_results_provider = SearchResultsProvider(title="Search Results")
- search_results_provider.search_results = search_results
+ try:
+ search_results = search_tool.run(search_input)
+ search_results_provider = SearchResultsProvider("Search Results", search_results)
+ except Exception as e:
+ search_results_provider = SearchResultsProvider("Search Failed", e)
question_answering_agent.register_context_provider("search results", search_results_provider)
@@ -102,8 +105,21 @@ try:
# Print follow-up questions
console.print("\n[bold blue]Follow-up Questions:[/bold blue]")
- for question in answer.followup_questions:
- console.print(f"- {question}")
+ for i, question in enumerate(answer.followup_questions, 1):
+ console.print(f"[cyan]{i}. {question}[/cyan]")
+
+ console.print() # Add an empty line for better readability
+ instruction = console.input("[bold blue]You:[/bold blue] ")
+ if instruction.lower() in ["/exit", "/quit"]:
+ console.print("Exiting chat...")
+ break
+
+ try:
+ followup_question_id = int(instruction.strip())
+ if 1 <= followup_question_id <= len(answer.followup_questions):
+ instruction = answer.followup_questions[followup_question_id - 1]
+ console.print(f"[bold blue]Follow-up Question:[/bold blue] {instruction}")
+ except ValueError:
+ pass
+
-except Exception as e:
- console.print(f"[bold red]Error:[/bold red] {str(e)}")
diff --git a/poetry.lock b/poetry.lock
index 2fd0336..2195a5d 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 2.0.1 and should not be changed by hand.
+# This file is automatically @generated by Poetry 2.1.2 and should not be changed by hand.
[[package]]
name = "aiohappyeyeballs"
@@ -106,7 +106,6 @@ files = [
[package.dependencies]
aiohappyeyeballs = ">=2.3.0"
aiosignal = ">=1.1.2"
-async-timeout = {version = ">=4.0,<6.0", markers = "python_version < \"3.11\""}
attrs = ">=17.3.0"
frozenlist = ">=1.1.1"
multidict = ">=4.5,<7.0"
@@ -114,7 +113,7 @@ propcache = ">=0.2.0"
yarl = ">=1.17.0,<2.0"
[package.extras]
-speedups = ["Brotli", "aiodns (>=3.2.0)", "brotlicffi"]
+speedups = ["Brotli ; platform_python_implementation == \"CPython\"", "aiodns (>=3.2.0) ; sys_platform == \"linux\" or sys_platform == \"darwin\"", "brotlicffi ; platform_python_implementation != \"CPython\""]
[[package]]
name = "aiosignal"
@@ -168,29 +167,15 @@ files = [
]
[package.dependencies]
-exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""}
idna = ">=2.8"
sniffio = ">=1.1"
typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""}
[package.extras]
doc = ["Sphinx (>=8.2,<9.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"]
-test = ["anyio[trio]", "blockbuster (>=1.5.23)", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"]
+test = ["anyio[trio]", "blockbuster (>=1.5.23)", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1) ; python_version >= \"3.10\"", "uvloop (>=0.21) ; platform_python_implementation == \"CPython\" and platform_system != \"Windows\" and python_version < \"3.14\""]
trio = ["trio (>=0.26.1)"]
-[[package]]
-name = "async-timeout"
-version = "5.0.1"
-description = "Timeout context manager for asyncio programs"
-optional = false
-python-versions = ">=3.8"
-groups = ["main"]
-markers = "python_version < \"3.11\""
-files = [
- {file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"},
- {file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"},
-]
-
[[package]]
name = "attrs"
version = "25.3.0"
@@ -204,12 +189,12 @@ files = [
]
[package.extras]
-benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"]
-cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"]
-dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit-uv", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"]
+benchmark = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
+cov = ["cloudpickle ; platform_python_implementation == \"CPython\"", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
+dev = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pre-commit-uv", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier"]
-tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"]
-tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"]
+tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
+tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\""]
[[package]]
name = "babel"
@@ -224,7 +209,7 @@ files = [
]
[package.extras]
-dev = ["backports.zoneinfo", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata"]
+dev = ["backports.zoneinfo ; python_version < \"3.9\"", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata ; sys_platform == \"win32\""]
[[package]]
name = "black"
@@ -264,8 +249,6 @@ mypy-extensions = ">=0.4.3"
packaging = ">=22.0"
pathspec = ">=0.9.0"
platformdirs = ">=2"
-tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
-typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
@@ -488,11 +471,8 @@ files = [
{file = "coverage-7.8.0.tar.gz", hash = "sha256:7a3d62b3b03b4b6fd41a085f3574874cf946cb4604d2b4d3e8dca8cd570ca501"},
]
-[package.dependencies]
-tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
-
[package.extras]
-toml = ["tomli"]
+toml = ["tomli ; python_full_version <= \"3.11.0a6\""]
[[package]]
name = "distro"
@@ -530,22 +510,6 @@ files = [
{file = "docutils-0.20.1.tar.gz", hash = "sha256:f08a4e276c3a1583a86dce3e34aba3fe04d02bba2dd51ed16106244e8a923e3b"},
]
-[[package]]
-name = "exceptiongroup"
-version = "1.2.2"
-description = "Backport of PEP 654 (exception groups)"
-optional = false
-python-versions = ">=3.7"
-groups = ["main", "dev"]
-markers = "python_version < \"3.11\""
-files = [
- {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
- {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
-]
-
-[package.extras]
-test = ["pytest (>=6)"]
-
[[package]]
name = "flake8"
version = "7.2.0"
@@ -709,7 +673,7 @@ gitdb = ">=4.0.1,<5"
[package.extras]
doc = ["sphinx (>=7.1.2,<7.2)", "sphinx-autodoc-typehints", "sphinx_rtd_theme"]
-test = ["coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar", "typing-extensions"]
+test = ["coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock ; python_version < \"3.8\"", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar", "typing-extensions ; python_version < \"3.11\""]
[[package]]
name = "h11"
@@ -764,7 +728,7 @@ httpcore = "==1.*"
idna = "*"
[package.extras]
-brotli = ["brotli", "brotlicffi"]
+brotli = ["brotli ; platform_python_implementation == \"CPython\"", "brotlicffi ; platform_python_implementation != \"CPython\""]
cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (==1.*)"]
@@ -1307,9 +1271,6 @@ files = [
{file = "multidict-6.4.3.tar.gz", hash = "sha256:3ada0b058c9f213c5f95ba301f922d402ac234f1111a7d8fd70f1b99f3c281ec"},
]
-[package.dependencies]
-typing-extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""}
-
[[package]]
name = "mypy-extensions"
version = "1.0.0"
@@ -1588,7 +1549,7 @@ typing-extensions = ">=4.12.2"
[package.extras]
email = ["email-validator (>=2.0.0)"]
-timezone = ["tzdata"]
+timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""]
[[package]]
name = "pydantic-core"
@@ -1780,11 +1741,9 @@ files = [
[package.dependencies]
colorama = {version = "*", markers = "sys_platform == \"win32\""}
-exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
pluggy = ">=1.5,<2"
-tomli = {version = ">=1", markers = "python_version < \"3.11\""}
[package.extras]
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
@@ -1942,7 +1901,6 @@ files = [
[package.dependencies]
markdown-it-py = ">=2.2.0"
pygments = ">=2.13.0,<3.0.0"
-typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.11\""}
[package.extras]
jupyter = ["ipywidgets (>=7.5.1,<9)"]
@@ -2024,7 +1982,6 @@ sphinxcontrib-htmlhelp = ">=2.0.0"
sphinxcontrib-jsmath = "*"
sphinxcontrib-qthelp = "*"
sphinxcontrib-serializinghtml = ">=1.1.9"
-tomli = {version = ">=2", markers = "python_version < \"3.11\""}
[package.extras]
docs = ["sphinxcontrib-websupport"]
@@ -2307,50 +2264,7 @@ rich = ">=13.3.3"
typing-extensions = ">=4.4.0,<5.0.0"
[package.extras]
-syntax = ["tree-sitter (>=0.23.0)", "tree-sitter-bash (>=0.23.0)", "tree-sitter-css (>=0.23.0)", "tree-sitter-go (>=0.23.0)", "tree-sitter-html (>=0.23.0)", "tree-sitter-java (>=0.23.0)", "tree-sitter-javascript (>=0.23.0)", "tree-sitter-json (>=0.24.0)", "tree-sitter-markdown (>=0.3.0)", "tree-sitter-python (>=0.23.0)", "tree-sitter-regex (>=0.24.0)", "tree-sitter-rust (>=0.23.0)", "tree-sitter-sql (>=0.3.0)", "tree-sitter-toml (>=0.6.0)", "tree-sitter-xml (>=0.7.0)", "tree-sitter-yaml (>=0.6.0)"]
-
-[[package]]
-name = "tomli"
-version = "2.2.1"
-description = "A lil' TOML parser"
-optional = false
-python-versions = ">=3.8"
-groups = ["dev"]
-markers = "python_full_version <= \"3.11.0a6\""
-files = [
- {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
- {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
- {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
- {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
- {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
- {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
- {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
- {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
- {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
- {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
- {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
- {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
- {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
- {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
- {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
- {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
- {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
- {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
- {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
- {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
- {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
- {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
- {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
- {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
- {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
- {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
- {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
- {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
- {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
- {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
- {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
- {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
-]
+syntax = ["tree-sitter (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-bash (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-css (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-go (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-html (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-java (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-javascript (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-json (>=0.24.0) ; python_version >= \"3.9\"", "tree-sitter-markdown (>=0.3.0) ; python_version >= \"3.9\"", "tree-sitter-python (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-regex (>=0.24.0) ; python_version >= \"3.9\"", "tree-sitter-rust (>=0.23.0) ; python_version >= \"3.9\"", "tree-sitter-sql (>=0.3.0) ; python_version >= \"3.9\"", "tree-sitter-toml (>=0.6.0) ; python_version >= \"3.9\"", "tree-sitter-xml (>=0.7.0) ; python_version >= \"3.9\"", "tree-sitter-yaml (>=0.6.0) ; python_version >= \"3.9\""]
[[package]]
name = "tqdm"
@@ -2447,7 +2361,7 @@ files = [
]
[package.extras]
-brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"]
+brotli = ["brotli (>=1.0.9) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=0.8.0) ; platform_python_implementation != \"CPython\""]
h2 = ["h2 (>=4,<5)"]
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
zstd = ["zstandard (>=0.18.0)"]
@@ -2467,10 +2381,9 @@ files = [
[package.dependencies]
click = ">=7.0"
h11 = ">=0.8"
-typing-extensions = {version = ">=4.0", markers = "python_version < \"3.11\""}
[package.extras]
-standard = ["colorama (>=0.4)", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1)", "watchfiles (>=0.13)", "websockets (>=10.4)"]
+standard = ["colorama (>=0.4) ; sys_platform == \"win32\"", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.14.0,!=0.15.0,!=0.15.1) ; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"", "watchfiles (>=0.13)", "websockets (>=10.4)"]
[[package]]
name = "watchfiles"
@@ -2756,5 +2669,5 @@ propcache = ">=0.2.1"
[metadata]
lock-version = "2.1"
-python-versions = ">=3.10,<4.0"
-content-hash = "dd7d03bb9246eec54e41d2fa0760e584569771af59dbceb2b93eef48df3e30d0"
+python-versions = ">=3.12,<4.0"
+content-hash = "5ab9b8575cf91633aeb5be29b5ee31dcf4d072ff3de4b21f7c602a6280e9e4cf"