Building AI agents, atomically
Update README.md and system_prompt_generator.py + cleanup
KennyVaneetvelde1e03b139eeee
diff --git a/.assets/what_is_sent_in_prompt.png b/.assets/what_is_sent_in_prompt.pngnew file mode 100644index 0000000..94eaca7Binary files /dev/null and b/.assets/what_is_sent_in_prompt.png differdiff --git a/README.md b/README.mdindex 1dcd53f..81f980a 100644--- a/README.md+++ b/README.md@@ -8,6 +8,7 @@ The Atomic Agents framework is designed to be modular, extensible, and easy to u<!--  --><img src="./.assets/architecture_highlevel_overview.png" alt="Atomic Agents Architecture" width="600"/>+<img src="./.assets/what_is_sent_in_prompt.png" alt="What is sent to the LLM in the prompt?" width="600"/>## InstallationTo install Atomic Agents, you can use pip:diff --git a/atomic_agents/lib/components/system_prompt_generator.py b/atomic_agents/lib/components/system_prompt_generator.pyindex 39f467d..0173811 100644--- a/atomic_agents/lib/components/system_prompt_generator.py+++ b/atomic_agents/lib/components/system_prompt_generator.py@@ -80,7 +80,7 @@ if __name__ == "__main__":output_instructions=['Provide helpful and relevant information to assist the user.','Be friendly and respectful in all interactions.',- 'Always answer in rhyming verse. Preferably in alexandrine verse.'+ 'Always answer in rhyming verse.'],context_providers={'date': CurrentDateProvider(title='Current date', format='%Y-%m-%d %H:%M:%S'),diff --git a/examples/basic_custom_chatbot.py b/examples/basic_custom_chatbot.pyindex ea75365..80d5936 100644--- a/examples/basic_custom_chatbot.py+++ b/examples/basic_custom_chatbot.py@@ -21,7 +21,7 @@ system_prompt = SystemPromptInfo(output_instructions=['Provide helpful and relevant information to assist the user.','Be friendly and respectful in all interactions.',- 'Always answer in rhyming verse. Preferably in alexandrine verse.'+ 'Always answer in rhyming verse.'])# Initialize the system prompt generator with the defined system prompt and dynamic info providersdiff --git a/examples/notebooks/quickstart.ipynb b/examples/notebooks/quickstart.ipynbindex 445f7b5..94c6c70 100644--- a/examples/notebooks/quickstart.ipynb+++ b/examples/notebooks/quickstart.ipynb@@ -11,6 +11,20 @@"[](https://colab.research.google.com/github/KennyVaneetvelde/atomic_agents/blob/main/examples/notebooks/quickstart.ipynb#)\n"]},+ {+ "cell_type": "markdown",+ "metadata": {},+ "source": [+ "# Prerequisites\n",+ "\n",+ "Before proceeding with this notebook, it is highly recommended to read up on the basics of the following libraries:\n",+ "\n",+ "- **Pydantic**: A data validation and settings management library using Python type annotations. You can find more information and documentation at [Pydantic GitHub](https://github.com/pydantic/pydantic).\n",+ "- **Instructor**: A Python library that simplifies working with structured outputs from large language models (LLMs). It provides a user-friendly API to manage validation, retries, and streaming responses. More details can be found at [Instructor GitHub](https://github.com/jxnl/instructor).\n",+ "\n",+ "Understanding these libraries will help you make the most of this library.\n"+ ]+ },{"cell_type": "markdown","metadata": {},@@ -63,7 +77,9 @@"## Step 3: Define System Prompt Information\n","\n","We will define the system prompt information including background, steps, and output instructions. This helps the chatbot understand how to respond to user inputs.\n",- "In this example, we will define a system prompt that asks the chatbot to respond to user inputs in rhyming verse."+ "In this example, we will define a system prompt that asks the chatbot to respond to user inputs in rhyming verse.\n",+ "\n",+ "The structuring of the system prompts in this library is loosely inspired by Patterns in the [Fabric library](https://github.com/danielmiessler/fabric/tree/main/patterns)."]},{@@ -156,7 +172,8 @@"source": ["## Step 6: Main Chat Loop\n","\n",- "We will create a main chat loop for testing the chat agent. This loop will allow you to interact with the chatbot in real-time."+ "We will create a main chat loop for testing the chat agent. This loop will allow you to interact with the chatbot in real-time.\n",+ "To exit the loop, type `/exit` or `/quit`."]},{diff --git a/examples/simple_yt_agent.py b/examples/simple_yt_agent.pyindex b945637..ab586e6 100644--- a/examples/simple_yt_agent.py+++ b/examples/simple_yt_agent.py@@ -6,9 +6,7 @@ from rich.console import Consolefrom rich.markdown import Markdownfrom atomic_agents.agents.base_chat_agent import BaseChatAgent-from atomic_agents.agents.tool_interface_agent import ToolInterfaceAgentfrom atomic_agents.lib.components.system_prompt_generator import SystemPromptContextProviderBase, SystemPromptGenerator, SystemPromptInfo-from atomic_agents.lib.tools.search.searx_tool import SearxNGSearchToolfrom atomic_agents.lib.tools.yt_transcript_scraper import YouTubeTranscriptTool, YouTubeTranscriptToolConfig, YouTubeTranscriptToolSchemaconsole = Console()@@ -86,7 +84,6 @@ transcript_provider.transcript = scraped_transcript.transcripttranscript_provider.duration = scraped_transcript.durationtranscript_provider.metadata = scraped_transcript.metadata-# agent.memory.add_message('assistant', 'I have successfully extracted the transcript and put it in the context of the system prompt. I will now use it to generate a detailed response following the rules and steps provided in the system prompt. Here is the output:')response = agent.run('Perform your assignment on the YouTube video transcript present in your context. Do not reply with anything other than the output of the assignment.')# Convert the ResponseModel to a dictionary and then to a Markdown string