diff --git a/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb b/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb index d138f1c3..61b4aacc 100644 --- a/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb +++ b/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb @@ -76,61 +76,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "5pLAhQmTOKiV", "metadata": { "id": "5pLAhQmTOKiV" }, "outputs": [], "source": [ - "! pip install cohere hnswlib unstructured -q" + "! pip install cohere hnswlib unstructured python-dotenv -q" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 2, "id": "f3a03a57", "metadata": { "id": "f3a03a57" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "import cohere\n", "from pinecone import Pinecone, PodSpec\n", @@ -146,98 +109,46 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 3, "id": "f0b1935e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "import cohere\n", "import os\n", + "import dotenv\n", + "\n", + "dotenv.load_dotenv()\n", "co = cohere.Client(os.getenv(\"COHERE_API_KEY\"))\n", "pc = Pinecone(\n", - " api_key=os.environ.get(\"PINECONE_API_KEY\")\n", + " api_key=os.getenv(\"PINECONE_API_KEY\")\n", ")\n" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "Dx1cncziCWBB", "metadata": { "cellView": "form", "id": "Dx1cncziCWBB" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "#@title Enable text wrapping in Google Colab\n", - "\n", - "from IPython.display import HTML, display\n", - "\n", - "def set_css():\n", - " display(HTML('''\n", - " \n", - " '''))\n", - "get_ipython().events.register('pre_run_cell', set_css)" + "# #@title Enable text wrapping in Google Colab\n", + "# Uncomment the code below for Google Colab\n", + "\n", + "# from IPython.display import HTML, display\n", + "\n", + "# def set_css():\n", + "# display(HTML('''\n", + "# \n", + "# '''))\n", + "# get_ipython().events.register('pre_run_cell', set_css)" ] }, { @@ -254,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "3dca4a88", "metadata": { "colab": { @@ -264,44 +175,7 @@ "id": "3dca4a88", "outputId": "b05da1ee-0456-4387-c232-a43e0ffed54c" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "raw_documents = [\n", " {\n", @@ -347,7 +221,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": 6, "id": "7c33412c", "metadata": { "colab": { @@ -357,44 +231,7 @@ "id": "7c33412c", "outputId": "cf04f8ed-8000-4433-f976-2d37747f21e7" }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "class Vectorstore:\n", " \"\"\"\n", @@ -548,7 +385,7 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": 7, "id": "4643e630", "metadata": { "colab": { @@ -559,42 +396,6 @@ "outputId": "fe01fcb6-3574-4322-d8d0-57d37aad397d" }, "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, { "name": "stdout", "output_type": "stream", @@ -649,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 115, + "execution_count": 8, "id": "82617b91", "metadata": { "colab": { @@ -660,42 +461,6 @@ "outputId": "7f1f2bc8-8ed9-4190-bd6b-7af2d9dc1980" }, "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - }, { "data": { "text/plain": [