-
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor asset organization and enhance documentation:
- Moved asset files from `atomic-agents/.assets/` to `.assets/`. - Created a new `DEV_GUIDE.md` for contributing instructions, including setup and testing guidelines. (still under construction) - Updated `README.md` to reflect changes in installation instructions, usage examples, and improved content on the framework's features. - Revised quickstart examples in `atomic-examples/quickstart/README.md` to clarify setup and execution. - Refined dependencies in `pyproject.toml` files, ensuring compatibility and removing unnecessary ones.
- Loading branch information
1 parent
0645c36
commit 9d38d26
Showing
11 changed files
with
182 additions
and
46 deletions.
There are no files selected for viewing
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1. Fork the repository | ||
2. Create a new branch (`git checkout -b feature-branch`) | ||
3. Make your changes | ||
4. Commit your changes (`git commit -m 'Add some feature'`) | ||
5. Push to the branch (`git push origin feature-branch`) | ||
6. Open a pull request | ||
|
||
## Formatting and Linting | ||
To format & lint the code before committing, you must run the following two commands: | ||
|
||
`black atomic_agents` | ||
|
||
`flake8 atomic_agents` | ||
|
||
|
||
## Testing | ||
To run the tests, run the following command: | ||
`pytest --cov atomic_agents` | ||
|
||
To view the coverage report, run the following command: | ||
`coverage html` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,99 @@ | ||
# NOTICE: | ||
A NEW VERSION OF ATOMIC AGENTS IS UNDER DEVELOPMENT. THIS README IS OUTDATED. | ||
CHECK BACK SOON FOR AN UPDATE. | ||
|
||
# Atomic Agents | ||
<img src="./.assets/logo.png" alt="Atomic Agents" width="600"/> | ||
|
||
[](https://badge.fury.io/py/atomic-agents) | ||
|
||
A versatile framework designed to facilitate the creation and management of intelligent agents, with an optional CLI tool. | ||
The Atomic Agents framework is designed to be modular, extensible, and easy to use. The main goal of the framework is to get rid of redundant complexity, unnecessary abstractions, and hidden assumptions while still providing a flexible and powerful framework for building AI applications through atomicity. The resulting framework provides a set of tools and agents that can be combined to create powerful applications. The framework is built on top of [Instructor](https://github.com/jxnl/instructor) and leverages the power of [Pydantic](https://docs.pydantic.dev/latest/) for data/schema validation and serialization. | ||
|
||
<!--  --> | ||
<img src="./.assets/architecture_highlevel_overview.png" alt="High-level architecture overview of Atomic Agents" width="600"/> | ||
<img src="./.assets/what_is_sent_in_prompt.png" alt="Diagram showing what is sent to the LLM in the prompt" width="600"/> | ||
|
||
## Installation | ||
To install Atomic Agents, you can use pip: | ||
|
||
```bash | ||
pip install atomic-agents | ||
``` | ||
|
||
This also installs the CLI *Atomic Assembler* which can be used to download Tools (and soon also Agents and Pipelines). | ||
|
||
## Quickstart & Examples | ||
A complete list of examples can be found in the [examples](./atomic-examples/) directory. | ||
|
||
We do our best to thoroughly document each example, but if something is unclear, please don't hesitate to open an issue or a pull request in order to improve the documentation. | ||
|
||
Here's a quick snippet demonstrating how easy it is to create a powerful agent with Atomic Agents: | ||
|
||
```python | ||
# Define a custom output schema | ||
class CustomOutputSchema(BaseIOSchema): | ||
chat_message: str = Field(..., description="The chat message from the agent.") | ||
suggested_questions: List[str] = Field(..., description="Suggested follow-up questions.") | ||
|
||
# Set up the system prompt | ||
system_prompt_generator = SystemPromptGenerator( | ||
background=["This assistant is knowledgeable, helpful, and suggests follow-up questions."], | ||
steps=[ | ||
"Analyze the user's input to understand the context and intent.", | ||
"Formulate a relevant and informative response.", | ||
"Generate 3 suggested follow-up questions for the user." | ||
], | ||
output_instructions=[ | ||
"Provide clear and concise information in response to user queries.", | ||
"Conclude each response with 3 relevant suggested questions for the user." | ||
] | ||
) | ||
|
||
# Initialize the agent | ||
agent = BaseAgent( | ||
config=BaseAgentConfig( | ||
client=your_openai_client, # Replace with your actual client | ||
model="gpt-4", | ||
system_prompt_generator=system_prompt_generator, | ||
memory=AgentMemory(), | ||
output_schema=CustomOutputSchema | ||
) | ||
) | ||
|
||
# Use the agent | ||
response = agent.run(user_input) | ||
print(f"Agent: {response.chat_message}") | ||
print("Suggested questions:") | ||
for question in response.suggested_questions: | ||
print(f"- {question}") | ||
``` | ||
|
||
This snippet showcases how to create a customizable agent that responds to user queries and suggests follow-up questions. For full, runnable examples, please refer to the following files in the `atomic-examples/quickstart/quickstart/` directory: | ||
|
||
- [1_basic_chatbot.py](./atomic-examples/quickstart/quickstart/1_basic_chatbot.py): A minimal chatbot example to get you started. | ||
- [2_basic_custom_chatbot.py](./atomic-examples/quickstart/quickstart/2_basic_custom_chatbot.py): A more advanced example with a custom system prompt. | ||
- [3_basic_custom_chatbot_with_custom_schema.py](./atomic-examples/quickstart/quickstart/3_basic_custom_chatbot_with_custom_schema.py): A more advanced example with a custom output schema. | ||
- [4_basic_chatbot_different_providers.py](./atomic-examples/quickstart/quickstart/4_basic_chatbot_different_providers.py): Demonstrates how to use different providers like Ollama or Groq. | ||
|
||
These examples provide a great starting point for understanding and using Atomic Agents. | ||
|
||
You can install Atomic Agents with different options: | ||
## Running the CLI | ||
To run the CLI simply run the following command: | ||
|
||
- Full installation (framework + CLI): | ||
```bash | ||
pip install atomic-agents | ||
``` | ||
```bash | ||
atomic | ||
``` | ||
|
||
- Core framework only: | ||
```bash | ||
pip install atomic-agents[core] | ||
``` | ||
After running this command you should be presented with a menu, allowing you to download Tools. | ||
<img src="./.assets/atomic-cli.png" alt="Atomic CLI menu" width="400"/> | ||
|
||
- CLI tool only: | ||
```bash | ||
pip install atomic-agents[cli] | ||
``` | ||
## Provider & Model Compatibility | ||
Atomic Agents depends on the [Instructor](https://github.com/jxnl/instructor) package. This means that in all examples where OpenAI is used, any other API supported by Instructor can be used, such as Ollama, Groq, Mistral, Cohere, Anthropic, Gemini, and more. For a complete list please refer to the instructor documentation on its [GitHub page](https://github.com/jxnl/instructor). | ||
|
||
## Getting Started | ||
## Contributing | ||
We welcome contributions! Please follow these steps to contribute: | ||
|
||
### Prerequisites | ||
- Python 3.10 or later | ||
See the [Developer Guide](./DEV_GUIDE.md) for more information on how to contribute to Atomic Agents. | ||
|
||
### Installation | ||
## License | ||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
|
||
1. Either install the Atomic Agents package through pip, or locally from source: | ||
```bash | ||
pip install atomic-agents | ||
``` | ||
or | ||
```bash | ||
cd atomic-agents | ||
pip install -e . | ||
``` | ||
## Star History | ||
|
||
2. Install the Atomic Assembler CLI. This is optional, but it provides a convenient way to grab new Atomic Tools from the [Atomic Forge](atomic-forge): | ||
```bash | ||
pip install atomic-assembler | ||
``` | ||
[](https://star-history.com/#BrainBlend-AI/atomic-agents&Date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Atomic Agents Quickstart Examples | ||
|
||
This directory contains quickstart examples for the Atomic Agents project. These examples demonstrate various features and capabilities of the Atomic Agents framework. | ||
|
||
## Getting Started | ||
|
||
To run these examples: | ||
|
||
1. Clone the main Atomic Agents repository: | ||
``` | ||
git clone https://github.com/BrainBlend-AI/atomic-agents | ||
``` | ||
|
||
2. Navigate to the quickstart directory: | ||
``` | ||
cd atomic-agents/atomic-examples/quickstart | ||
``` | ||
|
||
3. Install the dependencies using Poetry: | ||
``` | ||
poetry install | ||
``` | ||
|
||
4. Run the examples using Poetry: | ||
``` | ||
poetry run python quickstart/1_basic_chatbot.py | ||
``` | ||
|
||
## Example Files | ||
|
||
### 1. Basic Chatbot (1_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 | ||
|
||
### 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) | ||
|
||
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 | ||
|
||
### 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 | ||
|
||
## Running the Examples | ||
|
||
To run any of the examples, use the following command: | ||
|
||
``` | ||
poetry run python quickstart/<example_file_name>.py | ||
``` | ||
|
||
Replace `<example_file_name>` with the name of the example you want to run (e.g., `1_basic_chatbot.py`). | ||
|
||
These examples provide a great starting point for understanding and working with the Atomic Agents framework. Feel free to modify and experiment with them to learn more about the capabilities of Atomic Agents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters