Skip to content

Building AI agents, atomically

remove output from quickstart

KennyVaneetvelde3ba02b49dc7f
diff --git a/examples/notebooks/quickstart.ipynb b/examples/notebooks/quickstart.ipynb
index ebfd5ac..3990075 100644
--- a/examples/notebooks/quickstart.ipynb
+++ b/examples/notebooks/quickstart.ipynb
@@ -36,69 +36,9 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
- "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"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# Install necessary packages\n",
"%pip install atomic-agents openai instructor jsonref"
@@ -118,7 +58,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -144,66 +84,9 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "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"
- }
- ],
+ "outputs": [],
"source": [
"system_prompt = SystemPromptInfo(\n",
" background=[\n",
@@ -236,7 +119,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -258,7 +141,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -297,18 +180,9 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"metadata": {},
- "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"
- ]
- }
- ],
+ "outputs": [],
"source": [
"print(f'Agent: {initial_memory[0][\"content\"]}')\n",
"\n",