Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Adds notebook for recursive example
elijahbenizzy741f8b0eb043
diff --git a/__init__.py b/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/examples/recursive/application.py b/examples/recursive/application.pyindex 1e53b9f7..f4281d51 100644--- a/examples/recursive/application.py+++ b/examples/recursive/application.py@@ -37,7 +37,8 @@ def write(state: State) -> Tuple[dict, State]:feedback = state.get("feedback")parts = [- f'You are an AI poet. Create a {poem_type} poem on the following subject: "{poem_subject}".'+ f'You are an AI poet. Create a {poem_type} poem on the following subject: "{poem_subject}". '+ "It is absolutely imperative that you respond with only the poem and no other text."]if current_draft:diff --git a/notebook.ipynb b/notebook.ipynbnew file mode 100644index 00000000..64df0e75--- /dev/null+++ b/notebook.ipynb@@ -0,0 +1,666 @@+{+ "cells": [+ {+ "cell_type": "code",+ "execution_count": 8,+ "id": "d3e3fc61-0b15-488f-916c-a68851a54c55",+ "metadata": {+ "scrolled": true+ },+ "outputs": [+ {+ "name": "stdout",+ "output_type": "stream",+ "text": [+ "Requirement already satisfied: pypdf2 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (3.0.1)\n",+ "\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3.11 -m pip install --upgrade pip\u001b[0m\n",+ "Note: you may need to restart the kernel to use updated packages.\n",+ "Requirement already satisfied: sentence-transformers in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (2.7.0)\n",+ "Requirement already satisfied: transformers<5.0.0,>=4.34.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (4.40.2)\n",+ "Requirement already satisfied: tqdm in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (4.66.1)\n",+ "Requirement already satisfied: torch>=1.11.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (2.3.0)\n",+ "Requirement already satisfied: numpy in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (1.26.3)\n",+ "Requirement already satisfied: scikit-learn in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (1.4.2)\n",+ "Requirement already satisfied: scipy in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (1.13.0)\n",+ "Requirement already satisfied: huggingface-hub>=0.15.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (0.23.0)\n",+ "Requirement already satisfied: Pillow in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sentence-transformers) (10.2.0)\n",+ "Requirement already satisfied: filelock in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (3.13.1)\n",+ "Requirement already satisfied: fsspec>=2023.5.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (2024.5.0)\n",+ "Requirement already satisfied: packaging>=20.9 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (23.2)\n",+ "Requirement already satisfied: pyyaml>=5.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (6.0.1)\n",+ "Requirement already satisfied: requests in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (2.31.0)\n",+ "Requirement already satisfied: typing-extensions>=3.7.4.3 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from huggingface-hub>=0.15.1->sentence-transformers) (4.9.0)\n",+ "Requirement already satisfied: sympy in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from torch>=1.11.0->sentence-transformers) (1.12)\n",+ "Requirement already satisfied: networkx in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from torch>=1.11.0->sentence-transformers) (3.2.1)\n",+ "Requirement already satisfied: jinja2 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from torch>=1.11.0->sentence-transformers) (3.1.3)\n",+ "Requirement already satisfied: regex!=2019.12.17 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers) (2023.12.25)\n",+ "Requirement already satisfied: tokenizers<0.20,>=0.19 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers) (0.19.1)\n",+ "Requirement already satisfied: safetensors>=0.4.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from transformers<5.0.0,>=4.34.0->sentence-transformers) (0.4.3)\n",+ "Requirement already satisfied: joblib>=1.2.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from scikit-learn->sentence-transformers) (1.4.0)\n",+ "Requirement already satisfied: threadpoolctl>=2.0.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from scikit-learn->sentence-transformers) (3.4.0)\n",+ "Requirement already satisfied: MarkupSafe>=2.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from jinja2->torch>=1.11.0->sentence-transformers) (2.1.4)\n",+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from requests->huggingface-hub>=0.15.1->sentence-transformers) (3.3.2)\n",+ "Requirement already satisfied: idna<4,>=2.5 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from requests->huggingface-hub>=0.15.1->sentence-transformers) (3.6)\n",+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from requests->huggingface-hub>=0.15.1->sentence-transformers) (2.0.7)\n",+ "Requirement already satisfied: certifi>=2017.4.17 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from requests->huggingface-hub>=0.15.1->sentence-transformers) (2023.11.17)\n",+ "Requirement already satisfied: mpmath>=0.19 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from sympy->torch>=1.11.0->sentence-transformers) (1.3.0)\n",+ "\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3.11 -m pip install --upgrade pip\u001b[0m\n",+ "Note: you may need to restart the kernel to use updated packages.\n",+ "Collecting qdrant-client\n",+ " Obtaining dependency information for qdrant-client from https://files.pythonhosted.org/packages/5c/1c/551dac58a8be76820b3eb72b190191337686f75fbee5d738657bca4bd812/qdrant_client-1.9.1-py3-none-any.whl.metadata\n",+ " Downloading qdrant_client-1.9.1-py3-none-any.whl.metadata (9.5 kB)\n",+ "Collecting grpcio>=1.41.0 (from qdrant-client)\n",+ " Obtaining dependency information for grpcio>=1.41.0 from https://files.pythonhosted.org/packages/a4/83/c3a8480f170894c132ef00450ab11ed5c86ae047c54fd7b7faf6a53475c7/grpcio-1.63.0-cp311-cp311-macosx_10_9_universal2.whl.metadata\n",+ " Downloading grpcio-1.63.0-cp311-cp311-macosx_10_9_universal2.whl.metadata (3.2 kB)\n",+ "Collecting grpcio-tools>=1.41.0 (from qdrant-client)\n",+ " Obtaining dependency information for grpcio-tools>=1.41.0 from https://files.pythonhosted.org/packages/1a/a1/42970349bb7cbf1a222cb996e6cff1a5ec6ba68e871bb38b8a5c98378428/grpcio_tools-1.63.0-cp311-cp311-macosx_10_9_universal2.whl.metadata\n",+ " Downloading grpcio_tools-1.63.0-cp311-cp311-macosx_10_9_universal2.whl.metadata (5.3 kB)\n",+ "Requirement already satisfied: httpx[http2]>=0.20.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from qdrant-client) (0.26.0)\n",+ "Requirement already satisfied: numpy>=1.21 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from qdrant-client) (1.26.3)\n",+ "Collecting portalocker<3.0.0,>=2.7.0 (from qdrant-client)\n",+ " Obtaining dependency information for portalocker<3.0.0,>=2.7.0 from https://files.pythonhosted.org/packages/17/9e/87671efcca80ba6203811540ed1f9c0462c1609d2281d7b7f53cef05da3d/portalocker-2.8.2-py3-none-any.whl.metadata\n",+ " Downloading portalocker-2.8.2-py3-none-any.whl.metadata (8.5 kB)\n",+ "Requirement already satisfied: pydantic>=1.10.8 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from qdrant-client) (2.6.0)\n",+ "Requirement already satisfied: urllib3<3,>=1.26.14 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from qdrant-client) (2.0.7)\n",+ "Collecting protobuf<6.0dev,>=5.26.1 (from grpcio-tools>=1.41.0->qdrant-client)\n",+ " Obtaining dependency information for protobuf<6.0dev,>=5.26.1 from https://files.pythonhosted.org/packages/1e/40/2eb2bf643d4b060b1602a25748b48d75431f4951be2470f8ae136952b3d3/protobuf-5.26.1-cp37-abi3-macosx_10_9_universal2.whl.metadata\n",+ " Downloading protobuf-5.26.1-cp37-abi3-macosx_10_9_universal2.whl.metadata (592 bytes)\n",+ "Requirement already satisfied: setuptools in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from grpcio-tools>=1.41.0->qdrant-client) (68.2.2)\n",+ "Requirement already satisfied: anyio in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpx[http2]>=0.20.0->qdrant-client) (4.2.0)\n",+ "Requirement already satisfied: certifi in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpx[http2]>=0.20.0->qdrant-client) (2023.11.17)\n",+ "Requirement already satisfied: httpcore==1.* in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpx[http2]>=0.20.0->qdrant-client) (1.0.2)\n",+ "Requirement already satisfied: idna in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpx[http2]>=0.20.0->qdrant-client) (3.6)\n",+ "Requirement already satisfied: sniffio in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpx[http2]>=0.20.0->qdrant-client) (1.3.0)\n",+ "Collecting h2<5,>=3 (from httpx[http2]>=0.20.0->qdrant-client)\n",+ " Obtaining dependency information for h2<5,>=3 from https://files.pythonhosted.org/packages/2a/e5/db6d438da759efbb488c4f3fbdab7764492ff3c3f953132efa6b9f0e9e53/h2-4.1.0-py3-none-any.whl.metadata\n",+ " Downloading h2-4.1.0-py3-none-any.whl.metadata (3.6 kB)\n",+ "Requirement already satisfied: h11<0.15,>=0.13 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from httpcore==1.*->httpx[http2]>=0.20.0->qdrant-client) (0.14.0)\n",+ "Requirement already satisfied: annotated-types>=0.4.0 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from pydantic>=1.10.8->qdrant-client) (0.6.0)\n",+ "Requirement already satisfied: pydantic-core==2.16.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from pydantic>=1.10.8->qdrant-client) (2.16.1)\n",+ "Requirement already satisfied: typing-extensions>=4.6.1 in /Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages (from pydantic>=1.10.8->qdrant-client) (4.9.0)\n",+ "Collecting hyperframe<7,>=6.0 (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client)\n",+ " Obtaining dependency information for hyperframe<7,>=6.0 from https://files.pythonhosted.org/packages/d7/de/85a784bcc4a3779d1753a7ec2dee5de90e18c7bcf402e71b51fcf150b129/hyperframe-6.0.1-py3-none-any.whl.metadata\n",+ " Downloading hyperframe-6.0.1-py3-none-any.whl.metadata (2.7 kB)\n",+ "Collecting hpack<5,>=4.0 (from h2<5,>=3->httpx[http2]>=0.20.0->qdrant-client)\n",+ " Obtaining dependency information for hpack<5,>=4.0 from https://files.pythonhosted.org/packages/d5/34/e8b383f35b77c402d28563d2b8f83159319b509bc5f760b15d60b0abf165/hpack-4.0.0-py3-none-any.whl.metadata\n",+ " Downloading hpack-4.0.0-py3-none-any.whl.metadata (2.5 kB)\n",+ "Downloading qdrant_client-1.9.1-py3-none-any.whl (229 kB)\n",+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m229.3/229.3 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m[36m0:00:01\u001b[0m[36m0:00:01\u001b[0m01\u001b[0m\n",+ "\u001b[?25hDownloading grpcio-1.63.0-cp311-cp311-macosx_10_9_universal2.whl (10.1 MB)\n",+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m10.1/10.1 MB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m36m0:00:01\u001b[0m\n",+ "\u001b[?25hDownloading grpcio_tools-1.63.0-cp311-cp311-macosx_10_9_universal2.whl (5.3 MB)\n",+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.3/5.3 MB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m0:01\u001b[0m:01\u001b[0m\n",+ "\u001b[?25hDownloading portalocker-2.8.2-py3-none-any.whl (17 kB)\n",+ "Using cached h2-4.1.0-py3-none-any.whl (57 kB)\n",+ "Downloading protobuf-5.26.1-cp37-abi3-macosx_10_9_universal2.whl (404 kB)\n",+ "\u001b[2K \u001b[38;2;114;156;31m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m404.0/404.0 kB\u001b[0m \u001b[31m2.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0mm eta \u001b[36m0:00:01\u001b[0m0:01\u001b[0m\n",+ "\u001b[?25hUsing cached hpack-4.0.0-py3-none-any.whl (32 kB)\n",+ "Using cached hyperframe-6.0.1-py3-none-any.whl (12 kB)\n",+ "Installing collected packages: protobuf, portalocker, hyperframe, hpack, grpcio, h2, grpcio-tools, qdrant-client\n",+ " Attempting uninstall: protobuf\n",+ " Found existing installation: protobuf 4.25.2\n",+ " Uninstalling protobuf-4.25.2:\n",+ " Successfully uninstalled protobuf-4.25.2\n",+ "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",+ "streamlit 1.31.0 requires protobuf<5,>=3.20, but you have protobuf 5.26.1 which is incompatible.\u001b[0m\u001b[31m\n",+ "\u001b[0mSuccessfully installed grpcio-1.63.0 grpcio-tools-1.63.0 h2-4.1.0 hpack-4.0.0 hyperframe-6.0.1 portalocker-2.8.2 protobuf-5.26.1 qdrant-client-1.9.1\n",+ "\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",+ "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3.11 -m pip install --upgrade pip\u001b[0m\n",+ "Note: you may need to restart the kernel to use updated packages.\n"+ ]+ }+ ],+ "source": [+ "%pip install pypdf2\n",+ "%pip install sentence-transformers\n",+ "%pip install qdrant-client"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "70ae1209-71d2-4cb2-8e35-ab4c20d00daf",+ "metadata": {},+ "outputs": [],+ "source": []+ },+ {+ "cell_type": "code",+ "execution_count": 10,+ "id": "51221206-72ec-44e8-b17d-c46870a9debf",+ "metadata": {},+ "outputs": [+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "dc142927780e4ac58dc33e93aa692818",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "model.safetensors: 58%|#####7 | 52.4M/90.9M [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "ce13ef23bf904e71b4e0ea0887c25b6d",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "tokenizer_config.json: 0%| | 0.00/350 [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "5269d335ef2747648a16d80f756faee5",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "vocab.txt: 0%| | 0.00/232k [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "c4491fffad3449f19e6ea74536452188",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "tokenizer.json: 0%| | 0.00/466k [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "06e4b57568584bc898d3af97ee398246",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "special_tokens_map.json: 0%| | 0.00/112 [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ },+ {+ "data": {+ "application/vnd.jupyter.widget-view+json": {+ "model_id": "1fe0c96378fd456f9ef95e60da5553ab",+ "version_major": 2,+ "version_minor": 0+ },+ "text/plain": [+ "1_Pooling/config.json: 0%| | 0.00/190 [00:00<?, ?B/s]"+ ]+ },+ "metadata": {},+ "output_type": "display_data"+ }+ ],+ "source": [+ "# %%\n",+ "import copy\n",+ "import os\n",+ "import base64\n",+ "\n",+ "import openai\n",+ "import PyPDF2\n",+ "import textwrap\n",+ "from io import BytesIO\n",+ "\n",+ "from burr.core import Application, ApplicationBuilder, State, Result\n",+ "from burr.core.action import action, default, expr, when\n",+ "from burr.lifecycle import LifecycleAdapter\n",+ "from burr.tracking import LocalTrackingClient\n",+ "\n",+ "# %%\n",+ "from pydantic import BaseModel, Field\n",+ "\n",+ "\n",+ "class InputType(BaseModel):\n",+ " prompt: str | None = None\n",+ " document: bytes| str | None = Field(default=None, description=\"Binary PDF content\")\n",+ "\n",+ "# %%\n",+ "@action(reads=[], writes=[\"prompt\", \"document_ingest\"])\n",+ "def process_input(state: State, input: InputType) -> tuple[dict, State]:\n",+ " # TODO: raise and exception if input is invalid\n",+ "\n",+ " return (\n",+ " {\"prompt\": input.prompt, \"document_ingest\": input.document},\n",+ " state.update(prompt=input.prompt, document_ingest=input.document),\n",+ " )\n",+ "\n",+ "# %%\n",+ "@action(reads=[\"prompt\"], writes=[\"vector_results\"])\n",+ "def query_vector(state: State) -> tuple[dict, State]:\n",+ " vector_results = []\n",+ " return {\"vector_results\": vector_results}, state.update(\n",+ " vector_results=vector_results\n",+ " )\n",+ "\n",+ "\n",+ "@action(reads=[\"prompt\", \"vector_results\"], writes=[\"full_prompt\"])\n",+ "def generate_prompt(state: State) -> tuple[dict, State]:\n",+ " prompt = state[\"prompt\"]\n",+ " vector_results = state[\"vector_results\"]\n",+ "\n",+ " full_prompt = prompt + str(vector_results)\n",+ " return {\"full_prompt\": full_prompt}, state.update(full_prompt=full_prompt)\n",+ "\n",+ "\n",+ "def _get_openai_client():\n",+ " return openai.Client()\n",+ "\n",+ "\n",+ "@action(reads=[\"full_prompt\"], writes=[\"response\"])\n",+ "def prompt_response(\n",+ " state: State,\n",+ " model: str = \"gpt-4o\",\n",+ ") -> tuple[dict, State]:\n",+ " client = _get_openai_client()\n",+ " prompt = state[\"full_prompt\"]\n",+ " result = client.chat.completions.create(\n",+ " model=model,\n",+ " messages=[\n",+ " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",+ " {\"role\": \"user\", \"content\": prompt},\n",+ " ],\n",+ " )\n",+ " response = result.choices[0].message.content\n",+ " return {\"response\": response}, state.update(response=response)\n",+ "\n",+ "# %%\n",+ "import uuid\n",+ "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",+ "from sentence_transformers import SentenceTransformer\n",+ "\n",+ "from qdrant_client import QdrantClient\n",+ "from qdrant_client.http import models\n",+ "\n",+ "embeddings_model = SentenceTransformer(\n",+ " os.environ.get(\"embeddings_model\") or \"all-MiniLM-L6-v2\"\n",+ ")\n",+ "embeddings_dimension = 384\n",+ "\n",+ "\n",+ "@action(reads=[\"document_ingest\"], writes=[\"chunk_document\"])\n",+ "def chunk_document(state: State) -> tuple[dict, State]:\n",+ " document_base64 = state[\"document_ingest\"]\n",+ " document_bytes = base64.b64decode(document_base64)\n",+ " # Read PDF content\n",+ " pdf_reader = PyPDF2.PdfReader(BytesIO(document_bytes))\n",+ " pdf_text = \"\"\n",+ " for page in pdf_reader.pages:\n",+ " pdf_text += page.extract_text()\n",+ " \n",+ " # Initialize the text splitter\n",+ " text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)\n",+ " \n",+ " # Split the text into chunks\n",+ " chunks = text_splitter.split_text(pdf_text)\n",+ " \n",+ " # Update state with chunks\n",+ " return {\"chunk_document\" : chunks}, state.update(chunk_document=chunks)\n",+ "\n",+ "@action(reads=[\"chunk_document\"], writes=[\"doc_embeddings\"])\n",+ "def get_embeddings(state: State) -> tuple[dict, State]:\n",+ " chunks = state[\"chunk_document\"]\n",+ "\n",+ " embeddings_model = SentenceTransformer(os.environ.get(\"embeddings_model\") or \"all-MiniLM-L6-v2\")\n",+ " \n",+ " points = []\n",+ " for doc_id, chunk in enumerate(chunks):\n",+ " chunk_id = uuid.uuid5(uuid.NAMESPACE_DNS, f\"{doc_id}_1\")\n",+ "\n",+ " # TODO: Fix this so that the vector output is of the format PointStruct expects\n",+ " vector = embeddings_model.encode([chunk])[0]\n",+ " vector = vector.tolist()\n",+ "\n",+ " points.append(\n",+ " models.PointStruct(\n",+ " id=str(chunk_id),\n",+ " payload={\n",+ " \"metadata\": {\n",+ " # \"tenant_id\": app_config.app_id,\n",+ " # \"title\": chunk.metadata[\"title\"],\n",+ " # \"source\": chunk.metadata[\"source\"],\n",+ " \"chunk_id\": chunk_id,\n",+ " \"doc_id\": doc_id,\n",+ " },\n",+ " \"content\": chunk,\n",+ " },\n",+ " vector=vector,\n",+ " )\n",+ " )\n",+ " # Update state with embeddings\n",+ " return {\"doc_embeddings\" : points}, state.update(doc_embeddings=points)\n",+ "\n",+ "\n",+ "@action(reads=[\"doc_embeddings\"], writes=[\"db_success\"])\n",+ "def embeddings_to_db(state: State) -> tuple[dict, State]:\n",+ " embeddings = state[\"doc_embeddings\"]\n",+ " \n",+ " # Initialize Qdrant client\n",+ " qdrant_host = os.environ.get(\"QDRANT_HOST\", \"localhost\") # 49.13.162.67\n",+ " qdrant_port = int(os.environ.get(\"QDRANT_PORT\", \"6333\"))\n",+ " client = QdrantClient(host=qdrant_host, port=qdrant_port)\n",+ " \n",+ " # Define the collection name\n",+ " collection_name = os.environ.get(\"QDRANT_COLLECTION\", \"embeddings_collection\")\n",+ " if not client.collection_exists(\"{collection_name}\"):\n",+ " client.create_collection(\n",+ " collection_name=\"{collection_name}\",\n",+ " vectors_config=models.VectorParams(size=embeddings_dimension, distance=models.Distance.COSINE),\n",+ " )\n",+ "\n",+ " # Insert points into the collection\n",+ " response = client.upsert(\n",+ " collection_name=\"{collection_name}\",\n",+ " points=embeddings,\n",+ " )\n",+ " \n",+ " # Update state with success status\n",+ " return {\"db_success\" : response}, state.update(db_success=response)\n",+ "\n",+ "\n",+ "@action(reads=[\"db_success\"], writes=[\"db_response\"])\n",+ "def ingest_response(state: State) -> tuple[dict, State]:\n",+ " db_success = state[\"db_success\"]\n",+ " \n",+ " if db_success.status == \"completed\":\n",+ " message = \"Embeddings successfully ingested into Qdrant.\"\n",+ " else:\n",+ " message = \"Failed to ingest embeddings into Qdrant.\"\n",+ " \n",+ " return {\"db_response\" : message}, state.update(db_response=message)\n",+ "\n",+ "# %%\n",+ "app = (ApplicationBuilder()\n",+ " .with_actions(process_input, query_vector, generate_prompt, prompt_response, chunk_document, get_embeddings, embeddings_to_db, ingest_response)\n",+ " .with_transitions(\n",+ " # Furst chain\n",+ " (\"process_input\", \"query_vector\", expr(\"prompt is not None\")),\n",+ " (\"query_vector\", \"generate_prompt\"),\n",+ " (\"generate_prompt\", \"prompt_response\"),\n",+ " # Second chain\n",+ " (\"process_input\", \"chunk_document\", expr(\"document_ingest is not None\")),\n",+ " (\"chunk_document\", \"get_embeddings\"),\n",+ " (\"get_embeddings\", \"embeddings_to_db\"),\n",+ " (\"embeddings_to_db\", \"ingest_response\"),\n",+ " )\n",+ " .with_entrypoint(\"process_input\")\n",+ " .with_tracker(project=\"pfd_rag\")\n",+ " .build()\n",+ ")"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": 13,+ "id": "f57eff00-486e-450d-bc7c-e4551c5b0e76",+ "metadata": {},+ "outputs": [+ {+ "name": "stderr",+ "output_type": "stream",+ "text": [+ "\n",+ "********************************************************************************\n",+ "-------------------------------------------------------------------\n",+ "Oh no an error! Need help with Burr?\n",+ "Join our discord and ask for help! https://discord.gg/4FxBMyzW5n\n",+ "-------------------------------------------------------------------\n",+ "> Action: `embeddings_to_db` encountered an error!<\n",+ "> State (at time of action):\n",+ "{'__PRIOR_STEP': 'get_embeddings',\n",+ " '__SEQUENCE_ID': 3,\n",+ " 'chunk_document': \"['AOA Form No. 1 10 (Rev. 10/13 ) - Copyright 2010...\",\n",+ " 'doc_embeddings': \"[PointStruct(id='29d77b6e-893a-51b8-916e-fa0c963b4...\",\n",+ " 'document_ingest': \"'JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0Zpb...\",\n",+ " 'prompt': None}\n",+ "> Inputs (at time of action):\n",+ "{'input': \"InputType(prompt=None, document='JVBERi0xLjMKJcTl8...\"}\n",+ "********************************************************************************\n",+ "Traceback (most recent call last):\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_exceptions.py\", line 10, in map_exceptions\n",+ " yield\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_backends/sync.py\", line 206, in connect_tcp\n",+ " sock = socket.create_connection(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py\", line 851, in create_connection\n",+ " raise exceptions[0]\n",+ " File \"/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py\", line 836, in create_connection\n",+ " sock.connect(sa)\n",+ "ConnectionRefusedError: [Errno 61] Connection refused\n",+ "\n",+ "The above exception was the direct cause of the following exception:\n",+ "\n",+ "Traceback (most recent call last):\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py\", line 67, in map_httpcore_exceptions\n",+ " yield\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py\", line 231, in handle_request\n",+ " resp = self._pool.handle_request(req)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py\", line 268, in handle_request\n",+ " raise exc\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py\", line 251, in handle_request\n",+ " response = connection.handle_request(request)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py\", line 99, in handle_request\n",+ " raise exc\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py\", line 76, in handle_request\n",+ " stream = self._connect(request)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py\", line 124, in _connect\n",+ " stream = self._network_backend.connect_tcp(**kwargs)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_backends/sync.py\", line 205, in connect_tcp\n",+ " with map_exceptions(exc_map):\n",+ " File \"/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py\", line 155, in __exit__\n",+ " self.gen.throw(typ, value, traceback)\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_exceptions.py\", line 14, in map_exceptions\n",+ " raise to_exc(exc) from exc\n",+ "httpcore.ConnectError: [Errno 61] Connection refused\n",+ "\n",+ "The above exception was the direct cause of the following exception:\n",+ "\n",+ "Traceback (most recent call last):\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py\", line 103, in send_inner\n",+ " response = self._client.send(request)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py\", line 915, in send\n",+ " response = self._send_handling_auth(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py\", line 943, in _send_handling_auth\n",+ " response = self._send_handling_redirects(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py\", line 980, in _send_handling_redirects\n",+ " response = self._send_single_request(request)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py\", line 1016, in _send_single_request\n",+ " response = transport.handle_request(request)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py\", line 230, in handle_request\n",+ " with map_httpcore_exceptions():\n",+ " File \"/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py\", line 155, in __exit__\n",+ " self.gen.throw(typ, value, traceback)\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py\", line 84, in map_httpcore_exceptions\n",+ " raise mapped_exc(message) from exc\n",+ "httpx.ConnectError: [Errno 61] Connection refused\n",+ "\n",+ "During handling of the above exception, another exception occurred:\n",+ "\n",+ "Traceback (most recent call last):\n",+ " File \"/Users/elijahbenizzy/dev/dagworks/os/burr/burr/core/application.py\", line 375, in _step\n",+ " result, new_state = _run_single_step_action(next_action, self._state, action_inputs)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/dev/dagworks/os/burr/burr/core/application.py\", line 219, in _run_single_step_action\n",+ " result, new_state = action.run_and_update(state, **inputs)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/dev/dagworks/os/burr/burr/core/action.py\", line 472, in run_and_update\n",+ " return self._fn(state, **self._bound_params, **run_kwargs)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/var/folders/dq/sgyvfntx2h16h_7l7csqp_sr0000gn/T/ipykernel_34961/2756764752.py\", line 151, in embeddings_to_db\n",+ " if not client.collection_exists(\"{collection_name}\"):\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/qdrant_client.py\", line 1591, in collection_exists\n",+ " return self._client.collection_exists(collection_name=collection_name, **kwargs)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py\", line 2063, in collection_exists\n",+ " result: Optional[models.CollectionExistence] = self.http.collections_api.collection_exists(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api/collections_api.py\", line 1157, in collection_exists\n",+ " return self._build_for_collection_exists(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api/collections_api.py\", line 87, in _build_for_collection_exists\n",+ " return self.api_client.request(\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py\", line 76, in request\n",+ " return self.send(request, type_)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py\", line 93, in send\n",+ " response = self.middleware(request, self.send_inner)\n",+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py\", line 202, in __call__\n",+ " return call_next(request)\n",+ " ^^^^^^^^^^^^^^^^^^\n",+ " File \"/Users/elijahbenizzy/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py\", line 105, in send_inner\n",+ " raise ResponseHandlingException(e)\n",+ "qdrant_client.http.exceptions.ResponseHandlingException: [Errno 61] Connection refused\n"+ ]+ },+ {+ "ename": "ResponseHandlingException",+ "evalue": "[Errno 61] Connection refused",+ "output_type": "error",+ "traceback": [+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",+ "\u001b[0;31mConnectionRefusedError\u001b[0m Traceback (most recent call last)",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_exceptions.py:10\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 10\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc: \u001b[38;5;66;03m# noqa: PIE786\u001b[39;00m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_backends/sync.py:206\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address, socket_options)\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[0;32m--> 206\u001b[0m sock \u001b[38;5;241m=\u001b[39m \u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 211\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m option \u001b[38;5;129;01min\u001b[39;00m socket_options:\n",+ "File \u001b[0;32m/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py:851\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, all_errors)\u001b[0m\n\u001b[1;32m 850\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m all_errors:\n\u001b[0;32m--> 851\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exceptions[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 852\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ExceptionGroup(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcreate_connection failed\u001b[39m\u001b[38;5;124m\"\u001b[39m, exceptions)\n",+ "File \u001b[0;32m/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py:836\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, all_errors)\u001b[0m\n\u001b[1;32m 835\u001b[0m sock\u001b[38;5;241m.\u001b[39mbind(source_address)\n\u001b[0;32m--> 836\u001b[0m \u001b[43msock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43msa\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 837\u001b[0m \u001b[38;5;66;03m# Break explicitly a reference cycle\u001b[39;00m\n",+ "\u001b[0;31mConnectionRefusedError\u001b[0m: [Errno 61] Connection refused",+ "\nThe above exception was the direct cause of the following exception:\n",+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py:67\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 67\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py:231\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[0;32m--> 231\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 233\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:268\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 267\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresponse_closed(status)\n\u001b[0;32m--> 268\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 269\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:251\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 250\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 251\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[1;32m 253\u001b[0m \u001b[38;5;66;03m# The ConnectionNotAvailable exception is a special case, that\u001b[39;00m\n\u001b[1;32m 254\u001b[0m \u001b[38;5;66;03m# indicates we need to retry the request on a new connection.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[38;5;66;03m# might end up as an HTTP/2 connection, but which actually ends\u001b[39;00m\n\u001b[1;32m 259\u001b[0m \u001b[38;5;66;03m# up as HTTP/1.1.\u001b[39;00m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py:99\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connect_failed \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m---> 99\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 100\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mis_available():\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py:76\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 75\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 76\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 78\u001b[0m ssl_object \u001b[38;5;241m=\u001b[39m stream\u001b[38;5;241m.\u001b[39mget_extra_info(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mssl_object\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_sync/connection.py:124\u001b[0m, in \u001b[0;36mHTTPConnection._connect\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mconnect_tcp\u001b[39m\u001b[38;5;124m\"\u001b[39m, logger, request, kwargs) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[0;32m--> 124\u001b[0m stream \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_network_backend\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect_tcp\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 125\u001b[0m trace\u001b[38;5;241m.\u001b[39mreturn_value \u001b[38;5;241m=\u001b[39m stream\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_backends/sync.py:205\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address, socket_options)\u001b[0m\n\u001b[1;32m 200\u001b[0m exc_map: ExceptionMapping \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 201\u001b[0m socket\u001b[38;5;241m.\u001b[39mtimeout: ConnectTimeout,\n\u001b[1;32m 202\u001b[0m \u001b[38;5;167;01mOSError\u001b[39;00m: ConnectError,\n\u001b[1;32m 203\u001b[0m }\n\u001b[0;32m--> 205\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43mexc_map\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 206\u001b[0m \u001b[43m \u001b[49m\u001b[43msock\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 208\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 209\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 210\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:155\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 154\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 155\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 156\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 159\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpcore/_exceptions.py:14\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(exc, from_exc):\n\u001b[0;32m---> 14\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m to_exc(exc) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n",+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused",+ "\nThe above exception was the direct cause of the following exception:\n",+ "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py:103\u001b[0m, in \u001b[0;36mApiClient.send_inner\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 103\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 104\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py:915\u001b[0m, in \u001b[0;36mClient.send\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 913\u001b[0m auth \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_build_request_auth(request, auth)\n\u001b[0;32m--> 915\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_auth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 916\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 917\u001b[0m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 918\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 919\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 920\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 921\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py:943\u001b[0m, in \u001b[0;36mClient._send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 942\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 943\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_handling_redirects\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 944\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 945\u001b[0m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 946\u001b[0m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhistory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 947\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 948\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py:980\u001b[0m, in \u001b[0;36mClient._send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 978\u001b[0m hook(request)\n\u001b[0;32m--> 980\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_send_single_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 981\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_client.py:1016\u001b[0m, in \u001b[0;36mClient._send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1015\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request\u001b[38;5;241m=\u001b[39mrequest):\n\u001b[0;32m-> 1016\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mtransport\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1018\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py:230\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 218\u001b[0m req \u001b[38;5;241m=\u001b[39m httpcore\u001b[38;5;241m.\u001b[39mRequest(\n\u001b[1;32m 219\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 220\u001b[0m url\u001b[38;5;241m=\u001b[39mhttpcore\u001b[38;5;241m.\u001b[39mURL(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 228\u001b[0m extensions\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 229\u001b[0m )\n\u001b[0;32m--> 230\u001b[0m \u001b[43m\u001b[49m\u001b[38;5;28;43;01mwith\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mmap_httpcore_exceptions\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 231\u001b[0m \u001b[43m \u001b[49m\u001b[43mresp\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m/opt/homebrew/Cellar/[email protected]/3.11.6/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py:155\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 154\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 155\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgen\u001b[38;5;241m.\u001b[39mthrow(typ, value, traceback)\n\u001b[1;32m 156\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 159\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/httpx/_transports/default.py:84\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 83\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(exc)\n\u001b[0;32m---> 84\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m mapped_exc(message) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n",+ "\u001b[0;31mConnectError\u001b[0m: [Errno 61] Connection refused",+ "\nDuring handling of the above exception, another exception occurred:\n",+ "\u001b[0;31mResponseHandlingException\u001b[0m Traceback (most recent call last)",+ "Cell \u001b[0;32mIn[13], line 13\u001b[0m\n\u001b[1;32m 10\u001b[0m doc \u001b[38;5;241m=\u001b[39m InputType(prompt\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, document\u001b[38;5;241m=\u001b[39mpdf_base64)\n\u001b[1;32m 11\u001b[0m \u001b[38;5;66;03m# doc = InputType(prompt=\"What is CRM?\", document=None)\u001b[39;00m\n\u001b[0;32m---> 13\u001b[0m \u001b[43mapp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43minputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m{\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43minput\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mdoc\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhalt_after\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mprompt_response\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mingest_response\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;66;03m# %%\u001b[39;00m\n\u001b[1;32m 16\u001b[0m app\u001b[38;5;241m.\u001b[39mvisualize(include_conditions\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, include_state\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, \u001b[38;5;28mformat\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpng\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/telemetry.py:273\u001b[0m, in \u001b[0;36mcapture_function_usage.<locals>.wrapped_fn\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 270\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(call_fn)\n\u001b[1;32m 271\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapped_fn\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 272\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 273\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcall_fn\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 274\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 275\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_telemetry_enabled():\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:694\u001b[0m, in \u001b[0;36mApplication.run\u001b[0;34m(self, halt_before, halt_after, inputs)\u001b[0m\n\u001b[1;32m 692\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 693\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 694\u001b[0m \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mgen\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 695\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mStopIteration\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 696\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m e\u001b[38;5;241m.\u001b[39mvalue\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:639\u001b[0m, in \u001b[0;36mApplication.iterate\u001b[0;34m(self, halt_before, halt_after, inputs)\u001b[0m\n\u001b[1;32m 636\u001b[0m prior_action: Optional[Action] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 637\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhas_next_action():\n\u001b[1;32m 638\u001b[0m \u001b[38;5;66;03m# self.step will only return None if there is no next action, so we can rely on tuple unpacking\u001b[39;00m\n\u001b[0;32m--> 639\u001b[0m prior_action, result, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstep\u001b[49m\u001b[43m(\u001b[49m\u001b[43minputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 640\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m prior_action, result, state\n\u001b[1;32m 641\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_should_halt_iterate(halt_before, halt_after, prior_action):\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:346\u001b[0m, in \u001b[0;36mApplication.step\u001b[0;34m(self, inputs)\u001b[0m\n\u001b[1;32m 343\u001b[0m \u001b[38;5;66;03m# we need to increment the sequence before we start computing\u001b[39;00m\n\u001b[1;32m 344\u001b[0m \u001b[38;5;66;03m# that way if we're replaying from state, we don't get stuck\u001b[39;00m\n\u001b[1;32m 345\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_increment_sequence_id()\n\u001b[0;32m--> 346\u001b[0m out \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_step\u001b[49m\u001b[43m(\u001b[49m\u001b[43minputs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minputs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_run_hooks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 347\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m out\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:387\u001b[0m, in \u001b[0;36mApplication._step\u001b[0;34m(self, inputs, _run_hooks)\u001b[0m\n\u001b[1;32m 385\u001b[0m exc \u001b[38;5;241m=\u001b[39m e\n\u001b[1;32m 386\u001b[0m logger\u001b[38;5;241m.\u001b[39mexception(_format_error_message(next_action, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_state, inputs))\n\u001b[0;32m--> 387\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 388\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[1;32m 389\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m _run_hooks:\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:375\u001b[0m, in \u001b[0;36mApplication._step\u001b[0;34m(self, inputs, _run_hooks)\u001b[0m\n\u001b[1;32m 373\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 374\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m next_action\u001b[38;5;241m.\u001b[39msingle_step:\n\u001b[0;32m--> 375\u001b[0m result, new_state \u001b[38;5;241m=\u001b[39m \u001b[43m_run_single_step_action\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnext_action\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_state\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maction_inputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 376\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 377\u001b[0m result \u001b[38;5;241m=\u001b[39m _run_function(\n\u001b[1;32m 378\u001b[0m next_action, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_state, action_inputs, name\u001b[38;5;241m=\u001b[39mnext_action\u001b[38;5;241m.\u001b[39mname\n\u001b[1;32m 379\u001b[0m )\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/application.py:219\u001b[0m, in \u001b[0;36m_run_single_step_action\u001b[0;34m(action, state, inputs)\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;66;03m# TODO -- guard all reads/writes with a subset of the state\u001b[39;00m\n\u001b[1;32m 218\u001b[0m action\u001b[38;5;241m.\u001b[39mvalidate_inputs(inputs)\n\u001b[0;32m--> 219\u001b[0m result, new_state \u001b[38;5;241m=\u001b[39m \u001b[43maction\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_and_update\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43minputs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 220\u001b[0m _validate_result(result, action\u001b[38;5;241m.\u001b[39mname)\n\u001b[1;32m 221\u001b[0m out \u001b[38;5;241m=\u001b[39m result, _state_update(state, new_state)\n",+ "File \u001b[0;32m~/dev/dagworks/os/burr/burr/core/action.py:472\u001b[0m, in \u001b[0;36mFunctionBasedAction.run_and_update\u001b[0;34m(self, state, **run_kwargs)\u001b[0m\n\u001b[1;32m 471\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun_and_update\u001b[39m(\u001b[38;5;28mself\u001b[39m, state: State, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mrun_kwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mtuple\u001b[39m[\u001b[38;5;28mdict\u001b[39m, State]:\n\u001b[0;32m--> 472\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_fn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_bound_params\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mrun_kwargs\u001b[49m\u001b[43m)\u001b[49m\n",+ "Cell \u001b[0;32mIn[10], line 151\u001b[0m, in \u001b[0;36membeddings_to_db\u001b[0;34m(state)\u001b[0m\n\u001b[1;32m 149\u001b[0m \u001b[38;5;66;03m# Define the collection name\u001b[39;00m\n\u001b[1;32m 150\u001b[0m collection_name \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39menviron\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mQDRANT_COLLECTION\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124membeddings_collection\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m--> 151\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[43mclient\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcollection_exists\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;132;43;01m{collection_name}\u001b[39;49;00m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 152\u001b[0m client\u001b[38;5;241m.\u001b[39mcreate_collection(\n\u001b[1;32m 153\u001b[0m collection_name\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{collection_name}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 154\u001b[0m vectors_config\u001b[38;5;241m=\u001b[39mmodels\u001b[38;5;241m.\u001b[39mVectorParams(size\u001b[38;5;241m=\u001b[39membeddings_dimension, distance\u001b[38;5;241m=\u001b[39mmodels\u001b[38;5;241m.\u001b[39mDistance\u001b[38;5;241m.\u001b[39mCOSINE),\n\u001b[1;32m 155\u001b[0m )\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# Insert points into the collection\u001b[39;00m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/qdrant_client.py:1591\u001b[0m, in \u001b[0;36mQdrantClient.collection_exists\u001b[0;34m(self, collection_name, **kwargs)\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Check whether collection already exists\u001b[39;00m\n\u001b[1;32m 1582\u001b[0m \n\u001b[1;32m 1583\u001b[0m \u001b[38;5;124;03mArgs:\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1587\u001b[0m \u001b[38;5;124;03m True if collection exists, False if not\u001b[39;00m\n\u001b[1;32m 1588\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1589\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(kwargs) \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m, \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUnknown arguments: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlist\u001b[39m(kwargs\u001b[38;5;241m.\u001b[39mkeys())\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m-> 1591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcollection_exists\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcollection_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_name\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py:2063\u001b[0m, in \u001b[0;36mQdrantRemote.collection_exists\u001b[0;34m(self, collection_name, **kwargs)\u001b[0m\n\u001b[1;32m 2057\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_prefer_grpc:\n\u001b[1;32m 2058\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mgrpc_collections\u001b[38;5;241m.\u001b[39mCollectionExists(\n\u001b[1;32m 2059\u001b[0m grpc\u001b[38;5;241m.\u001b[39mCollectionExistsRequest(collection_name\u001b[38;5;241m=\u001b[39mcollection_name),\n\u001b[1;32m 2060\u001b[0m timeout\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_timeout,\n\u001b[1;32m 2061\u001b[0m )\u001b[38;5;241m.\u001b[39mresult\u001b[38;5;241m.\u001b[39mexists\n\u001b[0;32m-> 2063\u001b[0m result: Optional[models\u001b[38;5;241m.\u001b[39mCollectionExistence] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhttp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcollections_api\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcollection_exists\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2064\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_name\u001b[49m\n\u001b[1;32m 2065\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mresult\n\u001b[1;32m 2066\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m result \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCollection exists returned None\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 2067\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\u001b[38;5;241m.\u001b[39mexists\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api/collections_api.py:1157\u001b[0m, in \u001b[0;36mSyncCollectionsApi.collection_exists\u001b[0;34m(self, collection_name)\u001b[0m\n\u001b[1;32m 1150\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcollection_exists\u001b[39m(\n\u001b[1;32m 1151\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1152\u001b[0m collection_name: \u001b[38;5;28mstr\u001b[39m,\n\u001b[1;32m 1153\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m m\u001b[38;5;241m.\u001b[39mInlineResponse2008:\n\u001b[1;32m 1154\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 1155\u001b[0m \u001b[38;5;124;03m Returns \\\"true\\\" if the given collection name exists, and \\\"false\\\" otherwise\u001b[39;00m\n\u001b[1;32m 1156\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m-> 1157\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_build_for_collection_exists\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1158\u001b[0m \u001b[43m \u001b[49m\u001b[43mcollection_name\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcollection_name\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1159\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api/collections_api.py:87\u001b[0m, in \u001b[0;36m_CollectionsApi._build_for_collection_exists\u001b[0;34m(self, collection_name)\u001b[0m\n\u001b[1;32m 82\u001b[0m path_params \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 83\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mcollection_name\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;28mstr\u001b[39m(collection_name),\n\u001b[1;32m 84\u001b[0m }\n\u001b[1;32m 86\u001b[0m headers \u001b[38;5;241m=\u001b[39m {}\n\u001b[0;32m---> 87\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mapi_client\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 88\u001b[0m \u001b[43m \u001b[49m\u001b[43mtype_\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mInlineResponse2008\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 89\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mGET\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 90\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m/collections/\u001b[39;49m\u001b[38;5;132;43;01m{collection_name}\u001b[39;49;00m\u001b[38;5;124;43m/exists\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 91\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 92\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath_params\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpath_params\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 93\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py:76\u001b[0m, in \u001b[0;36mApiClient.request\u001b[0;34m(self, type_, method, url, path_params, **kwargs)\u001b[0m\n\u001b[1;32m 74\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mint\u001b[39m(kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mparams\u001b[39m\u001b[38;5;124m\"\u001b[39m][\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m])\n\u001b[1;32m 75\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39mbuild_request(method, url, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m---> 76\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtype_\u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py:93\u001b[0m, in \u001b[0;36mApiClient.send\u001b[0;34m(self, request, type_)\u001b[0m\n\u001b[1;32m 92\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21msend\u001b[39m(\u001b[38;5;28mself\u001b[39m, request: Request, type_: Type[T]) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m T:\n\u001b[0;32m---> 93\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmiddleware\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend_inner\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response\u001b[38;5;241m.\u001b[39mstatus_code \u001b[38;5;129;01min\u001b[39;00m [\u001b[38;5;241m200\u001b[39m, \u001b[38;5;241m201\u001b[39m, \u001b[38;5;241m202\u001b[39m]:\n\u001b[1;32m 95\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py:202\u001b[0m, in \u001b[0;36mBaseMiddleware.__call__\u001b[0;34m(self, request, call_next)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, request: Request, call_next: Send) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Response:\n\u001b[0;32m--> 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcall_next\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n",+ "File \u001b[0;32m~/.pyenv/versions/3.11/envs/burr-3-11/lib/python3.11/site-packages/qdrant_client/http/api_client.py:105\u001b[0m, in \u001b[0;36mApiClient.send_inner\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 103\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39msend(request)\n\u001b[1;32m 104\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 105\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ResponseHandlingException(e)\n\u001b[1;32m 106\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m response\n",+ "\u001b[0;31mResponseHandlingException\u001b[0m: [Errno 61] Connection refused"+ ]+ }+ ],+ "source": [+ "\n",+ "# %%\n",+ "# Read the PDF file and create the document input\n",+ "with open(\"/Users/elijahbenizzy/Downloads/smoke_co_detectors.pdf\", \"rb\") as f:\n",+ " pdf_content = f.read()\n",+ "\n",+ "# Encode the PDF content to base64\n",+ "pdf_base64 = base64.b64encode(pdf_content).decode(\"utf-8\")\n",+ "\n",+ "# Create an instance of InputType with the PDF content\n",+ "doc = InputType(prompt=None, document=pdf_base64)\n",+ "# doc = InputType(prompt=\"What is CRM?\", document=None)\n",+ "\n",+ "app.run(inputs={\"input\": doc}, halt_after=[\"prompt_response\", \"ingest_response\"])\n",+ "\n",+ "# %%\n",+ "app.visualize(include_conditions=True, include_state=True, format=\"png\")\n"+ ]+ },+ {+ "cell_type": "code",+ "execution_count": null,+ "id": "f0266f08-e960-48fd-b3a4-b149922b7b47",+ "metadata": {},+ "outputs": [],+ "source": []+ }+ ],+ "metadata": {+ "kernelspec": {+ "display_name": "Python 3 (ipykernel)",+ "language": "python",+ "name": "python3"+ },+ "language_info": {+ "codemirror_mode": {+ "name": "ipython",+ "version": 3+ },+ "file_extension": ".py",+ "mimetype": "text/x-python",+ "name": "python",+ "nbconvert_exporter": "python",+ "pygments_lexer": "ipython3",+ "version": "3.11.6"+ }+ },+ "nbformat": 4,+ "nbformat_minor": 5+}