{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "3df82171", "metadata": {}, "outputs": [], "source": [ "pinecone_key = '97aab1fa-afee-4e7a-9a2b-91965192d042'\n", "\n", "supabase_url = 'https://coxwkkhbzokyajoqvhsv.supabase.co'\n", "supabase_key = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNveHdra2hiem9reWFqb3F2aHN2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NzE4MTQ0NDMsImV4cCI6MTk4NzM5MDQ0M30.-ADUhCEv8uleCSU-RGsaFdLlFAcb_fq6qeMhzcgZcS8'\n", " " ] }, { "cell_type": "code", "execution_count": 2, "id": "b9befee1", "metadata": {}, "outputs": [], "source": [ "import pinecone\n", "\n", "pinecone.init(api_key=pinecone_key, environment=\"us-west1-gcp\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "bf47aabd", "metadata": {}, "outputs": [ { "ename": "NameError", "evalue": "name 'index' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn [3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mindex\u001b[49m\u001b[38;5;241m.\u001b[39mupsert([\n\u001b[1;32m 2\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mA\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.1\u001b[39m, \u001b[38;5;241m0.1\u001b[39m] \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m32\u001b[39m),\n\u001b[1;32m 3\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mB\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.6\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.2\u001b[39m, \u001b[38;5;241m0.2\u001b[39m] \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m32\u001b[39m),\n\u001b[1;32m 4\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mC\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m, \u001b[38;5;241m0.3\u001b[39m] \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m32\u001b[39m),\n\u001b[1;32m 5\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mD\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.5\u001b[39m, \u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.4\u001b[39m, \u001b[38;5;241m0.4\u001b[39m] \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m32\u001b[39m),\n\u001b[1;32m 6\u001b[0m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mE\u001b[39m\u001b[38;5;124m\"\u001b[39m, [\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m0\u001b[39m,\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m*\u001b[39m \u001b[38;5;241m32\u001b[39m)\n\u001b[1;32m 7\u001b[0m ],\n\u001b[1;32m 8\u001b[0m namespace\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 9\u001b[0m )\n", "\u001b[0;31mNameError\u001b[0m: name 'index' is not defined" ] } ], "source": [ "index.upsert([\n", " (\"A\", [0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] * 32),\n", " (\"B\", [0.2, 0.6, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2] * 32),\n", " (\"C\", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] * 32),\n", " (\"D\", [0.4, 0.5, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4] * 32),\n", " (\"E\", [0, 0, 0, 0, 0,0,0,0] * 32)\n", "],\n", " namespace=''\n", ")" ] }, { "cell_type": "code", "execution_count": 50, "id": "01acfce7", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'matches': [{'id': 'C', 'score': 1.00000012, 'sparseValues': {}, 'values': []},\n", " {'id': 'D',\n", " 'score': 0.996801376,\n", " 'sparseValues': {},\n", " 'values': []},\n", " {'id': 'A',\n", " 'score': 0.959403157,\n", " 'sparseValues': {},\n", " 'values': []}],\n", " 'namespace': ''}" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "index.query(\n", " vector=[0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] * 32,\n", " top_k=3,\n", " namespace='',\n", "# include_values=True,\n", "# include_metadata=True\n", ")" ] }, { "cell_type": "code", "execution_count": 10, "id": "002a42d3", "metadata": {}, "outputs": [], "source": [ "import hashlib\n", "# https://github.com/supabase-community/supabase-py\n", "from supabase import create_client, Client\n", "\n", "import pinecone\n", "\n", "pinecone.init(api_key=pinecone_key, environment=\"us-west1-gcp\")\n", "\n", "\n", "class Query:\n", " def __init__(self, pinecone_key, pinecone_index_name, supabase_url, supabase_key, dimension):\n", " self.pinecone_key = pinecone_key\n", " self.pinecone_index = self.use_index(pinecone_index_name, dimension=dimension)\n", " self.supabase = create_client(supabase_url, supabase_key)\n", " \n", " def hash_str(self, s):\n", " return str(hashlib.sha256(s.encode()).hexdigest())\n", " \n", " def insert_row(self, row):\n", " self.supabase.table('text').insert(row).execute()\n", " \n", " def use_index(self, index_name, **kwargs):\n", " if index_name not in pinecone.list_indexes():\n", " print(f'Creating index {index_name} with kwargs {kwargs}')\n", " pinecone.create_index(\n", " index_name, \n", " dimension=kwargs.get('dimension', 256), \n", " metric=kwargs.get('metric', 'cosine'), \n", " pod_type=\"p1\"\n", " )\n", " return pinecone.Index(index_name)\n", "\n", " def create_or_update_vectors(self, vector_data, namespace=''):\n", " '''\n", " :param vector_data: list of tuples (name, vector)\n", " '''\n", " values_to_add = [_[0] for _ in vector_data]\n", " keys_in_db = set(self.pinecone_index.fetch(values_to_add, namespace='')['vectors'].keys())\n", " vector_data = [v for v in vector_data if v[0] not in keys_in_db]\n", " if vector_data:\n", " print(f'adding {len(vector_data)} items to the index. {[_[0] for _ in vector_data]}')\n", " self.pinecone_index.upsert(vector_data, namespace=namespace)" ] }, { "cell_type": "code", "execution_count": 11, "id": "ec66f5fe", "metadata": {}, "outputs": [], "source": [ "p = Query(\n", " pinecone_key=pinecone_key, \n", " pinecone_index_name='test',\n", " supabase_url=supabase_url,\n", " supabase_key=supabase_key,\n", " dimension=16\n", ")" ] }, { "cell_type": "code", "execution_count": 12, "id": "689d2917", "metadata": { "scrolled": true }, "outputs": [ { "ename": "ConnectError", "evalue": "[Errno 8] nodename nor servname provided, or not known", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mgaierror\u001b[0m Traceback (most recent call last)", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpcore/_exceptions.py:8\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 9\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/opt/homebrew/lib/python3.10/site-packages/httpcore/backends/sync.py:86\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address)\u001b[0m\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[0;32m---> 86\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 87\u001b[0m \u001b[43m \u001b[49m\u001b[43maddress\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msource_address\u001b[49m\n\u001b[1;32m 88\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 89\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m SyncStream(sock)\n", "File \u001b[0;32m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/socket.py:824\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address)\u001b[0m\n\u001b[1;32m 823\u001b[0m err \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 824\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mSOCK_STREAM\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 825\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n", "File \u001b[0;32m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/socket.py:955\u001b[0m, in \u001b[0;36mgetaddrinfo\u001b[0;34m(host, port, family, type, proto, flags)\u001b[0m\n\u001b[1;32m 954\u001b[0m addrlist \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 955\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43m_socket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproto\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 956\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n", "\u001b[0;31mgaierror\u001b[0m: [Errno 8] nodename nor servname provided, or not known", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_transports/default.py:60\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 60\u001b[0m \u001b[38;5;28;01myield\u001b[39;00m\n\u001b[1;32m 61\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: PIE-786\u001b[39;00m\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_transports/default.py:218\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[0;32m--> 218\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 220\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/opt/homebrew/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py:253\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresponse_closed(status)\n\u001b[0;32m--> 253\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 254\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py:237\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 237\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 238\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[1;32m 239\u001b[0m \u001b[38;5;66;03m# The ConnectionNotAvailable exception is a special case, that\u001b[39;00m\n\u001b[1;32m 240\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 244\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 245\u001b[0m \u001b[38;5;66;03m# up as HTTP/1.1.\u001b[39;00m\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpcore/_sync/connection.py:86\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 85\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---> 86\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 87\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/opt/homebrew/lib/python3.10/site-packages/httpcore/_sync/connection.py:63\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 63\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 65\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/opt/homebrew/lib/python3.10/site-packages/httpcore/_sync/connection.py:111\u001b[0m, in \u001b[0;36mHTTPConnection._connect\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 108\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\n\u001b[1;32m 109\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mconnection.connect_tcp\u001b[39m\u001b[38;5;124m\"\u001b[39m, request, kwargs\n\u001b[1;32m 110\u001b[0m ) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[0;32m--> 111\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 112\u001b[0m trace\u001b[38;5;241m.\u001b[39mreturn_value \u001b[38;5;241m=\u001b[39m stream\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpcore/backends/sync.py:85\u001b[0m, in \u001b[0;36mSyncBackend.connect_tcp\u001b[0;34m(self, host, port, timeout, local_address)\u001b[0m\n\u001b[1;32m 84\u001b[0m exc_map \u001b[38;5;241m=\u001b[39m {socket\u001b[38;5;241m.\u001b[39mtimeout: ConnectTimeout, socket\u001b[38;5;241m.\u001b[39merror: ConnectError}\n\u001b[0;32m---> 85\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[1;32m 86\u001b[0m sock \u001b[38;5;241m=\u001b[39m socket\u001b[38;5;241m.\u001b[39mcreate_connection(\n\u001b[1;32m 87\u001b[0m address, timeout, source_address\u001b[38;5;241m=\u001b[39msource_address\n\u001b[1;32m 88\u001b[0m )\n", "File \u001b[0;32m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py:153\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 152\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 153\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgen\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mthrow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtyp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtraceback\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 154\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 155\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 156\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpcore/_exceptions.py:12\u001b[0m, in \u001b[0;36mmap_exceptions\u001b[0;34m(map)\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(exc, from_exc):\n\u001b[0;32m---> 12\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m to_exc(exc)\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n", "\u001b[0;31mConnectError\u001b[0m: [Errno 8] nodename nor servname provided, or not known", "\nThe above exception was the direct cause of the following exception:\n", "\u001b[0;31mConnectError\u001b[0m Traceback (most recent call last)", "Cell \u001b[0;32mIn [12], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m text \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mhello\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m----> 2\u001b[0m \u001b[43mp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minsert_row\u001b[49m\u001b[43m(\u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mhash\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhash_str\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtext\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mraw_text\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtext\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m}\u001b[49m\u001b[43m)\u001b[49m\n", "Cell \u001b[0;32mIn [10], line 20\u001b[0m, in \u001b[0;36mQuery.insert_row\u001b[0;34m(self, row)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minsert_row\u001b[39m(\u001b[38;5;28mself\u001b[39m, row):\n\u001b[0;32m---> 20\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msupabase\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtable\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtext\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minsert\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrow\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexecute\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/postgrest/_sync/request_builder.py:53\u001b[0m, in \u001b[0;36mSyncQueryRequestBuilder.execute\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mexecute\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m APIResponse:\n\u001b[1;32m 42\u001b[0m \u001b[38;5;124;03m\"\"\"Execute the query.\u001b[39;00m\n\u001b[1;32m 43\u001b[0m \n\u001b[1;32m 44\u001b[0m \u001b[38;5;124;03m .. tip::\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[38;5;124;03m :class:`APIError` If the API raised an error.\u001b[39;00m\n\u001b[1;32m 52\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 53\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 54\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mhttp_method\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 55\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 56\u001b[0m \u001b[43m \u001b[49m\u001b[43mjson\u001b[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[43mjson\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 57\u001b[0m \u001b[43m \u001b[49m\u001b[43mparams\u001b[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[43mparams\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 58\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[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[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 59\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 61\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m APIResponse\u001b[38;5;241m.\u001b[39mfrom_http_request_response(r)\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_client.py:821\u001b[0m, in \u001b[0;36mClient.request\u001b[0;34m(self, method, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)\u001b[0m\n\u001b[1;32m 806\u001b[0m warnings\u001b[38;5;241m.\u001b[39mwarn(message, \u001b[38;5;167;01mDeprecationWarning\u001b[39;00m)\n\u001b[1;32m 808\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuild_request(\n\u001b[1;32m 809\u001b[0m method\u001b[38;5;241m=\u001b[39mmethod,\n\u001b[1;32m 810\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 819\u001b[0m extensions\u001b[38;5;241m=\u001b[39mextensions,\n\u001b[1;32m 820\u001b[0m )\n\u001b[0;32m--> 821\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[43mauth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\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", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_client.py:908\u001b[0m, in \u001b[0;36mClient.send\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 900\u001b[0m follow_redirects \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 901\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfollow_redirects\n\u001b[1;32m 902\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(follow_redirects, UseClientDefault)\n\u001b[1;32m 903\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m follow_redirects\n\u001b[1;32m 904\u001b[0m )\n\u001b[1;32m 906\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--> 908\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 909\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 910\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 911\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 912\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 913\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 914\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 915\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_client.py:936\u001b[0m, in \u001b[0;36mClient._send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 933\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[1;32m 935\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 936\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 937\u001b[0m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 938\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 939\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 940\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 941\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 942\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_client.py:973\u001b[0m, in \u001b[0;36mClient._send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 970\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrequest\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n\u001b[1;32m 971\u001b[0m hook(request)\n\u001b[0;32m--> 973\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 974\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 975\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_event_hooks[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mresponse\u001b[39m\u001b[38;5;124m\"\u001b[39m]:\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_client.py:1009\u001b[0m, in \u001b[0;36mClient._send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1004\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 1005\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAttempted to send an async request with a sync Client instance.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1006\u001b[0m )\n\u001b[1;32m 1008\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request\u001b[38;5;241m=\u001b[39mrequest):\n\u001b[0;32m-> 1009\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 1011\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\u001b[1;32m 1013\u001b[0m response\u001b[38;5;241m.\u001b[39mrequest \u001b[38;5;241m=\u001b[39m request\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_transports/default.py:217\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(request\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 205\u001b[0m req \u001b[38;5;241m=\u001b[39m httpcore\u001b[38;5;241m.\u001b[39mRequest(\n\u001b[1;32m 206\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 207\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 215\u001b[0m extensions\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 216\u001b[0m )\n\u001b[0;32m--> 217\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[1;32m 218\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_pool\u001b[38;5;241m.\u001b[39mhandle_request(req)\n\u001b[1;32m 220\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/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py:153\u001b[0m, in \u001b[0;36m_GeneratorContextManager.__exit__\u001b[0;34m(self, typ, value, traceback)\u001b[0m\n\u001b[1;32m 151\u001b[0m value \u001b[38;5;241m=\u001b[39m typ()\n\u001b[1;32m 152\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 153\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgen\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mthrow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtyp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtraceback\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 154\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 155\u001b[0m \u001b[38;5;66;03m# Suppress StopIteration *unless* it's the same exception that\u001b[39;00m\n\u001b[1;32m 156\u001b[0m \u001b[38;5;66;03m# was passed to throw(). This prevents a StopIteration\u001b[39;00m\n\u001b[1;32m 157\u001b[0m \u001b[38;5;66;03m# raised inside the \"with\" statement from being suppressed.\u001b[39;00m\n\u001b[1;32m 158\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m value\n", "File \u001b[0;32m/opt/homebrew/lib/python3.10/site-packages/httpx/_transports/default.py:77\u001b[0m, in \u001b[0;36mmap_httpcore_exceptions\u001b[0;34m()\u001b[0m\n\u001b[1;32m 74\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m\n\u001b[1;32m 76\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(exc)\n\u001b[0;32m---> 77\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 8] nodename nor servname provided, or not known" ] } ], "source": [ "text = 'hello'\n", "p.insert_row({\n", " 'hash': p.hash_str(text),\n", " 'raw_text': text\n", "})" ] }, { "cell_type": "code", "execution_count": null, "id": "cf3386ec", "metadata": {}, "outputs": [], "source": [ "p.create_or_update_vectors([\n", " (\"A\", [0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] * 2),\n", " (\"B\", [0.2, 0.6, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2] * 2),\n", " (\"C\", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] * 2),\n", " (\"D\", [0.4, 0.5, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4] * 2),\n", " (\"E\", [0, 0, 0, 0, 0,0,0,0] * 32)\n", "],\n", " namespace=''\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "762c161a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "72729603", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "02a828ed", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "c45175ab", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 173, "id": "7d8ea2ad", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2023-01-03 16:29:26,730:WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))': /vectors/fetch?namespace=&ids=Fff&ids=B&ids=C&ids=Dd&ids=E\n", "2023-01-03 16:29:26,811:WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))': /vectors/fetch?namespace=&ids=Fff&ids=B&ids=C&ids=Dd&ids=E\n", "2023-01-03 16:29:26,888:WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))': /vectors/fetch?namespace=&ids=Fff&ids=B&ids=C&ids=Dd&ids=E\n" ] }, { "data": { "text/html": [ "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:670 in urlopen              \n",
       "                                                                                                  \n",
       "    667 │   │   │   self.proxy, self.proxy_config, destination_scheme                             \n",
       "    668 │   │   )                                                                                 \n",
       "    669 │   │                                                                                     \n",
       "  670 │   │   # Merge the proxy headers. Only done when not using HTTP CONNECT. We              \n",
       "    671 │   │   # have to copy the headers dict so we can safely change it without those          \n",
       "    672 │   │   # changes being reflected in anyone else's copy.                                  \n",
       "    673 │   │   if not http_tunnel_required:                                                      \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:381 in _make_request        \n",
       "                                                                                                  \n",
       "    378 │   │   self.num_requests += 1                                                            \n",
       "    379 │   │                                                                                     \n",
       "    380 │   │   timeout_obj = self._get_timeout(timeout)                                          \n",
       "  381 │   │   timeout_obj.start_connect()                                                       \n",
       "    382 │   │   conn.timeout = timeout_obj.connect_timeout                                        \n",
       "    383 │   │                                                                                     \n",
       "    384 │   │   # Trigger any extra validation we need to do.                                     \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:978 in _validate_conn       \n",
       "                                                                                                  \n",
       "    975 │   │   │   │   ca_certs=self.ca_certs,                                                   \n",
       "    976 │   │   │   │   ca_cert_dir=self.ca_cert_dir,                                             \n",
       "    977 │   │   │   │   assert_hostname=self.assert_hostname,                                     \n",
       "  978 │   │   │   │   assert_fingerprint=self.assert_fingerprint,                               \n",
       "    979 │   │   │   )                                                                             \n",
       "    980 │   │   │   conn.ssl_version = self.ssl_version                                           \n",
       "    981 │   │   return conn                                                                       \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connection.py:362 in connect                  \n",
       "                                                                                                  \n",
       "   359 │   │   hostname = self.host                                                               \n",
       "   360 │   │   tls_in_tls = False                                                                 \n",
       "   361 │   │                                                                                      \n",
       " 362 │   │   if self._is_using_tunnel():                                                        \n",
       "   363 │   │   │   if self.tls_in_tls_required:                                                   \n",
       "   364 │   │   │   │   self.sock = conn = self._connect_tls_proxy(hostname, conn)                 \n",
       "   365 │   │   │   │   tls_in_tls = True                                                          \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/util/ssl_.py:386 in ssl_wrap_socket           \n",
       "                                                                                                  \n",
       "   383 │   │   supported by OpenSSL's -CApath flag or the capath argument to                      \n",
       "   384 │   │   SSLContext.load_verify_locations().                                                \n",
       "   385 :param key_password:                                                                   \n",
       " 386 │   │   Optional password if the keyfile is encrypted.                                     \n",
       "   387 :param ca_cert_data:                                                                   \n",
       "   388 │   │   Optional string containing CA certificates in PEM format suitable for              \n",
       "   389 │   │   passing as the cadata parameter to SSLContext.load_verify_locations()              \n",
       "                                                                                                  \n",
       " /opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10 \n",
       " /ssl.py:513 in wrap_socket                                                                       \n",
       "                                                                                                  \n",
       "    510 │   │   │   │   │   server_hostname=None, session=None):                                  \n",
       "    511 │   │   # SSLSocket class handles server_hostname encoding before it calls                \n",
       "    512 │   │   # ctx._wrap_socket()                                                              \n",
       "  513 │   │   return self.sslsocket_class._create(                                              \n",
       "    514 │   │   │   sock=sock,                                                                    \n",
       "    515 │   │   │   server_side=server_side,                                                      \n",
       "    516 │   │   │   do_handshake_on_connect=do_handshake_on_connect,                              \n",
       "                                                                                                  \n",
       " /opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10 \n",
       " /ssl.py:1071 in _create                                                                          \n",
       "                                                                                                  \n",
       "   1068 │   │   │   │   │   if timeout == 0.0:                                                    \n",
       "   1069 │   │   │   │   │   │   # non-blocking                                                    \n",
       "   1070 │   │   │   │   │   │   raise ValueError(\"do_handshake_on_connect should not be specifie  \n",
       " 1071 │   │   │   │   │   self.do_handshake()                                                   \n",
       "   1072 │   │   │   except (OSError, ValueError):                                                 \n",
       "   1073 │   │   │   │   self.close()                                                              \n",
       "   1074 │   │   │   │   raise                                                                     \n",
       "                                                                                                  \n",
       " /opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10 \n",
       " /ssl.py:1342 in do_handshake                                                                     \n",
       "                                                                                                  \n",
       "   1339 │   │   try:                                                                              \n",
       "   1340 │   │   │   if timeout == 0.0 and block:                                                  \n",
       "   1341 │   │   │   │   self.settimeout(None)                                                     \n",
       " 1342 │   │   │   self._sslobj.do_handshake()                                                   \n",
       "   1343 │   │   finally:                                                                          \n",
       "   1344 │   │   │   self.settimeout(timeout)                                                      \n",
       "   1345                                                                                           \n",
       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "ConnectionResetError: [Errno 54] Connection reset by peer\n",
       "\n",
       "During handling of the above exception, another exception occurred:\n",
       "\n",
       "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/utils/error_handling.py:17 in           \n",
       " inner_func                                                                                       \n",
       "                                                                                                  \n",
       "   14 │   def inner_func(*args, **kwargs):                                                        \n",
       "   15 │   │   Config.validate()  # raises exceptions in case of invalid config                    \n",
       "   16 │   │   try:                                                                                \n",
       " 17 │   │   │   return func(*args, **kwargs)                                                    \n",
       "   18 │   │   except MaxRetryError as e:                                                          \n",
       "   19 │   │   │   if isinstance(e.reason, ProtocolError):                                         \n",
       "   20 │   │   │   │   raise PineconeProtocolError(                                                \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/index.py:93 in fetch                         \n",
       "                                                                                                  \n",
       "    90 │                                                                                          \n",
       "    91 │   @validate_and_convert_errors                                                           \n",
       "    92 │   def fetch(self, *args, **kwargs):                                                      \n",
       "  93 │   │   return self._vector_api.fetch(*args, **kwargs)                                     \n",
       "    94 │                                                                                          \n",
       "    95 │   @validate_and_convert_errors                                                           \n",
       "    96 │   def query(self, vector=[], id='', queries=[], **kwargs):                               \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api_client.py:776 in __call__    \n",
       "                                                                                                  \n",
       "   773 │   │   api_instance.configure_index.callable or self.callable in this class               \n",
       "   774 │   │                                                                                      \n",
       "   775 │   │   \"\"\"                                                                                \n",
       " 776 │   │   return self.callable(self, *args, **kwargs)                                        \n",
       "   777 │                                                                                          \n",
       "   778 │   def call_with_http_info(self, **kwargs):                                               \n",
       "   779                                                                                            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api/vector_operations_api.py:591 \n",
       " in __fetch                                                                                       \n",
       "                                                                                                  \n",
       "    588 │   │   │   kwargs['_host_index'] = kwargs.get('_host_index')                             \n",
       "    589 │   │   │   kwargs['ids'] = \\                                                             \n",
       "    590 │   │   │   │   ids                                                                       \n",
       "  591 │   │   │   return self.call_with_http_info(**kwargs)                                     \n",
       "    592 │   │                                                                                     \n",
       "    593 │   │   self.fetch = _Endpoint(                                                           \n",
       "    594 │   │   │   settings={                                                                    \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api_client.py:838 in             \n",
       " call_with_http_info                                                                              \n",
       "                                                                                                  \n",
       "   835 │   │   │   │   content_type_headers_list)                                                 \n",
       "   836 │   │   │   params['header']['Content-Type'] = header_list                                 \n",
       "   837 │   │                                                                                      \n",
       " 838 │   │   return self.api_client.call_api(                                                   \n",
       "   839 │   │   │   self.settings['endpoint_path'], self.settings['http_method'],                  \n",
       "   840 │   │   │   params['path'],                                                                \n",
       "   841 │   │   │   params['query'],                                                               \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api_client.py:413 in call_api    \n",
       "                                                                                                  \n",
       "   410 │   │   │   then the method will return the response directly.                             \n",
       "   411 │   │   \"\"\"                                                                                \n",
       "   412 │   │   if not async_req:                                                                  \n",
       " 413 │   │   │   return self.__call_api(resource_path, method,                                  \n",
       "   414 │   │   │   │   │   │   │   │      path_params, query_params, header_params,               \n",
       "   415 │   │   │   │   │   │   │   │      body, post_params, files,                               \n",
       "   416 │   │   │   │   │   │   │   │      response_type, auth_settings,                           \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api_client.py:200 in __call_api  \n",
       "                                                                                                  \n",
       "   197 │   │                                                                                      \n",
       "   198 │   │   try:                                                                               \n",
       "   199 │   │   │   # perform request and return response                                          \n",
       " 200 │   │   │   response_data = self.request(                                                  \n",
       "   201 │   │   │   │   method, url, query_params=query_params, headers=header_params,             \n",
       "   202 │   │   │   │   post_params=post_params, body=body,                                        \n",
       "   203 │   │   │   │   _preload_content=_preload_content,                                         \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api_client.py:439 in request     \n",
       "                                                                                                  \n",
       "   436 │   │   │   │   _request_timeout=None):                                                    \n",
       "   437 │   │   \"\"\"Makes the HTTP request using RESTClient.\"\"\"                                     \n",
       "   438 │   │   if method == \"GET\":                                                                \n",
       " 439 │   │   │   return self.rest_client.GET(url,                                               \n",
       "   440 │   │   │   │   │   │   │   │   │   │   query_params=query_params,                         \n",
       "   441 │   │   │   │   │   │   │   │   │   │   _preload_content=_preload_content,                 \n",
       "   442 │   │   │   │   │   │   │   │   │   │   _request_timeout=_request_timeout,                 \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/rest.py:236 in GET               \n",
       "                                                                                                  \n",
       "   233 │                                                                                          \n",
       "   234 │   def GET(self, url, headers=None, query_params=None, _preload_content=True,             \n",
       "   235 │   │   │   _request_timeout=None):                                                        \n",
       " 236 │   │   return self.request(\"GET\", url,                                                    \n",
       "   237 │   │   │   │   │   │   │   headers=headers,                                               \n",
       "   238 │   │   │   │   │   │   │   _preload_content=_preload_content,                             \n",
       "   239 │   │   │   │   │   │   │   _request_timeout=_request_timeout,                             \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/rest.py:202 in request           \n",
       "                                                                                                  \n",
       "   199 │   │   │   │   │   raise ApiException(status=0, reason=msg)                               \n",
       "   200 │   │   │   # For `GET`, `HEAD`                                                            \n",
       "   201 │   │   │   else:                                                                          \n",
       " 202 │   │   │   │   r = self.pool_manager.request(method, url,                                 \n",
       "   203 │   │   │   │   │   │   │   │   │   │   │     fields=query_params,                         \n",
       "   204 │   │   │   │   │   │   │   │   │   │   │     preload_content=_preload_content,            \n",
       "   205 │   │   │   │   │   │   │   │   │   │   │     timeout=timeout,                             \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/request.py:75 in request                      \n",
       "                                                                                                  \n",
       "    72 │   │                                                                                      \n",
       "    73 │   │   if method in self._encode_url_methods:                                             \n",
       "    74 │   │   │   return self.request_encode_url(                                                \n",
       "  75 │   │   │   │   method, url, fields=fields, headers=headers, **urlopen_kw                  \n",
       "    76 │   │   │   )                                                                              \n",
       "    77 │   │   else:                                                                              \n",
       "    78 │   │   │   return self.request_encode_body(                                               \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/request.py:97 in request_encode_url           \n",
       "                                                                                                  \n",
       "    94 │   │   │   url += \"?\" + urlencode(fields)                                                 \n",
       "    95 │   │                                                                                      \n",
       "    96 │   │   return self.urlopen(method, url, **extra_kw)                                       \n",
       "  97                                                                                        \n",
       "    98 │   def request_encode_body(                                                               \n",
       "    99 │   │   self,                                                                              \n",
       "   100 │   │   method,                                                                            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/poolmanager.py:336 in urlopen                 \n",
       "                                                                                                  \n",
       "   333 │   │   │   self.proxy, self.proxy_config, parsed_url.scheme                               \n",
       "   334 │   │   )                                                                                  \n",
       "   335 │                                                                                          \n",
       " 336 def _validate_proxy_scheme_url_selection(self, url_scheme):                            \n",
       "   337 │   │   \"\"\"                                                                                \n",
       "   338 │   │   Validates that were not attempting to do TLS in TLS connections on                 \n",
       "   339 │   │   Python2 or with unsupported SSL implementations.                                   \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:754 in urlopen              \n",
       "                                                                                                  \n",
       "    751 │   │   │   clean_exit = False                                                            \n",
       "    752 │   │   │                                                                                 \n",
       "    753 │   │   │   def _is_ssl_error_message_from_http_proxy(ssl_error):                         \n",
       "  754 │   │   │   │   # We're trying to detect the message 'WRONG_VERSION_NUMBER' but           \n",
       "    755 │   │   │   │   # SSLErrors are kinda all over the place when it comes to the message,    \n",
       "    756 │   │   │   │   # so we try to cover our bases here!                                      \n",
       "    757 │   │   │   │   message = \" \".join(re.split(\"[^a-z]\", str(ssl_error).lower()))            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:754 in urlopen              \n",
       "                                                                                                  \n",
       "    751 │   │   │   clean_exit = False                                                            \n",
       "    752 │   │   │                                                                                 \n",
       "    753 │   │   │   def _is_ssl_error_message_from_http_proxy(ssl_error):                         \n",
       "  754 │   │   │   │   # We're trying to detect the message 'WRONG_VERSION_NUMBER' but           \n",
       "    755 │   │   │   │   # SSLErrors are kinda all over the place when it comes to the message,    \n",
       "    756 │   │   │   │   # so we try to cover our bases here!                                      \n",
       "    757 │   │   │   │   message = \" \".join(re.split(\"[^a-z]\", str(ssl_error).lower()))            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:754 in urlopen              \n",
       "                                                                                                  \n",
       "    751 │   │   │   clean_exit = False                                                            \n",
       "    752 │   │   │                                                                                 \n",
       "    753 │   │   │   def _is_ssl_error_message_from_http_proxy(ssl_error):                         \n",
       "  754 │   │   │   │   # We're trying to detect the message 'WRONG_VERSION_NUMBER' but           \n",
       "    755 │   │   │   │   # SSLErrors are kinda all over the place when it comes to the message,    \n",
       "    756 │   │   │   │   # so we try to cover our bases here!                                      \n",
       "    757 │   │   │   │   message = \" \".join(re.split(\"[^a-z]\", str(ssl_error).lower()))            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py:726 in urlopen              \n",
       "                                                                                                  \n",
       "    723 │   │   │   response = self.ResponseCls.from_httplib(                                     \n",
       "    724 │   │   │   │   httplib_response,                                                         \n",
       "    725 │   │   │   │   pool=self,                                                                \n",
       "  726 │   │   │   │   connection=response_conn,                                                 \n",
       "    727 │   │   │   │   retries=retries,                                                          \n",
       "    728 │   │   │   │   **response_kw                                                             \n",
       "    729 │   │   │   )                                                                             \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/urllib3/util/retry.py:446 in increment                \n",
       "                                                                                                  \n",
       "   443 │   │   \"\"\"Errors that occur after the request has been started, so we should              \n",
       "   444 │   │   assume that the server began processing it.                                        \n",
       "   445 │   │   \"\"\"                                                                                \n",
       " 446 │   │   return isinstance(err, (ReadTimeoutError, ProtocolError))                          \n",
       "   447 │                                                                                          \n",
       "   448 │   def _is_method_retryable(self, method):                                                \n",
       "   449 │   │   \"\"\"Checks if a given HTTP method should be retried upon, depending if              \n",
       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "MaxRetryError: HTTPSConnectionPool(host='test-cb41e3b.svc.us-west1-gcp.pinecone.io', port=443): Max retries \n",
       "exceeded with url: /vectors/fetch?namespace=&ids=Fff&ids=B&ids=C&ids=Dd&ids=E (Caused by ProtocolError('Connection \n",
       "aborted.', ConnectionResetError(54, 'Connection reset by peer')))\n",
       "\n",
       "The above exception was the direct cause of the following exception:\n",
       "\n",
       "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
       " /var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/576604747.py:1 in <module>      \n",
       "                                                                                                  \n",
       " [Errno 2] No such file or directory:                                                             \n",
       " '/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/576604747.py'                  \n",
       "                                                                                                  \n",
       " /var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/132251037.py:22 in              \n",
       " create_or_update_vectors                                                                         \n",
       "                                                                                                  \n",
       " [Errno 2] No such file or directory:                                                             \n",
       " '/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/132251037.py'                  \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/pinecone/core/utils/error_handling.py:20 in           \n",
       " inner_func                                                                                       \n",
       "                                                                                                  \n",
       "   17 │   │   │   return func(*args, **kwargs)                                                    \n",
       "   18 │   │   except MaxRetryError as e:                                                          \n",
       "   19 │   │   │   if isinstance(e.reason, ProtocolError):                                         \n",
       " 20 │   │   │   │   raise PineconeProtocolError(                                                \n",
       "   21 │   │   │   │   │   f'Failed to connect to {e.url}; did you specify the correct index na    \n",
       "   22 │   │   │   else:                                                                           \n",
       "   23 │   │   │   │   raise                                                                       \n",
       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "PineconeProtocolError: Failed to connect to /vectors/fetch?namespace=&ids=Fff&ids=B&ids=C&ids=Dd&ids=E; did you \n",
       "specify the correct index name?\n",
       "
\n" ], "text/plain": [ "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m670\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 667 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[96mself\u001b[0m.proxy, \u001b[96mself\u001b[0m.proxy_config, destination_scheme \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 668 \u001b[0m\u001b[2m│ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 669 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 670 \u001b[2m│ │ \u001b[0m\u001b[2m# Merge the proxy headers. Only done when not using HTTP CONNECT. We\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 671 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# have to copy the headers dict so we can safely change it without those\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 672 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# changes being reflected in anyone else's copy.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 673 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[95mnot\u001b[0m http_tunnel_required: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m381\u001b[0m in \u001b[92m_make_request\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 378 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[96mself\u001b[0m.num_requests += \u001b[94m1\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 379 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 380 \u001b[0m\u001b[2m│ │ \u001b[0mtimeout_obj = \u001b[96mself\u001b[0m._get_timeout(timeout) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 381 \u001b[2m│ │ \u001b[0mtimeout_obj.start_connect() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 382 \u001b[0m\u001b[2m│ │ \u001b[0mconn.timeout = timeout_obj.connect_timeout \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 383 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 384 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# Trigger any extra validation we need to do.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m978\u001b[0m in \u001b[92m_validate_conn\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 975 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mca_certs=\u001b[96mself\u001b[0m.ca_certs, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 976 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mca_cert_dir=\u001b[96mself\u001b[0m.ca_cert_dir, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 977 \u001b[0m\u001b[2m│ │ │ │ \u001b[0massert_hostname=\u001b[96mself\u001b[0m.assert_hostname, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 978 \u001b[2m│ │ │ │ \u001b[0massert_fingerprint=\u001b[96mself\u001b[0m.assert_fingerprint, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 979 \u001b[0m\u001b[2m│ │ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 980 \u001b[0m\u001b[2m│ │ │ \u001b[0mconn.ssl_version = \u001b[96mself\u001b[0m.ssl_version \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 981 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m conn \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnection.py\u001b[0m:\u001b[94m362\u001b[0m in \u001b[92mconnect\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m359 \u001b[0m\u001b[2m│ │ \u001b[0mhostname = \u001b[96mself\u001b[0m.host \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m360 \u001b[0m\u001b[2m│ │ \u001b[0mtls_in_tls = \u001b[94mFalse\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m361 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m362 \u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[96mself\u001b[0m._is_using_tunnel(): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m363 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[96mself\u001b[0m.tls_in_tls_required: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m364 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[96mself\u001b[0m.sock = conn = \u001b[96mself\u001b[0m._connect_tls_proxy(hostname, conn) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m365 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mtls_in_tls = \u001b[94mTrue\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/util/\u001b[0m\u001b[1;33mssl_.py\u001b[0m:\u001b[94m386\u001b[0m in \u001b[92mssl_wrap_socket\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m383 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33msupported by OpenSSL's -CApath flag or the capath argument to\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m384 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mSSLContext.load_verify_locations().\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m385 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33m:param key_password:\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m386 \u001b[2;33m│ │ \u001b[0m\u001b[33mOptional password if the keyfile is encrypted.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m387 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33m:param ca_cert_data:\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m388 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mOptional string containing CA certificates in PEM format suitable for\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m389 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mpassing as the cadata parameter to SSLContext.load_verify_locations()\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/\u001b[0m\u001b[1;33mssl.py\u001b[0m:\u001b[94m513\u001b[0m in \u001b[92mwrap_socket\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 510 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0mserver_hostname=\u001b[94mNone\u001b[0m, session=\u001b[94mNone\u001b[0m): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 511 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# SSLSocket class handles server_hostname encoding before it calls\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 512 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# ctx._wrap_socket()\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 513 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.sslsocket_class._create( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 514 \u001b[0m\u001b[2m│ │ │ \u001b[0msock=sock, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 515 \u001b[0m\u001b[2m│ │ │ \u001b[0mserver_side=server_side, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 516 \u001b[0m\u001b[2m│ │ │ \u001b[0mdo_handshake_on_connect=do_handshake_on_connect, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/\u001b[0m\u001b[1;33mssl.py\u001b[0m:\u001b[94m1071\u001b[0m in \u001b[92m_create\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1068 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0m\u001b[94mif\u001b[0m timeout == \u001b[94m0.0\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1069 \u001b[0m\u001b[2m│ │ │ │ │ │ \u001b[0m\u001b[2m# non-blocking\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1070 \u001b[0m\u001b[2m│ │ │ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m \u001b[96mValueError\u001b[0m(\u001b[33m\"\u001b[0m\u001b[33mdo_handshake_on_connect should not be specifie\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m1071 \u001b[2m│ │ │ │ │ \u001b[0m\u001b[96mself\u001b[0m.do_handshake() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1072 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mexcept\u001b[0m (\u001b[96mOSError\u001b[0m, \u001b[96mValueError\u001b[0m): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1073 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[96mself\u001b[0m.close() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1074 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/Cellar/python@3.10/3.10.7/Frameworks/Python.framework/Versions/3.10/lib/python3.10\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/\u001b[0m\u001b[1;33mssl.py\u001b[0m:\u001b[94m1342\u001b[0m in \u001b[92mdo_handshake\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1339 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1340 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mif\u001b[0m timeout == \u001b[94m0.0\u001b[0m \u001b[95mand\u001b[0m block: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1341 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[96mself\u001b[0m.settimeout(\u001b[94mNone\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m1342 \u001b[2m│ │ │ \u001b[0m\u001b[96mself\u001b[0m._sslobj.do_handshake() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1343 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mfinally\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1344 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[96mself\u001b[0m.settimeout(timeout) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m1345 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mConnectionResetError: \u001b[0m\u001b[1m[\u001b[0mErrno \u001b[1;36m54\u001b[0m\u001b[1m]\u001b[0m Connection reset by peer\n", "\n", "\u001b[3mDuring handling of the above exception, another exception occurred:\u001b[0m\n", "\n", "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/utils/\u001b[0m\u001b[1;33merror_handling.py\u001b[0m:\u001b[94m17\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92minner_func\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m14 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92minner_func\u001b[0m(*args, **kwargs): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m15 \u001b[0m\u001b[2m│ │ \u001b[0mConfig.validate() \u001b[2m# raises exceptions in case of invalid config\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m16 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m17 \u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m func(*args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m18 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mexcept\u001b[0m MaxRetryError \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m19 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[96misinstance\u001b[0m(e.reason, ProtocolError): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m20 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m PineconeProtocolError( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/\u001b[0m\u001b[1;33mindex.py\u001b[0m:\u001b[94m93\u001b[0m in \u001b[92mfetch\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 90 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 91 \u001b[0m\u001b[2m│ \u001b[0m\u001b[1;95m@validate_and_convert_errors\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 92 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mfetch\u001b[0m(\u001b[96mself\u001b[0m, *args, **kwargs): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 93 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m._vector_api.fetch(*args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 94 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 95 \u001b[0m\u001b[2m│ \u001b[0m\u001b[1;95m@validate_and_convert_errors\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 96 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mquery\u001b[0m(\u001b[96mself\u001b[0m, vector=[], \u001b[96mid\u001b[0m=\u001b[33m'\u001b[0m\u001b[33m'\u001b[0m, queries=[], **kwargs): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mapi_client.py\u001b[0m:\u001b[94m776\u001b[0m in \u001b[92m__call__\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m773 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mapi_instance.configure_index.callable or self.callable in this class\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m774 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m775 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m776 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.callable(\u001b[96mself\u001b[0m, *args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m777 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m778 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mcall_with_http_info\u001b[0m(\u001b[96mself\u001b[0m, **kwargs): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m779 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/api/\u001b[0m\u001b[1;33mvector_operations_api.py\u001b[0m:\u001b[94m591\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m in \u001b[92m__fetch\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 588 \u001b[0m\u001b[2m│ │ │ \u001b[0mkwargs[\u001b[33m'\u001b[0m\u001b[33m_host_index\u001b[0m\u001b[33m'\u001b[0m] = kwargs.get(\u001b[33m'\u001b[0m\u001b[33m_host_index\u001b[0m\u001b[33m'\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 589 \u001b[0m\u001b[2m│ │ │ \u001b[0mkwargs[\u001b[33m'\u001b[0m\u001b[33mids\u001b[0m\u001b[33m'\u001b[0m] = \\ \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 590 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mids \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 591 \u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.call_with_http_info(**kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 592 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 593 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[96mself\u001b[0m.fetch = _Endpoint( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 594 \u001b[0m\u001b[2m│ │ │ \u001b[0msettings={ \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mapi_client.py\u001b[0m:\u001b[94m838\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mcall_with_http_info\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m835 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mcontent_type_headers_list) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m836 \u001b[0m\u001b[2m│ │ │ \u001b[0mparams[\u001b[33m'\u001b[0m\u001b[33mheader\u001b[0m\u001b[33m'\u001b[0m][\u001b[33m'\u001b[0m\u001b[33mContent-Type\u001b[0m\u001b[33m'\u001b[0m] = header_list \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m837 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m838 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.api_client.call_api( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m839 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[96mself\u001b[0m.settings[\u001b[33m'\u001b[0m\u001b[33mendpoint_path\u001b[0m\u001b[33m'\u001b[0m], \u001b[96mself\u001b[0m.settings[\u001b[33m'\u001b[0m\u001b[33mhttp_method\u001b[0m\u001b[33m'\u001b[0m], \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m840 \u001b[0m\u001b[2m│ │ │ \u001b[0mparams[\u001b[33m'\u001b[0m\u001b[33mpath\u001b[0m\u001b[33m'\u001b[0m], \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m841 \u001b[0m\u001b[2m│ │ │ \u001b[0mparams[\u001b[33m'\u001b[0m\u001b[33mquery\u001b[0m\u001b[33m'\u001b[0m], \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mapi_client.py\u001b[0m:\u001b[94m413\u001b[0m in \u001b[92mcall_api\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m410 \u001b[0m\u001b[2;33m│ │ │ \u001b[0m\u001b[33mthen the method will return the response directly.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m411 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m412 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[95mnot\u001b[0m async_req: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m413 \u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.__call_api(resource_path, method, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m414 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ \u001b[0mpath_params, query_params, header_params, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m415 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ \u001b[0mbody, post_params, files, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m416 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ \u001b[0mresponse_type, auth_settings, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mapi_client.py\u001b[0m:\u001b[94m200\u001b[0m in \u001b[92m__call_api\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m197 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m198 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m199 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[2m# perform request and return response\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m200 \u001b[2m│ │ │ \u001b[0mresponse_data = \u001b[96mself\u001b[0m.request( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m201 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmethod, url, query_params=query_params, headers=header_params, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m202 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mpost_params=post_params, body=body, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m203 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m_preload_content=_preload_content, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mapi_client.py\u001b[0m:\u001b[94m439\u001b[0m in \u001b[92mrequest\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m436 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m_request_timeout=\u001b[94mNone\u001b[0m): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m437 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[33m\"\"\"Makes the HTTP request using RESTClient.\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m438 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m method == \u001b[33m\"\u001b[0m\u001b[33mGET\u001b[0m\u001b[33m\"\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m439 \u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.rest_client.GET(url, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m440 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ \u001b[0mquery_params=query_params, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m441 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ \u001b[0m_preload_content=_preload_content, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m442 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ \u001b[0m_request_timeout=_request_timeout, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mrest.py\u001b[0m:\u001b[94m236\u001b[0m in \u001b[92mGET\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m233 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m234 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mGET\u001b[0m(\u001b[96mself\u001b[0m, url, headers=\u001b[94mNone\u001b[0m, query_params=\u001b[94mNone\u001b[0m, _preload_content=\u001b[94mTrue\u001b[0m, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m235 \u001b[0m\u001b[2m│ │ │ \u001b[0m_request_timeout=\u001b[94mNone\u001b[0m): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m236 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.request(\u001b[33m\"\u001b[0m\u001b[33mGET\u001b[0m\u001b[33m\"\u001b[0m, url, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m237 \u001b[0m\u001b[2m│ │ │ │ │ │ │ \u001b[0mheaders=headers, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m238 \u001b[0m\u001b[2m│ │ │ │ │ │ │ \u001b[0m_preload_content=_preload_content, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m239 \u001b[0m\u001b[2m│ │ │ │ │ │ │ \u001b[0m_request_timeout=_request_timeout, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/client/\u001b[0m\u001b[1;33mrest.py\u001b[0m:\u001b[94m202\u001b[0m in \u001b[92mrequest\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m199 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m ApiException(status=\u001b[94m0\u001b[0m, reason=msg) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m200 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[2m# For `GET`, `HEAD`\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m201 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94melse\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m202 \u001b[2m│ │ │ │ \u001b[0mr = \u001b[96mself\u001b[0m.pool_manager.request(method, url, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m203 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ │ \u001b[0mfields=query_params, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m204 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ │ \u001b[0mpreload_content=_preload_content, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m205 \u001b[0m\u001b[2m│ │ │ │ │ │ │ │ │ │ │ \u001b[0mtimeout=timeout, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mrequest.py\u001b[0m:\u001b[94m75\u001b[0m in \u001b[92mrequest\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 72 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 73 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mif\u001b[0m method \u001b[95min\u001b[0m \u001b[96mself\u001b[0m._encode_url_methods: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 74 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.request_encode_url( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 75 \u001b[2m│ │ │ │ \u001b[0mmethod, url, fields=fields, headers=headers, **urlopen_kw \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 76 \u001b[0m\u001b[2m│ │ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 77 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94melse\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 78 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.request_encode_body( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mrequest.py\u001b[0m:\u001b[94m97\u001b[0m in \u001b[92mrequest_encode_url\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 94 \u001b[0m\u001b[2m│ │ │ \u001b[0murl += \u001b[33m\"\u001b[0m\u001b[33m?\u001b[0m\u001b[33m\"\u001b[0m + urlencode(fields) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 95 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 96 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mself\u001b[0m.urlopen(method, url, **extra_kw) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 97 \u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 98 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mrequest_encode_body\u001b[0m( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 99 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[96mself\u001b[0m, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m100 \u001b[0m\u001b[2m│ │ \u001b[0mmethod, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mpoolmanager.py\u001b[0m:\u001b[94m336\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m333 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[96mself\u001b[0m.proxy, \u001b[96mself\u001b[0m.proxy_config, parsed_url.scheme \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m334 \u001b[0m\u001b[2m│ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m335 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m336 \u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_validate_proxy_scheme_url_selection\u001b[0m(\u001b[96mself\u001b[0m, url_scheme): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m337 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m338 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mValidates that were not attempting to do TLS in TLS connections on\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m339 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mPython2 or with unsupported SSL implementations.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m754\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 751 \u001b[0m\u001b[2m│ │ │ \u001b[0mclean_exit = \u001b[94mFalse\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 752 \u001b[0m\u001b[2m│ │ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 753 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_is_ssl_error_message_from_http_proxy\u001b[0m(ssl_error): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 754 \u001b[2m│ │ │ │ \u001b[0m\u001b[2m# We're trying to detect the message 'WRONG_VERSION_NUMBER' but\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 755 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# SSLErrors are kinda all over the place when it comes to the message,\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 756 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# so we try to cover our bases here!\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 757 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmessage = \u001b[33m\"\u001b[0m\u001b[33m \u001b[0m\u001b[33m\"\u001b[0m.join(re.split(\u001b[33m\"\u001b[0m\u001b[33m[^a-z]\u001b[0m\u001b[33m\"\u001b[0m, \u001b[96mstr\u001b[0m(ssl_error).lower())) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m754\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 751 \u001b[0m\u001b[2m│ │ │ \u001b[0mclean_exit = \u001b[94mFalse\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 752 \u001b[0m\u001b[2m│ │ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 753 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_is_ssl_error_message_from_http_proxy\u001b[0m(ssl_error): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 754 \u001b[2m│ │ │ │ \u001b[0m\u001b[2m# We're trying to detect the message 'WRONG_VERSION_NUMBER' but\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 755 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# SSLErrors are kinda all over the place when it comes to the message,\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 756 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# so we try to cover our bases here!\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 757 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmessage = \u001b[33m\"\u001b[0m\u001b[33m \u001b[0m\u001b[33m\"\u001b[0m.join(re.split(\u001b[33m\"\u001b[0m\u001b[33m[^a-z]\u001b[0m\u001b[33m\"\u001b[0m, \u001b[96mstr\u001b[0m(ssl_error).lower())) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m754\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 751 \u001b[0m\u001b[2m│ │ │ \u001b[0mclean_exit = \u001b[94mFalse\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 752 \u001b[0m\u001b[2m│ │ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 753 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_is_ssl_error_message_from_http_proxy\u001b[0m(ssl_error): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 754 \u001b[2m│ │ │ │ \u001b[0m\u001b[2m# We're trying to detect the message 'WRONG_VERSION_NUMBER' but\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 755 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# SSLErrors are kinda all over the place when it comes to the message,\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 756 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[2m# so we try to cover our bases here!\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 757 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mmessage = \u001b[33m\"\u001b[0m\u001b[33m \u001b[0m\u001b[33m\"\u001b[0m.join(re.split(\u001b[33m\"\u001b[0m\u001b[33m[^a-z]\u001b[0m\u001b[33m\"\u001b[0m, \u001b[96mstr\u001b[0m(ssl_error).lower())) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/\u001b[0m\u001b[1;33mconnectionpool.py\u001b[0m:\u001b[94m726\u001b[0m in \u001b[92murlopen\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 723 \u001b[0m\u001b[2m│ │ │ \u001b[0mresponse = \u001b[96mself\u001b[0m.ResponseCls.from_httplib( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 724 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mhttplib_response, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 725 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mpool=\u001b[96mself\u001b[0m, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 726 \u001b[2m│ │ │ │ \u001b[0mconnection=response_conn, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 727 \u001b[0m\u001b[2m│ │ │ │ \u001b[0mretries=retries, \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 728 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m**response_kw \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 729 \u001b[0m\u001b[2m│ │ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/urllib3/util/\u001b[0m\u001b[1;33mretry.py\u001b[0m:\u001b[94m446\u001b[0m in \u001b[92mincrement\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m443 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[33m\"\"\"Errors that occur after the request has been started, so we should\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m444 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33massume that the server began processing it.\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m445 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m446 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96misinstance\u001b[0m(err, (ReadTimeoutError, ProtocolError)) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m447 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m448 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92m_is_method_retryable\u001b[0m(\u001b[96mself\u001b[0m, method): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m449 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[33m\"\"\"Checks if a given HTTP method should be retried upon, depending if\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mMaxRetryError: \u001b[0m\u001b[1;35mHTTPSConnectionPool\u001b[0m\u001b[1m(\u001b[0m\u001b[33mhost\u001b[0m=\u001b[32m'test-cb41e3b.svc.us-west1-gcp.pinecone.io'\u001b[0m, \u001b[33mport\u001b[0m=\u001b[1;36m443\u001b[0m\u001b[1m)\u001b[0m: Max retries \n", "exceeded with url: \u001b[35m/vectors/\u001b[0m\u001b[95mfetch\u001b[0m?\u001b[33mnamespace\u001b[0m=&\u001b[33mids\u001b[0m=\u001b[35mFff\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mB\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mC\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mDd\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mE\u001b[0m \u001b[1m(\u001b[0mCaused by \u001b[1;35mProtocolError\u001b[0m\u001b[1m(\u001b[0m\u001b[32m'Connection \u001b[0m\n", "\u001b[32maborted.'\u001b[0m, \u001b[1;35mConnectionResetError\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m54\u001b[0m, \u001b[32m'Connection reset by peer'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\n", "\n", "\u001b[3mThe above exception was the direct cause of the following exception:\u001b[0m\n", "\n", "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/\u001b[0m\u001b[1;33m576604747.py\u001b[0m:\u001b[94m1\u001b[0m in \u001b[92m\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m'/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/576604747.py'\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/\u001b[0m\u001b[1;33m132251037.py\u001b[0m:\u001b[94m22\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mcreate_or_update_vectors\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m'/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/132251037.py'\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/pinecone/core/utils/\u001b[0m\u001b[1;33merror_handling.py\u001b[0m:\u001b[94m20\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92minner_func\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m17 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m func(*args, **kwargs) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m18 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mexcept\u001b[0m MaxRetryError \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m19 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mif\u001b[0m \u001b[96misinstance\u001b[0m(e.reason, ProtocolError): \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m20 \u001b[2m│ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m PineconeProtocolError( \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m21 \u001b[0m\u001b[2m│ │ │ │ │ \u001b[0m\u001b[33mf\u001b[0m\u001b[33m'\u001b[0m\u001b[33mFailed to connect to \u001b[0m\u001b[33m{\u001b[0me.url\u001b[33m}\u001b[0m\u001b[33m; did you specify the correct index na\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m22 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94melse\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m23 \u001b[0m\u001b[2m│ │ │ │ \u001b[0m\u001b[94mraise\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mPineconeProtocolError: \u001b[0mFailed to connect to \u001b[35m/vectors/\u001b[0m\u001b[95mfetch\u001b[0m?\u001b[33mnamespace\u001b[0m=&\u001b[33mids\u001b[0m=\u001b[35mFff\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mB\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mC\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mDd\u001b[0m&\u001b[33mids\u001b[0m=\u001b[35mE\u001b[0m; did you \n", "specify the correct index name?\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "p.create_or_update_vectors([\n", " (\"Fff\", [0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] * 32),\n", " (\"B\", [0.2, 0.6, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2] * 32),\n", " (\"C\", [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3] * 32),\n", " (\"Dd\", [0.4, 0.5, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4] * 32),\n", " (\"E\", [0, 0, 0, 0, 0,0,0,0] * 32)\n", "],\n", " namespace=''\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "0c832ffc", "metadata": {}, "outputs": [], "source": [ "pinecone.delete_index('test')" ] }, { "cell_type": "code", "execution_count": null, "id": "35f60552", "metadata": {}, "outputs": [], "source": [ "from sentence_transformers import SentenceTransformer, util\n", "embedder = SentenceTransformer('all-MiniLM-L6-v2')\n", "\n", "# Corpus with example sentences\n", "corpus = ['A man is eating food.',\n", " 'A man is eating a piece of bread.'\n", " ]\n", "corpus_embeddings = embedder.encode(corpus, convert_to_tensor=True)\n", "corpus_embeddings.shape" ] }, { "cell_type": "code", "execution_count": null, "id": "490552ab", "metadata": {}, "outputs": [], "source": [ "\n", "# Query sentences:\n", "queries = ['A man is eating pasta.', 'Someone in a gorilla costume is playing a set of drums.', 'A cheetah chases prey on across a field.']\n", "\n", "\n", "# Find the closest 5 sentences of the corpus for each query sentence based on cosine similarity\n", "top_k = min(5, len(corpus))\n", "for query in queries:\n", " query_embedding = embedder.encode(query, convert_to_tensor=True)\n", "\n", " # We use cosine-similarity and torch.topk to find the highest 5 scores\n", " cos_scores = util.cos_sim(query_embedding, corpus_embeddings)[0]\n", " top_results = torch.topk(cos_scores, k=top_k)\n", " \n", " print(\"\\n\\n======================\\n\\n\")\n", " print(\"Query:\", query)\n", " print(\"\\nTop 5 most similar sentences in corpus:\")\n", "\n", " for score, idx in zip(top_results[0], top_results[1]):\n", " print(corpus[idx], \"(Score: {:.4f})\".format(score))" ] }, { "cell_type": "code", "execution_count": null, "id": "a1404ac0", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 145, "id": "1bd051ae", "metadata": {}, "outputs": [], "source": [ "# Authenticate\n", " \n", " \n", "supabase: Client = create_client(url, key)" ] }, { "cell_type": "code", "execution_count": 146, "id": "41ab7389", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 146, "metadata": {}, "output_type": "execute_result" } ], "source": [ "supabase" ] }, { "cell_type": "code", "execution_count": null, "id": "6dd925e5", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 148, "id": "cdc177ba", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
       " /opt/homebrew/lib/python3.10/site-packages/postgrest/_sync/request_builder.py:62 in execute      \n",
       "                                                                                                  \n",
       "    59 │   │   )                                                                                  \n",
       "    60 │   │                                                                                      \n",
       "    61 │   │   try:                                                                               \n",
       "  62 │   │   │   return APIResponse.from_http_request_response(r)                               \n",
       "    63 │   │   except ValidationError as e:                                                       \n",
       "    64 │   │   │   raise APIError(r.json()) from e                                                \n",
       "    65                                                                                            \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/postgrest/base_request_builder.py:156 in              \n",
       " from_http_request_response                                                                       \n",
       "                                                                                                  \n",
       "   153 │   ) -> APIResponse:                                                                      \n",
       "   154 │   │   data = request_response.json()                                                     \n",
       "   155 │   │   count = cls._get_count_from_http_request_response(request_response)                \n",
       " 156 │   │   return cls(data=data, count=count)                                                 \n",
       "   157                                                                                            \n",
       "   158                                                                                            \n",
       "   159 _FilterT = TypeVar(\"_FilterT\", bound=\"BaseFilterRequestBuilder\")                           \n",
       "                                                                                                  \n",
       " /Users/sinanozdemir/index_demo/pydantic/main.py:342 in pydantic.main.BaseModel.__init__          \n",
       "                                                                                                  \n",
       " [Errno 2] No such file or directory: '/Users/sinanozdemir/index_demo/pydantic/main.py'           \n",
       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "ValidationError: 1 validation error for APIResponse\n",
       "data\n",
       "  You are passing an API error to the data field. (type=value_error)\n",
       "\n",
       "The above exception was the direct cause of the following exception:\n",
       "\n",
       "╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
       " /var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/1568912195.py:3 in <module>     \n",
       "                                                                                                  \n",
       " [Errno 2] No such file or directory:                                                             \n",
       " '/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/1568912195.py'                 \n",
       "                                                                                                  \n",
       " /opt/homebrew/lib/python3.10/site-packages/postgrest/_sync/request_builder.py:64 in execute      \n",
       "                                                                                                  \n",
       "    61 │   │   try:                                                                               \n",
       "    62 │   │   │   return APIResponse.from_http_request_response(r)                               \n",
       "    63 │   │   except ValidationError as e:                                                       \n",
       "  64 │   │   │   raise APIError(r.json()) from e                                                \n",
       "    65                                                                                            \n",
       "    66                                                                                            \n",
       "    67 # ignoring type checking as a workaround for https://github.com/python/mypy/issues/9319    \n",
       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "APIError: {'code': '42P01', 'details': None, 'hint': None, 'message': 'relation \"public.countries\" does not exist'}\n",
       "
\n" ], "text/plain": [ "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/postgrest/_sync/\u001b[0m\u001b[1;33mrequest_builder.py\u001b[0m:\u001b[94m62\u001b[0m in \u001b[92mexecute\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 59 \u001b[0m\u001b[2m│ │ \u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 60 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 61 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 62 \u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m APIResponse.from_http_request_response(r) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 63 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mexcept\u001b[0m ValidationError \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 64 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mraise\u001b[0m APIError(r.json()) \u001b[94mfrom\u001b[0m \u001b[4;96me\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 65 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/postgrest/\u001b[0m\u001b[1;33mbase_request_builder.py\u001b[0m:\u001b[94m156\u001b[0m in \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[92mfrom_http_request_response\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m153 \u001b[0m\u001b[2m│ \u001b[0m) -> APIResponse: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m154 \u001b[0m\u001b[2m│ │ \u001b[0mdata = request_response.json() \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m155 \u001b[0m\u001b[2m│ │ \u001b[0mcount = \u001b[96mcls\u001b[0m._get_count_from_http_request_response(request_response) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m156 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mcls\u001b[0m(data=data, count=count) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m157 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m158 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m159 \u001b[0m_FilterT = TypeVar(\u001b[33m\"\u001b[0m\u001b[33m_FilterT\u001b[0m\u001b[33m\"\u001b[0m, bound=\u001b[33m\"\u001b[0m\u001b[33mBaseFilterRequestBuilder\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/Users/sinanozdemir/index_demo/pydantic/\u001b[0m\u001b[1;33mmain.py\u001b[0m:\u001b[94m342\u001b[0m in \u001b[92mpydantic.main.BaseModel.__init__\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: '/Users/sinanozdemir/index_demo/pydantic/main.py'\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mValidationError: \u001b[0m\u001b[1;36m1\u001b[0m validation error for APIResponse\n", "data\n", " You are passing an API error to the data field. \u001b[1m(\u001b[0m\u001b[33mtype\u001b[0m=\u001b[35mvalue_error\u001b[0m\u001b[1m)\u001b[0m\n", "\n", "\u001b[3mThe above exception was the direct cause of the following exception:\u001b[0m\n", "\n", "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/\u001b[0m\u001b[1;33m1568912195.py\u001b[0m:\u001b[94m3\u001b[0m in \u001b[92m\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[3;31m'/var/folders/y9/9xqbqkg90tnc0cmm0dxt985m0000gn/T/ipykernel_37376/1568912195.py'\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2;33m/opt/homebrew/lib/python3.10/site-packages/postgrest/_sync/\u001b[0m\u001b[1;33mrequest_builder.py\u001b[0m:\u001b[94m64\u001b[0m in \u001b[92mexecute\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 61 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mtry\u001b[0m: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 62 \u001b[0m\u001b[2m│ │ │ \u001b[0m\u001b[94mreturn\u001b[0m APIResponse.from_http_request_response(r) \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 63 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mexcept\u001b[0m ValidationError \u001b[94mas\u001b[0m e: \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 64 \u001b[2m│ │ │ \u001b[0m\u001b[94mraise\u001b[0m APIError(r.json()) \u001b[94mfrom\u001b[0m \u001b[4;96me\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 65 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 66 \u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m│\u001b[0m \u001b[2m 67 \u001b[0m\u001b[2m# ignoring type checking as a workaround for https://github.com/python/mypy/issues/9319\u001b[0m \u001b[31m│\u001b[0m\n", "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", "\u001b[1;91mAPIError: \u001b[0m\u001b[1m{\u001b[0m\u001b[32m'code'\u001b[0m: \u001b[32m'42P01'\u001b[0m, \u001b[32m'details'\u001b[0m: \u001b[3;35mNone\u001b[0m, \u001b[32m'hint'\u001b[0m: \u001b[3;35mNone\u001b[0m, \u001b[32m'message'\u001b[0m: \u001b[32m'relation \"public.countries\" does not exist'\u001b[0m\u001b[1m}\u001b[0m\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Managing Data\n", "# Insertion of Data\n", "data = supabase.table(\"countries\").insert({\"name\":\"Germany\"}).execute()\n", "assert len(data.data) > 0\n", "\n", "data" ] }, { "cell_type": "code", "execution_count": null, "id": "9d103d67", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 208, "id": "9c4f3794", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824']" ] }, "execution_count": 208, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Selection of Data\n", "\n", "data = supabase.table(\"text\").select('hash').filter('hash', 'in' , f'({json.dumps([p.hash_str(text), \"[1:-1]\", \"hi\"])[1:-1]})').execute()\n", "hashs_in_db = [d['hash'] for d in data.data]\n", "hashs_in_db\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e7467667", "metadata": {}, "outputs": [], "source": [ "# is this a general search or are we restricting to given pages??" ] }, { "cell_type": "code", "execution_count": null, "id": "67fad4fe", "metadata": {}, "outputs": [], "source": [ "# to index\n", "# given a list of text and namespace:\n", " # hash them all\n", " # for any hashes not in supabase\n", " # vectorize using encoder\n", " # insert hash, vectors in pinecone namespace\n", " # isnert hash, text, namespace in supabase\n", " \n", "# to query given question, namespace, top_k\n", "# use pinecone to get hashs\n", "# get raw texts" ] } ], "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.10.7" } }, "nbformat": 4, "nbformat_minor": 5 }