daniel.diaz commited on
Commit
f1b6fda
·
1 Parent(s): fd875db

hnsw solution

Browse files
.ipynb_checkpoints/rag_openai_gpt35_ready-checkpoint.ipynb CHANGED
@@ -10,12 +10,455 @@
10
  },
11
  {
12
  "cell_type": "code",
13
- "execution_count": null,
14
  "id": "8bdfd3c8",
15
  "metadata": {
16
  "scrolled": true
17
  },
18
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  "source": [
20
  "\n",
21
  "!pip install --quiet openai langchain faiss-cpu PyPDF2 sentence-transformers joblib\n",
@@ -26,10 +469,18 @@
26
  },
27
  {
28
  "cell_type": "code",
29
- "execution_count": null,
30
  "id": "49ee7721",
31
  "metadata": {},
32
- "outputs": [],
 
 
 
 
 
 
 
 
33
  "source": [
34
  "from PyPDF2 import PdfReader\n",
35
  "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
@@ -49,157 +500,92 @@
49
  },
50
  {
51
  "cell_type": "code",
52
- "execution_count": null,
53
- "id": "8109b626-0179-43e2-b924-65afe9af1e4e",
54
- "metadata": {},
55
- "outputs": [],
56
- "source": [
57
- "import openai"
58
- ]
59
- },
60
- {
61
- "cell_type": "code",
62
- "execution_count": null,
63
  "id": "371c637e",
64
  "metadata": {},
65
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  "source": [
67
- "\n",
68
  "import faiss\n",
69
  "import numpy as np\n",
70
  "import joblib\n",
71
- "\n",
72
- "def get_openai_embeddings(texts):\n",
73
- " embeddings = []\n",
74
- " for text in texts:\n",
75
- " response = openai.Embedding.create(\n",
76
- " model=\"text-embedding-3-small\",\n",
77
- " input=text\n",
78
- " )\n",
79
- " vector = response['data'][0]['embedding']\n",
80
- " embeddings.append(vector)\n",
81
- " return np.array(embeddings)\n",
82
- "\n",
83
- "embeddings = get_openai_embeddings(chunks)\n",
84
- "index = faiss.IndexFlatL2(embeddings.shape[1])\n",
85
- "index.add(np.array(embeddings))\n",
86
- "\n",
87
- "joblib.dump((chunks, index), \"rag_model.joblib\")\n",
88
- "print(\"Chunks and index serialized to rag_model.joblib\")\n"
89
- ]
90
- },
91
- {
92
- "cell_type": "code",
93
- "execution_count": null,
94
- "id": "28ce4963",
95
- "metadata": {},
96
- "outputs": [],
97
- "source": [
98
- "\n",
99
- "import joblib\n",
100
- "chunks, index = joblib.load(\"rag_model.joblib\")\n",
101
- "print(\"Chunks and index loaded from rag_model.joblib\")\n"
102
- ]
103
- },
104
- {
105
- "cell_type": "code",
106
- "execution_count": null,
107
- "id": "51a89e77",
108
- "metadata": {},
109
- "outputs": [],
110
- "source": [
111
- "\n",
112
- "def search(query, k=3):\n",
113
- " response = openai.Embedding.create(\n",
114
- " model=\"text-embedding-3-small\",\n",
115
- " input=query\n",
116
- " )\n",
117
- " query_vec = np.array([response['data'][0]['embedding']])\n",
118
- " scores, indices = index.search(query_vec, k)\n",
119
- " return [chunks[i] for i in indices[0]]\n"
120
- ]
121
- },
122
- {
123
- "cell_type": "code",
124
- "execution_count": null,
125
- "id": "34315775",
126
- "metadata": {},
127
- "outputs": [],
128
- "source": [
129
  "\n",
130
  "import os\n",
 
131
  "import openai\n",
132
  "from openai import OpenAI\n",
 
133
  "\n",
134
- "os.environ[\"OPENAI_API_KEY\"] = os.getenv(\"OPENAI_API_KEY\")\n",
135
  "client = OpenAI()\n",
 
136
  "\n",
137
- "def chat_no_rag(question):\n",
138
- " response = client.chat.completions.create(\n",
139
- " model=\"gpt-3.5-turbo\",\n",
140
- " messages=[\n",
141
- " {\"role\": \"user\", \"content\": question}\n",
142
- " ],\n",
143
- " temperature=0.5,\n",
144
- " max_tokens=200,\n",
 
145
  " )\n",
146
- " return response.choices[0].message.content\n",
 
147
  "\n",
148
- "def chat_with_rag(question, retrieved_chunks):\n",
149
- " context = \"\\n\".join(retrieved_chunks)\n",
150
- " prompt = f\"Usa el siguiente contexto para responder la pregunta:\\n\\n{context}\\n\\nPregunta: {question}\"\n",
151
  "\n",
152
- " response = client.chat.completions.create(\n",
153
- " model=\"gpt-3.5-turbo\",\n",
154
- " messages=[\n",
155
- " {\"role\": \"user\", \"content\": prompt}\n",
156
- " ],\n",
157
- " temperature=0.3,\n",
158
- " max_tokens=200,\n",
159
- " )\n",
160
- " return response.choices[0].message.content\n",
161
  "\n",
162
- "def chat_with_rag_enhanced(question, retrieved_chunks):\n",
163
- " context = \"\\n\".join(retrieved_chunks)\n",
164
- " prompt = (\n",
165
- " \"Eres un experto en historia marcial. \"\n",
166
- " \"Usa el siguiente contexto histórico para responder con precisión y detalle.\\n\\n\"\n",
167
- " f\"Contexto:\\n{context}\\n\\n\"\n",
168
- " f\"Pregunta: {question}\\nRespuesta:\"\n",
169
- " )\n",
170
  "\n",
171
- " response = client.chat.completions.create(\n",
172
- " model=\"gpt-3.5-turbo\",\n",
173
- " messages=[\n",
174
- " {\"role\": \"user\", \"content\": prompt}\n",
175
- " ],\n",
176
- " temperature=0.2,\n",
177
- " max_tokens=200,\n",
178
- " )\n",
179
- " return response.choices[0].message.content\n"
180
  ]
181
  },
182
  {
183
  "cell_type": "code",
184
  "execution_count": null,
185
- "id": "900dfdfa",
186
  "metadata": {},
187
  "outputs": [],
188
- "source": [
189
- "\n",
190
- "# Example query\n",
191
- "query = \"¿Cuál es el origen del JuJutsu en Japón?\"\n",
192
- "retrieved = search(query)\n",
193
- "\n",
194
- "print(\"🔹 Sin RAG:\")\n",
195
- "print(chat_no_rag(query))\n",
196
- "\n",
197
- "print(\"\\n🔹 Con RAG:\")\n",
198
- "print(chat_with_rag(query, retrieved))\n",
199
- "\n",
200
- "print(\"\\n🔹 Con RAG + Prompt mejorado:\")\n",
201
- "print(chat_with_rag_enhanced(query, retrieved))\n"
202
- ]
203
  }
204
  ],
205
  "metadata": {
 
10
  },
11
  {
12
  "cell_type": "code",
13
+ "execution_count": 2,
14
  "id": "8bdfd3c8",
15
  "metadata": {
16
  "scrolled": true
17
  },
18
+ "outputs": [
19
+ {
20
+ "name": "stdout",
21
+ "output_type": "stream",
22
+ "text": [
23
+ "Requirement already satisfied: ipywidgets==7.7.2 in /opt/anaconda3/lib/python3.11/site-packages (7.7.2)\n",
24
+ "Requirement already satisfied: ipykernel>=4.5.1 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (6.28.0)\n",
25
+ "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (0.2.0)\n",
26
+ "Requirement already satisfied: traitlets>=4.3.1 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (5.7.1)\n",
27
+ "Requirement already satisfied: widgetsnbextension~=3.6.0 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (3.6.10)\n",
28
+ "Requirement already satisfied: ipython>=4.0.0 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (8.20.0)\n",
29
+ "Requirement already satisfied: jupyterlab-widgets<3,>=1.0.0 in /opt/anaconda3/lib/python3.11/site-packages (from ipywidgets==7.7.2) (1.1.11)\n",
30
+ "Requirement already satisfied: appnope in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (0.1.2)\n",
31
+ "Requirement already satisfied: comm>=0.1.1 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (0.1.2)\n",
32
+ "Requirement already satisfied: debugpy>=1.6.5 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (1.6.7)\n",
33
+ "Requirement already satisfied: jupyter-client>=6.1.12 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (8.6.0)\n",
34
+ "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (5.5.0)\n",
35
+ "Requirement already satisfied: matplotlib-inline>=0.1 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (0.1.6)\n",
36
+ "Requirement already satisfied: nest-asyncio in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (1.6.0)\n",
37
+ "Requirement already satisfied: packaging in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (23.2)\n",
38
+ "Requirement already satisfied: psutil in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (5.9.0)\n",
39
+ "Requirement already satisfied: pyzmq>=24 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (25.1.2)\n",
40
+ "Requirement already satisfied: tornado>=6.1 in /opt/anaconda3/lib/python3.11/site-packages (from ipykernel>=4.5.1->ipywidgets==7.7.2) (6.3.3)\n",
41
+ "Requirement already satisfied: decorator in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (5.1.1)\n",
42
+ "Requirement already satisfied: jedi>=0.16 in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (0.18.1)\n",
43
+ "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (3.0.43)\n",
44
+ "Requirement already satisfied: pygments>=2.4.0 in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (2.15.1)\n",
45
+ "Requirement already satisfied: stack-data in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (0.2.0)\n",
46
+ "Requirement already satisfied: pexpect>4.3 in /opt/anaconda3/lib/python3.11/site-packages (from ipython>=4.0.0->ipywidgets==7.7.2) (4.8.0)\n",
47
+ "Requirement already satisfied: notebook>=4.4.1 in /opt/anaconda3/lib/python3.11/site-packages (from widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (7.3.2)\n",
48
+ "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/anaconda3/lib/python3.11/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets==7.7.2) (0.8.3)\n",
49
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets==7.7.2) (2.9.0.post0)\n",
50
+ "Requirement already satisfied: platformdirs>=2.5 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel>=4.5.1->ipywidgets==7.7.2) (3.10.0)\n",
51
+ "Requirement already satisfied: jupyter-server<3,>=2.4.0 in /opt/anaconda3/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.10.0)\n",
52
+ "Requirement already satisfied: jupyterlab-server<3,>=2.27.1 in /opt/anaconda3/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.27.3)\n",
53
+ "Requirement already satisfied: jupyterlab<4.4,>=4.3.4 in /opt/anaconda3/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (4.3.4)\n",
54
+ "Requirement already satisfied: notebook-shim<0.3,>=0.2 in /opt/anaconda3/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.2.3)\n",
55
+ "Requirement already satisfied: ptyprocess>=0.5 in /opt/anaconda3/lib/python3.11/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets==7.7.2) (0.7.0)\n",
56
+ "Requirement already satisfied: wcwidth in /opt/anaconda3/lib/python3.11/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=4.0.0->ipywidgets==7.7.2) (0.2.5)\n",
57
+ "Requirement already satisfied: executing in /opt/anaconda3/lib/python3.11/site-packages (from stack-data->ipython>=4.0.0->ipywidgets==7.7.2) (0.8.3)\n",
58
+ "Requirement already satisfied: asttokens in /opt/anaconda3/lib/python3.11/site-packages (from stack-data->ipython>=4.0.0->ipywidgets==7.7.2) (2.0.5)\n",
59
+ "Requirement already satisfied: pure-eval in /opt/anaconda3/lib/python3.11/site-packages (from stack-data->ipython>=4.0.0->ipywidgets==7.7.2) (0.2.2)\n",
60
+ "Requirement already satisfied: anyio>=3.1.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (4.2.0)\n",
61
+ "Requirement already satisfied: argon2-cffi in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (21.3.0)\n",
62
+ "Requirement already satisfied: jinja2 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (3.1.3)\n",
63
+ "Requirement already satisfied: jupyter-events>=0.6.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.8.0)\n",
64
+ "Requirement already satisfied: jupyter-server-terminals in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.4.4)\n",
65
+ "Requirement already satisfied: nbconvert>=6.4.4 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (7.16.3)\n",
66
+ "Requirement already satisfied: nbformat>=5.3.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (5.9.2)\n",
67
+ "Requirement already satisfied: overrides in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (7.4.0)\n",
68
+ "Requirement already satisfied: prometheus-client in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.14.1)\n",
69
+ "Requirement already satisfied: send2trash>=1.8.2 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.8.2)\n",
70
+ "Requirement already satisfied: terminado>=0.8.3 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.17.1)\n",
71
+ "Requirement already satisfied: websocket-client in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.58.0)\n",
72
+ "Requirement already satisfied: async-lru>=1.0.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.0.4)\n",
73
+ "Requirement already satisfied: httpx>=0.25.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.26.0)\n",
74
+ "Requirement already satisfied: jupyter-lsp>=2.0.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.2.0)\n",
75
+ "Requirement already satisfied: setuptools>=40.8.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (68.2.2)\n",
76
+ "Requirement already satisfied: babel>=2.10 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.11.0)\n",
77
+ "Requirement already satisfied: json5>=0.9.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.9.6)\n",
78
+ "Requirement already satisfied: jsonschema>=4.18.0 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (4.19.2)\n",
79
+ "Requirement already satisfied: requests>=2.31 in /opt/anaconda3/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.32.3)\n",
80
+ "Requirement already satisfied: six>=1.5 in /opt/anaconda3/lib/python3.11/site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel>=4.5.1->ipywidgets==7.7.2) (1.17.0)\n",
81
+ "Requirement already satisfied: idna>=2.8 in /opt/anaconda3/lib/python3.11/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (3.4)\n",
82
+ "Requirement already satisfied: sniffio>=1.1 in /opt/anaconda3/lib/python3.11/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.3.0)\n",
83
+ "Requirement already satisfied: pytz>=2015.7 in /opt/anaconda3/lib/python3.11/site-packages (from babel>=2.10->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2025.2)\n",
84
+ "Requirement already satisfied: certifi in /opt/anaconda3/lib/python3.11/site-packages (from httpx>=0.25.0->jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2025.1.31)\n",
85
+ "Requirement already satisfied: httpcore==1.* in /opt/anaconda3/lib/python3.11/site-packages (from httpx>=0.25.0->jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.0.2)\n",
86
+ "Requirement already satisfied: h11<0.15,>=0.13 in /opt/anaconda3/lib/python3.11/site-packages (from httpcore==1.*->httpx>=0.25.0->jupyterlab<4.4,>=4.3.4->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.14.0)\n",
87
+ "Requirement already satisfied: MarkupSafe>=2.0 in /opt/anaconda3/lib/python3.11/site-packages (from jinja2->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.1.3)\n",
88
+ "Requirement already satisfied: attrs>=22.2.0 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (23.1.0)\n",
89
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2023.7.1)\n",
90
+ "Requirement already satisfied: referencing>=0.28.4 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.30.2)\n",
91
+ "Requirement already satisfied: rpds-py>=0.7.1 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.10.6)\n",
92
+ "Requirement already satisfied: python-json-logger>=2.0.4 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.0.7)\n",
93
+ "Requirement already satisfied: pyyaml>=5.3 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (6.0.1)\n",
94
+ "Requirement already satisfied: rfc3339-validator in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.1.4)\n",
95
+ "Requirement already satisfied: rfc3986-validator>=0.1.1 in /opt/anaconda3/lib/python3.11/site-packages (from jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.1.1)\n",
96
+ "Requirement already satisfied: beautifulsoup4 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (4.12.2)\n",
97
+ "Requirement already satisfied: bleach!=5.0.0 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (4.1.0)\n",
98
+ "Requirement already satisfied: defusedxml in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.7.1)\n",
99
+ "Requirement already satisfied: jupyterlab-pygments in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.1.2)\n",
100
+ "Requirement already satisfied: mistune<4,>=2.0.3 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.0.4)\n",
101
+ "Requirement already satisfied: nbclient>=0.5.0 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.8.0)\n",
102
+ "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.5.0)\n",
103
+ "Requirement already satisfied: tinycss2 in /opt/anaconda3/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.2.1)\n",
104
+ "Requirement already satisfied: fastjsonschema in /opt/anaconda3/lib/python3.11/site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.16.2)\n",
105
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/anaconda3/lib/python3.11/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.0.4)\n",
106
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /opt/anaconda3/lib/python3.11/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.27.1->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.0.7)\n",
107
+ "Requirement already satisfied: argon2-cffi-bindings in /opt/anaconda3/lib/python3.11/site-packages (from argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (21.2.0)\n",
108
+ "Requirement already satisfied: webencodings in /opt/anaconda3/lib/python3.11/site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (0.5.1)\n",
109
+ "Requirement already satisfied: fqdn in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.5.1)\n",
110
+ "Requirement already satisfied: isoduration in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (20.11.0)\n",
111
+ "Requirement already satisfied: jsonpointer>1.13 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.1)\n",
112
+ "Requirement already satisfied: uri-template in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.3.0)\n",
113
+ "Requirement already satisfied: webcolors>=1.11 in /opt/anaconda3/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (24.11.1)\n",
114
+ "Requirement already satisfied: cffi>=1.0.1 in /opt/anaconda3/lib/python3.11/site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.16.0)\n",
115
+ "Requirement already satisfied: soupsieve>1.2 in /opt/anaconda3/lib/python3.11/site-packages (from beautifulsoup4->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.5)\n",
116
+ "Requirement already satisfied: pycparser in /opt/anaconda3/lib/python3.11/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (2.21)\n",
117
+ "Requirement already satisfied: arrow>=0.15.0 in /opt/anaconda3/lib/python3.11/site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.6.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.0->ipywidgets==7.7.2) (1.2.3)\n",
118
+ "usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]\n",
119
+ " [--paths] [--json] [--debug]\n",
120
+ " [subcommand]\n",
121
+ "\n",
122
+ "Jupyter: Interactive Computing\n",
123
+ "\n",
124
+ "positional arguments:\n",
125
+ " subcommand the subcommand to launch\n",
126
+ "\n",
127
+ "options:\n",
128
+ " -h, --help show this help message and exit\n",
129
+ " --version show the versions of core jupyter packages and exit\n",
130
+ " --config-dir show Jupyter config dir\n",
131
+ " --data-dir show Jupyter data dir\n",
132
+ " --runtime-dir show Jupyter runtime dir\n",
133
+ " --paths show all Jupyter paths. Add --json for machine-readable\n",
134
+ " format.\n",
135
+ " --json output paths as machine-readable json\n",
136
+ " --debug output debug information about paths\n",
137
+ "\n",
138
+ "Available subcommands: console dejavu events execute kernel kernelspec lab\n",
139
+ "labextension labhub migrate nbconvert notebook qtconsole run server\n",
140
+ "troubleshoot trust\n",
141
+ "\n",
142
+ "Jupyter command `jupyter-nbextension` not found.\n",
143
+ "\u001b[32m[I 2025-06-20 15:36:39.629 ServerApp]\u001b[m Package notebook took 0.0000s to import\n",
144
+ "\u001b[32m[I 2025-06-20 15:36:39.804 ServerApp]\u001b[m Package aext_assistant took 0.1753s to import\n",
145
+ "\u001b[32m[I 2025-06-20 15:36:39.805 ServerApp]\u001b[m Package aext_core took 0.0010s to import\n",
146
+ "\u001b[33m[W 2025-06-20 15:36:39.812 ServerApp]\u001b[m aext_panels | error adding extension (enabled: True): The module 'aext_panels' could not be found (cannot import name 'AuthConfig' from 'anaconda_cloud_auth.client' (/opt/anaconda3/lib/python3.11/site-packages/anaconda_cloud_auth/client.py)). Are you sure the extension is installed?\n",
147
+ " Traceback (most recent call last):\n",
148
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/manager.py\", line 321, in add_extension\n",
149
+ " extpkg = ExtensionPackage(name=extension_name, enabled=enabled)\n",
150
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
151
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/manager.py\", line 185, in __init__\n",
152
+ " self._load_metadata()\n",
153
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/extension/manager.py\", line 200, in _load_metadata\n",
154
+ " raise ExtensionModuleNotFound(msg) from None\n",
155
+ " jupyter_server.extension.utils.ExtensionModuleNotFound: The module 'aext_panels' could not be found (cannot import name 'AuthConfig' from 'anaconda_cloud_auth.client' (/opt/anaconda3/lib/python3.11/site-packages/anaconda_cloud_auth/client.py)). Are you sure the extension is installed?\n",
156
+ "\u001b[32m[I 2025-06-20 15:36:39.814 ServerApp]\u001b[m Package aext_share_notebook took 0.0009s to import\n",
157
+ "\u001b[32m[I 2025-06-20 15:36:39.824 ServerApp]\u001b[m Package jupyter_lsp took 0.0104s to import\n",
158
+ "\u001b[33m[W 2025-06-20 15:36:39.824 ServerApp]\u001b[m A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.\n",
159
+ "\u001b[32m[I 2025-06-20 15:36:39.828 ServerApp]\u001b[m Package jupyter_server_terminals took 0.0042s to import\n",
160
+ "\u001b[32m[I 2025-06-20 15:36:39.829 ServerApp]\u001b[m Package jupyterlab took 0.0000s to import\n",
161
+ "\u001b[32m[I 2025-06-20 15:36:40.122 ServerApp]\u001b[m Package notebook_shim took 0.0000s to import\n",
162
+ "\u001b[33m[W 2025-06-20 15:36:40.122 ServerApp]\u001b[m A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.\n",
163
+ "\u001b[32m[I 2025-06-20 15:36:40.544 ServerApp]\u001b[m Package panel.io.jupyter_server_extension took 0.4215s to import\n",
164
+ "\u001b[32m[I 2025-06-20 15:36:40.544 ServerApp]\u001b[m aext_assistant | extension was successfully linked.\n",
165
+ "\u001b[32m[I 2025-06-20 15:36:40.544 ServerApp]\u001b[m aext_core | extension was successfully linked.\n",
166
+ "\u001b[32m[I 2025-06-20 15:36:40.545 ServerApp]\u001b[m aext_share_notebook | extension was successfully linked.\n",
167
+ "\u001b[32m[I 2025-06-20 15:36:40.545 ServerApp]\u001b[m jupyter_lsp | extension was successfully linked.\n",
168
+ "\u001b[32m[I 2025-06-20 15:36:40.546 ServerApp]\u001b[m jupyter_server_terminals | extension was successfully linked.\n",
169
+ "\u001b[32m[I 2025-06-20 15:36:40.548 ServerApp]\u001b[m jupyterlab | extension was successfully linked.\n",
170
+ "\u001b[32m[I 2025-06-20 15:36:40.549 ServerApp]\u001b[m notebook | extension was successfully linked.\n",
171
+ "\u001b[32m[I 2025-06-20 15:36:40.712 ServerApp]\u001b[m notebook_shim | extension was successfully linked.\n",
172
+ "\u001b[32m[I 2025-06-20 15:36:40.712 ServerApp]\u001b[m panel.io.jupyter_server_extension | extension was successfully linked.\n",
173
+ "\u001b[32m[I 2025-06-20 15:36:40.733 ServerApp]\u001b[m notebook_shim | extension was successfully loaded.\n",
174
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m Registered aext_assistant server extension\n",
175
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m aext_assistant | extension was successfully loaded.\n",
176
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m Registered aext_core server extension\n",
177
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m aext_core | extension was successfully loaded.\n",
178
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m Registered aext_share_notebook_server server extension\n",
179
+ "\u001b[32m[I 2025-06-20 15:36:40.734 ServerApp]\u001b[m aext_share_notebook | extension was successfully loaded.\n",
180
+ "\u001b[32m[I 2025-06-20 15:36:40.735 ServerApp]\u001b[m jupyter_lsp | extension was successfully loaded.\n",
181
+ "\u001b[32m[I 2025-06-20 15:36:40.736 ServerApp]\u001b[m jupyter_server_terminals | extension was successfully loaded.\n",
182
+ "\u001b[32m[I 2025-06-20 15:36:40.738 LabApp]\u001b[m JupyterLab extension loaded from /opt/anaconda3/lib/python3.11/site-packages/jupyterlab\n",
183
+ "\u001b[32m[I 2025-06-20 15:36:40.738 LabApp]\u001b[m JupyterLab application directory is /opt/anaconda3/share/jupyter/lab\n",
184
+ "\u001b[32m[I 2025-06-20 15:36:40.739 LabApp]\u001b[m Extension Manager is 'pypi'.\n",
185
+ "\u001b[32m[I 2025-06-20 15:36:40.755 ServerApp]\u001b[m jupyterlab | extension was successfully loaded.\n",
186
+ "\u001b[32m[I 2025-06-20 15:36:40.757 ServerApp]\u001b[m notebook | extension was successfully loaded.\n",
187
+ "\u001b[32m[I 2025-06-20 15:36:40.758 ServerApp]\u001b[m panel.io.jupyter_server_extension | extension was successfully loaded.\n",
188
+ "\u001b[32m[I 2025-06-20 15:36:40.759 ServerApp]\u001b[m The port 8888 is already in use, trying another port.\n",
189
+ "\u001b[32m[I 2025-06-20 15:36:40.759 ServerApp]\u001b[m The port 8889 is already in use, trying another port.\n",
190
+ "\u001b[32m[I 2025-06-20 15:36:40.759 ServerApp]\u001b[m The port 8890 is already in use, trying another port.\n",
191
+ "\u001b[32m[I 2025-06-20 15:36:40.760 ServerApp]\u001b[m Serving notebooks from local directory: /Users/ddiaz/Desktop/Proyectos_ImageMarker/JuJitsuPOC\n",
192
+ "\u001b[32m[I 2025-06-20 15:36:40.760 ServerApp]\u001b[m Jupyter Server 2.10.0 is running at:\n",
193
+ "\u001b[32m[I 2025-06-20 15:36:40.760 ServerApp]\u001b[m http://localhost:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
194
+ "\u001b[32m[I 2025-06-20 15:36:40.760 ServerApp]\u001b[m http://127.0.0.1:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
195
+ "\u001b[32m[I 2025-06-20 15:36:40.760 ServerApp]\u001b[m Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).\n",
196
+ "\u001b[35m[C 2025-06-20 15:36:40.762 ServerApp]\u001b[m \n",
197
+ " \n",
198
+ " To access the server, open this file in a browser:\n",
199
+ " file:///Users/ddiaz/Library/Jupyter/runtime/jpserver-74191-open.html\n",
200
+ " Or copy and paste one of these URLs:\n",
201
+ " http://localhost:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
202
+ " http://127.0.0.1:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
203
+ "\u001b[32m[I 2025-06-20 15:36:41.078 ServerApp]\u001b[m Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server\n",
204
+ "0.00s - Debugger warning: It seems that frozen modules are being used, which may\n",
205
+ "0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off\n",
206
+ "0.00s - to python to disable frozen modules.\n",
207
+ "0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.\n",
208
+ "\u001b[33m[W 2025-06-20 15:36:42.687 ServerApp]\u001b[m wrote error: 'Forbidden'\n",
209
+ " Traceback (most recent call last):\n",
210
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
211
+ " result = await result\n",
212
+ " ^^^^^^^^^^^^\n",
213
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/aext_assistant_server/handlers.py\", line 117, in get\n",
214
+ " raise HTTPError(403, reason=\"missing nucleus_token\")\n",
215
+ " tornado.web.HTTPError: HTTP 403: missing nucleus_token\n",
216
+ "\u001b[33m[W 2025-06-20 15:36:42.689 ServerApp]\u001b[m 403 GET /aext_assistant_server/nucleus_token?1750455402620 (e1bb6698e462478ab1b1bdda87374748@::1) 3.10ms referer=http://localhost:8891/tree\n",
217
+ "\u001b[33m[W 2025-06-20 15:36:46.989 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455406980 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
218
+ "\u001b[33m[W 2025-06-20 15:36:46.990 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
219
+ " Traceback (most recent call last):\n",
220
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
221
+ " result = await result\n",
222
+ " ^^^^^^^^^^^^\n",
223
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
224
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
225
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
226
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
227
+ " self._check_kernel_id(kernel_id)\n",
228
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
229
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
230
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
231
+ "\u001b[33m[W 2025-06-20 15:36:46.998 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455406980 (e1bb6698e462478ab1b1bdda87374748@::1) 12.23ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
232
+ "\u001b[33m[W 2025-06-20 15:36:47.991 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
233
+ "\u001b[33m[W 2025-06-20 15:36:48.019 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 29.49ms referer=None\n",
234
+ "\u001b[33m[W 2025-06-20 15:36:48.026 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455408020 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
235
+ "\u001b[33m[W 2025-06-20 15:36:48.026 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
236
+ " Traceback (most recent call last):\n",
237
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
238
+ " result = await result\n",
239
+ " ^^^^^^^^^^^^\n",
240
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
241
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
242
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
243
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
244
+ " self._check_kernel_id(kernel_id)\n",
245
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
246
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
247
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
248
+ "\u001b[33m[W 2025-06-20 15:36:48.027 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455408020 (e1bb6698e462478ab1b1bdda87374748@::1) 1.63ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
249
+ "\u001b[33m[W 2025-06-20 15:36:50.989 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455410980 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
250
+ "\u001b[33m[W 2025-06-20 15:36:50.989 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
251
+ " Traceback (most recent call last):\n",
252
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
253
+ " result = await result\n",
254
+ " ^^^^^^^^^^^^\n",
255
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
256
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
257
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
258
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
259
+ " self._check_kernel_id(kernel_id)\n",
260
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
261
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
262
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
263
+ "\u001b[33m[W 2025-06-20 15:36:50.992 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455410980 (e1bb6698e462478ab1b1bdda87374748@::1) 6.25ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
264
+ "\u001b[33m[W 2025-06-20 15:36:50.992 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
265
+ "\u001b[33m[W 2025-06-20 15:36:50.994 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 7.37ms referer=None\n",
266
+ "\u001b[33m[W 2025-06-20 15:36:50.998 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455410995 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
267
+ "\u001b[33m[W 2025-06-20 15:36:50.998 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
268
+ " Traceback (most recent call last):\n",
269
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
270
+ " result = await result\n",
271
+ " ^^^^^^^^^^^^\n",
272
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
273
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
274
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
275
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
276
+ " self._check_kernel_id(kernel_id)\n",
277
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
278
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
279
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
280
+ "\u001b[33m[W 2025-06-20 15:36:50.999 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455410995 (e1bb6698e462478ab1b1bdda87374748@::1) 1.96ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
281
+ "\u001b[33m[W 2025-06-20 15:36:51.990 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
282
+ "\u001b[33m[W 2025-06-20 15:36:51.992 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 3.70ms referer=None\n",
283
+ "\u001b[33m[W 2025-06-20 15:36:51.997 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455411993 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
284
+ "\u001b[33m[W 2025-06-20 15:36:51.997 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
285
+ " Traceback (most recent call last):\n",
286
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
287
+ " result = await result\n",
288
+ " ^^^^^^^^^^^^\n",
289
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
290
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
291
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
292
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
293
+ " self._check_kernel_id(kernel_id)\n",
294
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
295
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
296
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
297
+ "\u001b[33m[W 2025-06-20 15:36:52.000 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455411993 (e1bb6698e462478ab1b1bdda87374748@::1) 3.70ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
298
+ "\u001b[33m[W 2025-06-20 15:36:52.991 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
299
+ "\u001b[33m[W 2025-06-20 15:36:52.992 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 3.42ms referer=None\n",
300
+ "\u001b[33m[W 2025-06-20 15:36:52.998 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455412993 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
301
+ "\u001b[33m[W 2025-06-20 15:36:52.998 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
302
+ " Traceback (most recent call last):\n",
303
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
304
+ " result = await result\n",
305
+ " ^^^^^^^^^^^^\n",
306
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
307
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
308
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
309
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
310
+ " self._check_kernel_id(kernel_id)\n",
311
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
312
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
313
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
314
+ "\u001b[33m[W 2025-06-20 15:36:53.000 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455412993 (e1bb6698e462478ab1b1bdda87374748@::1) 3.60ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
315
+ "\u001b[33m[W 2025-06-20 15:36:57.986 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
316
+ "\u001b[33m[W 2025-06-20 15:36:57.988 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 2.83ms referer=None\n",
317
+ "\u001b[33m[W 2025-06-20 15:36:57.991 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455417989 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
318
+ "\u001b[33m[W 2025-06-20 15:36:57.991 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
319
+ " Traceback (most recent call last):\n",
320
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
321
+ " result = await result\n",
322
+ " ^^^^^^^^^^^^\n",
323
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
324
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
325
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
326
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
327
+ " self._check_kernel_id(kernel_id)\n",
328
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
329
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
330
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
331
+ "\u001b[33m[W 2025-06-20 15:36:57.992 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455417989 (e1bb6698e462478ab1b1bdda87374748@::1) 1.93ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
332
+ "\u001b[33m[W 2025-06-20 15:36:58.994 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
333
+ "\u001b[33m[W 2025-06-20 15:36:58.996 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 3.84ms referer=None\n",
334
+ "\u001b[33m[W 2025-06-20 15:36:59.002 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455418997 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
335
+ "\u001b[33m[W 2025-06-20 15:36:59.002 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
336
+ " Traceback (most recent call last):\n",
337
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
338
+ " result = await result\n",
339
+ " ^^^^^^^^^^^^\n",
340
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
341
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
342
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
343
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
344
+ " self._check_kernel_id(kernel_id)\n",
345
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
346
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
347
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
348
+ "\u001b[33m[W 2025-06-20 15:36:59.004 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455418997 (e1bb6698e462478ab1b1bdda87374748@::1) 2.38ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
349
+ "\u001b[33m[W 2025-06-20 15:37:01.992 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
350
+ "\u001b[33m[W 2025-06-20 15:37:01.994 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 3.18ms referer=None\n",
351
+ "\u001b[33m[W 2025-06-20 15:37:01.998 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455421995 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
352
+ "\u001b[33m[W 2025-06-20 15:37:01.999 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
353
+ " Traceback (most recent call last):\n",
354
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
355
+ " result = await result\n",
356
+ " ^^^^^^^^^^^^\n",
357
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
358
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
359
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
360
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
361
+ " self._check_kernel_id(kernel_id)\n",
362
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
363
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
364
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
365
+ "\u001b[33m[W 2025-06-20 15:37:02.000 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455421995 (e1bb6698e462478ab1b1bdda87374748@::1) 3.65ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
366
+ "\u001b[33m[W 2025-06-20 15:37:04.002 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
367
+ "\u001b[33m[W 2025-06-20 15:37:04.005 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 4.70ms referer=None\n",
368
+ "\u001b[33m[W 2025-06-20 15:37:04.010 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455424007 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
369
+ "\u001b[33m[W 2025-06-20 15:37:04.011 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
370
+ " Traceback (most recent call last):\n",
371
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
372
+ " result = await result\n",
373
+ " ^^^^^^^^^^^^\n",
374
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
375
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
376
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
377
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
378
+ " self._check_kernel_id(kernel_id)\n",
379
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
380
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
381
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
382
+ "\u001b[33m[W 2025-06-20 15:37:04.012 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455424007 (e1bb6698e462478ab1b1bdda87374748@::1) 2.51ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
383
+ "\u001b[33m[W 2025-06-20 15:37:13.014 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
384
+ "\u001b[33m[W 2025-06-20 15:37:13.016 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 4.59ms referer=None\n",
385
+ "\u001b[33m[W 2025-06-20 15:37:13.024 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455433018 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
386
+ "\u001b[33m[W 2025-06-20 15:37:13.024 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
387
+ " Traceback (most recent call last):\n",
388
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
389
+ " result = await result\n",
390
+ " ^^^^^^^^^^^^\n",
391
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
392
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
393
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
394
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
395
+ " self._check_kernel_id(kernel_id)\n",
396
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
397
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
398
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
399
+ "\u001b[33m[W 2025-06-20 15:37:13.026 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455433018 (e1bb6698e462478ab1b1bdda87374748@::1) 3.66ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
400
+ "\u001b[33m[W 2025-06-20 15:37:28.064 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
401
+ "\u001b[33m[W 2025-06-20 15:37:28.066 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 4.62ms referer=None\n",
402
+ "\u001b[33m[W 2025-06-20 15:37:28.073 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455448068 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
403
+ "\u001b[33m[W 2025-06-20 15:37:28.073 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
404
+ " Traceback (most recent call last):\n",
405
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
406
+ " result = await result\n",
407
+ " ^^^^^^^^^^^^\n",
408
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
409
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
410
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
411
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
412
+ " self._check_kernel_id(kernel_id)\n",
413
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
414
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
415
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
416
+ "\u001b[33m[W 2025-06-20 15:37:28.075 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455448068 (e1bb6698e462478ab1b1bdda87374748@::1) 3.14ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
417
+ "\u001b[33m[W 2025-06-20 15:37:40.108 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
418
+ "\u001b[33m[W 2025-06-20 15:37:40.111 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf/channels?session_id=63a22fbe-d2d9-4ed1-b322-a3cecb79555a (e1bb6698e462478ab1b1bdda87374748@::1) 3.90ms referer=None\n",
419
+ "\u001b[33m[W 2025-06-20 15:37:40.118 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455460113 (::1): Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf\n",
420
+ "\u001b[33m[W 2025-06-20 15:37:40.118 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf'\n",
421
+ " Traceback (most recent call last):\n",
422
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
423
+ " result = await result\n",
424
+ " ^^^^^^^^^^^^\n",
425
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
426
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
427
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
428
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
429
+ " self._check_kernel_id(kernel_id)\n",
430
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
431
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
432
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7bbdf51a-7ef3-4011-a075-14e70db1f6bf)\n",
433
+ "\u001b[33m[W 2025-06-20 15:37:40.120 ServerApp]\u001b[m 404 GET /api/kernels/7bbdf51a-7ef3-4011-a075-14e70db1f6bf?1750455460113 (e1bb6698e462478ab1b1bdda87374748@::1) 2.96ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_openai_gpt35_ready.ipynb?\n",
434
+ "\u001b[33m[W 2025-06-20 15:38:08.988 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
435
+ "\u001b[33m[W 2025-06-20 15:38:08.989 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa/channels?session_id=b956cf22-30ff-4115-a9c3-10439728645b (e1bb6698e462478ab1b1bdda87374748@::1) 1.60ms referer=None\n",
436
+ "\u001b[33m[W 2025-06-20 15:38:08.992 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455488990 (::1): Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa\n",
437
+ "\u001b[33m[W 2025-06-20 15:38:08.992 ServerApp]\u001b[m wrote error: 'Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa'\n",
438
+ " Traceback (most recent call last):\n",
439
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/tornado/web.py\", line 1786, in _execute\n",
440
+ " result = await result\n",
441
+ " ^^^^^^^^^^^^\n",
442
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/handlers.py\", line 75, in get\n",
443
+ " model = await ensure_async(km.kernel_model(kernel_id))\n",
444
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
445
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 500, in kernel_model\n",
446
+ " self._check_kernel_id(kernel_id)\n",
447
+ " File \"/opt/anaconda3/lib/python3.11/site-packages/jupyter_server/services/kernels/kernelmanager.py\", line 531, in _check_kernel_id\n",
448
+ " raise web.HTTPError(404, \"Kernel does not exist: %s\" % kernel_id)\n",
449
+ " tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 506aad0a-4f83-4a48-b055-a123e7f186aa)\n",
450
+ "\u001b[33m[W 2025-06-20 15:38:08.992 ServerApp]\u001b[m 404 GET /api/kernels/506aad0a-4f83-4a48-b055-a123e7f186aa?1750455488990 (e1bb6698e462478ab1b1bdda87374748@::1) 1.43ms referer=http://localhost:8891/notebooks/Desktop/Proyectos_ImageMarker/POC-JuJitsu/rag_jujutsu_poc_joblib.ipynb?\n",
451
+ "^C\n",
452
+ "\u001b[32m[I 2025-06-20 15:39:52.966 ServerApp]\u001b[m interrupted\n",
453
+ "\u001b[32m[I 2025-06-20 15:39:52.966 ServerApp]\u001b[m Serving notebooks from local directory: /Users/ddiaz/Desktop/Proyectos_ImageMarker/JuJitsuPOC\n",
454
+ " 0 active kernels\n",
455
+ " Jupyter Server 2.10.0 is running at:\n",
456
+ " http://localhost:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
457
+ " http://127.0.0.1:8891/tree?token=53dae3fcd0d912651e64cf45e29de3d9920a8fdccf3339e8\n",
458
+ "Shutdown this Jupyter server (y/[n])? \u001b[32m[I 2025-06-20 15:39:52.966 ServerApp]\u001b[m resuming operation...\n"
459
+ ]
460
+ }
461
+ ],
462
  "source": [
463
  "\n",
464
  "!pip install --quiet openai langchain faiss-cpu PyPDF2 sentence-transformers joblib\n",
 
469
  },
470
  {
471
  "cell_type": "code",
472
+ "execution_count": 1,
473
  "id": "49ee7721",
474
  "metadata": {},
475
+ "outputs": [
476
+ {
477
+ "name": "stdout",
478
+ "output_type": "stream",
479
+ "text": [
480
+ "Loaded 329 chunks\n"
481
+ ]
482
+ }
483
+ ],
484
  "source": [
485
  "from PyPDF2 import PdfReader\n",
486
  "from langchain.text_splitter import RecursiveCharacterTextSplitter\n",
 
500
  },
501
  {
502
  "cell_type": "code",
503
+ "execution_count": 3,
 
 
 
 
 
 
 
 
 
 
504
  "id": "371c637e",
505
  "metadata": {},
506
+ "outputs": [
507
+ {
508
+ "ename": "KeyboardInterrupt",
509
+ "evalue": "",
510
+ "output_type": "error",
511
+ "traceback": [
512
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
513
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
514
+ "Cell \u001b[0;32mIn[3], line 20\u001b[0m\n\u001b[1;32m 18\u001b[0m embeddings \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m chunk \u001b[38;5;129;01min\u001b[39;00m chunks:\n\u001b[0;32m---> 20\u001b[0m response \u001b[38;5;241m=\u001b[39m client\u001b[38;5;241m.\u001b[39membeddings\u001b[38;5;241m.\u001b[39mcreate(\n\u001b[1;32m 21\u001b[0m model\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext-embedding-3-small\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 22\u001b[0m \u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39mchunk\n\u001b[1;32m 23\u001b[0m )\n\u001b[1;32m 24\u001b[0m embedding \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marray(response\u001b[38;5;241m.\u001b[39mdata[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m.\u001b[39membedding, dtype\u001b[38;5;241m=\u001b[39mnp\u001b[38;5;241m.\u001b[39mfloat32)\n\u001b[1;32m 25\u001b[0m embeddings\u001b[38;5;241m.\u001b[39mappend(embedding)\n",
515
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/openai/resources/embeddings.py:129\u001b[0m, in \u001b[0;36mEmbeddings.create\u001b[0;34m(self, input, model, dimensions, encoding_format, user, extra_headers, extra_query, extra_body, timeout)\u001b[0m\n\u001b[1;32m 123\u001b[0m embedding\u001b[38;5;241m.\u001b[39membedding \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mfrombuffer( \u001b[38;5;66;03m# type: ignore[no-untyped-call]\u001b[39;00m\n\u001b[1;32m 124\u001b[0m base64\u001b[38;5;241m.\u001b[39mb64decode(data), dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfloat32\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 125\u001b[0m )\u001b[38;5;241m.\u001b[39mtolist()\n\u001b[1;32m 127\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj\n\u001b[0;32m--> 129\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_post(\n\u001b[1;32m 130\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/embeddings\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 131\u001b[0m body\u001b[38;5;241m=\u001b[39mmaybe_transform(params, embedding_create_params\u001b[38;5;241m.\u001b[39mEmbeddingCreateParams),\n\u001b[1;32m 132\u001b[0m options\u001b[38;5;241m=\u001b[39mmake_request_options(\n\u001b[1;32m 133\u001b[0m extra_headers\u001b[38;5;241m=\u001b[39mextra_headers,\n\u001b[1;32m 134\u001b[0m extra_query\u001b[38;5;241m=\u001b[39mextra_query,\n\u001b[1;32m 135\u001b[0m extra_body\u001b[38;5;241m=\u001b[39mextra_body,\n\u001b[1;32m 136\u001b[0m timeout\u001b[38;5;241m=\u001b[39mtimeout,\n\u001b[1;32m 137\u001b[0m post_parser\u001b[38;5;241m=\u001b[39mparser,\n\u001b[1;32m 138\u001b[0m ),\n\u001b[1;32m 139\u001b[0m cast_to\u001b[38;5;241m=\u001b[39mCreateEmbeddingResponse,\n\u001b[1;32m 140\u001b[0m )\n",
516
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py:1242\u001b[0m, in \u001b[0;36mSyncAPIClient.post\u001b[0;34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[0m\n\u001b[1;32m 1228\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpost\u001b[39m(\n\u001b[1;32m 1229\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1230\u001b[0m path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1237\u001b[0m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 1238\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m ResponseT \u001b[38;5;241m|\u001b[39m _StreamT:\n\u001b[1;32m 1239\u001b[0m opts \u001b[38;5;241m=\u001b[39m FinalRequestOptions\u001b[38;5;241m.\u001b[39mconstruct(\n\u001b[1;32m 1240\u001b[0m method\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpost\u001b[39m\u001b[38;5;124m\"\u001b[39m, url\u001b[38;5;241m=\u001b[39mpath, json_data\u001b[38;5;241m=\u001b[39mbody, files\u001b[38;5;241m=\u001b[39mto_httpx_files(files), \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39moptions\n\u001b[1;32m 1241\u001b[0m )\n\u001b[0;32m-> 1242\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrequest(cast_to, opts, stream\u001b[38;5;241m=\u001b[39mstream, stream_cls\u001b[38;5;241m=\u001b[39mstream_cls))\n",
517
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/openai/_base_client.py:972\u001b[0m, in \u001b[0;36mSyncAPIClient.request\u001b[0;34m(self, cast_to, options, stream, stream_cls)\u001b[0m\n\u001b[1;32m 970\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 971\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 972\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_client\u001b[38;5;241m.\u001b[39msend(\n\u001b[1;32m 973\u001b[0m request,\n\u001b[1;32m 974\u001b[0m stream\u001b[38;5;241m=\u001b[39mstream \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_should_stream_response_body(request\u001b[38;5;241m=\u001b[39mrequest),\n\u001b[1;32m 975\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 976\u001b[0m )\n\u001b[1;32m 977\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m httpx\u001b[38;5;241m.\u001b[39mTimeoutException \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 978\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mEncountered httpx.TimeoutException\u001b[39m\u001b[38;5;124m\"\u001b[39m, exc_info\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
518
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpx/_client.py:915\u001b[0m, in \u001b[0;36mClient.send\u001b[0;34m(self, request, stream, auth, follow_redirects)\u001b[0m\n\u001b[1;32m 907\u001b[0m follow_redirects \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 908\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfollow_redirects\n\u001b[1;32m 909\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(follow_redirects, UseClientDefault)\n\u001b[1;32m 910\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m follow_redirects\n\u001b[1;32m 911\u001b[0m )\n\u001b[1;32m 913\u001b[0m auth \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_build_request_auth(request, auth)\n\u001b[0;32m--> 915\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_send_handling_auth(\n\u001b[1;32m 916\u001b[0m request,\n\u001b[1;32m 917\u001b[0m auth\u001b[38;5;241m=\u001b[39mauth,\n\u001b[1;32m 918\u001b[0m follow_redirects\u001b[38;5;241m=\u001b[39mfollow_redirects,\n\u001b[1;32m 919\u001b[0m history\u001b[38;5;241m=\u001b[39m[],\n\u001b[1;32m 920\u001b[0m )\n\u001b[1;32m 921\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 922\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n",
519
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpx/_client.py:943\u001b[0m, in \u001b[0;36mClient._send_handling_auth\u001b[0;34m(self, request, auth, follow_redirects, history)\u001b[0m\n\u001b[1;32m 940\u001b[0m request \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[1;32m 942\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 943\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_send_handling_redirects(\n\u001b[1;32m 944\u001b[0m request,\n\u001b[1;32m 945\u001b[0m follow_redirects\u001b[38;5;241m=\u001b[39mfollow_redirects,\n\u001b[1;32m 946\u001b[0m history\u001b[38;5;241m=\u001b[39mhistory,\n\u001b[1;32m 947\u001b[0m )\n\u001b[1;32m 948\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 949\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
520
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpx/_client.py:980\u001b[0m, in \u001b[0;36mClient._send_handling_redirects\u001b[0;34m(self, request, follow_redirects, history)\u001b[0m\n\u001b[1;32m 977\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 978\u001b[0m hook(request)\n\u001b[0;32m--> 980\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_send_single_request(request)\n\u001b[1;32m 981\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 982\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",
521
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpx/_client.py:1016\u001b[0m, in \u001b[0;36mClient._send_single_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 1011\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 1012\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 1013\u001b[0m )\n\u001b[1;32m 1015\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request\u001b[38;5;241m=\u001b[39mrequest):\n\u001b[0;32m-> 1016\u001b[0m response \u001b[38;5;241m=\u001b[39m transport\u001b[38;5;241m.\u001b[39mhandle_request(request)\n\u001b[1;32m 1018\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response\u001b[38;5;241m.\u001b[39mstream, SyncByteStream)\n\u001b[1;32m 1020\u001b[0m response\u001b[38;5;241m.\u001b[39mrequest \u001b[38;5;241m=\u001b[39m request\n",
522
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpx/_transports/default.py:231\u001b[0m, in \u001b[0;36mHTTPTransport.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 218\u001b[0m req \u001b[38;5;241m=\u001b[39m httpcore\u001b[38;5;241m.\u001b[39mRequest(\n\u001b[1;32m 219\u001b[0m method\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mmethod,\n\u001b[1;32m 220\u001b[0m url\u001b[38;5;241m=\u001b[39mhttpcore\u001b[38;5;241m.\u001b[39mURL(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 228\u001b[0m extensions\u001b[38;5;241m=\u001b[39mrequest\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 229\u001b[0m )\n\u001b[1;32m 230\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[0;32m--> 231\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_pool\u001b[38;5;241m.\u001b[39mhandle_request(req)\n\u001b[1;32m 233\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp\u001b[38;5;241m.\u001b[39mstream, typing\u001b[38;5;241m.\u001b[39mIterable)\n\u001b[1;32m 235\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Response(\n\u001b[1;32m 236\u001b[0m status_code\u001b[38;5;241m=\u001b[39mresp\u001b[38;5;241m.\u001b[39mstatus,\n\u001b[1;32m 237\u001b[0m headers\u001b[38;5;241m=\u001b[39mresp\u001b[38;5;241m.\u001b[39mheaders,\n\u001b[1;32m 238\u001b[0m stream\u001b[38;5;241m=\u001b[39mResponseStream(resp\u001b[38;5;241m.\u001b[39mstream),\n\u001b[1;32m 239\u001b[0m extensions\u001b[38;5;241m=\u001b[39mresp\u001b[38;5;241m.\u001b[39mextensions,\n\u001b[1;32m 240\u001b[0m )\n",
523
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:268\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m ShieldCancellation():\n\u001b[1;32m 267\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mresponse_closed(status)\n\u001b[0;32m--> 268\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 269\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 270\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
524
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py:251\u001b[0m, in \u001b[0;36mConnectionPool.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 248\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[1;32m 250\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 251\u001b[0m response \u001b[38;5;241m=\u001b[39m connection\u001b[38;5;241m.\u001b[39mhandle_request(request)\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[1;32m 253\u001b[0m \u001b[38;5;66;03m# The ConnectionNotAvailable exception is a special case, that\u001b[39;00m\n\u001b[1;32m 254\u001b[0m \u001b[38;5;66;03m# indicates we need to retry the request on a new connection.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[38;5;66;03m# might end up as an HTTP/2 connection, but which actually ends\u001b[39;00m\n\u001b[1;32m 259\u001b[0m \u001b[38;5;66;03m# up as HTTP/1.1.\u001b[39;00m\n\u001b[1;32m 260\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_pool_lock:\n\u001b[1;32m 261\u001b[0m \u001b[38;5;66;03m# Maintain our position in the request queue, but reset the\u001b[39;00m\n\u001b[1;32m 262\u001b[0m \u001b[38;5;66;03m# status so that the request becomes queued again.\u001b[39;00m\n",
525
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/connection.py:103\u001b[0m, in \u001b[0;36mHTTPConnection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 100\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mis_available():\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ConnectionNotAvailable()\n\u001b[0;32m--> 103\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_connection\u001b[38;5;241m.\u001b[39mhandle_request(request)\n",
526
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py:133\u001b[0m, in \u001b[0;36mHTTP11Connection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 131\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mresponse_closed\u001b[39m\u001b[38;5;124m\"\u001b[39m, logger, request) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[1;32m 132\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_response_closed()\n\u001b[0;32m--> 133\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m exc\n",
527
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py:111\u001b[0m, in \u001b[0;36mHTTP11Connection.handle_request\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[1;32m 103\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\n\u001b[1;32m 104\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mreceive_response_headers\u001b[39m\u001b[38;5;124m\"\u001b[39m, logger, request, kwargs\n\u001b[1;32m 105\u001b[0m ) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[1;32m 106\u001b[0m (\n\u001b[1;32m 107\u001b[0m http_version,\n\u001b[1;32m 108\u001b[0m status,\n\u001b[1;32m 109\u001b[0m reason_phrase,\n\u001b[1;32m 110\u001b[0m headers,\n\u001b[0;32m--> 111\u001b[0m ) \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_receive_response_headers(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 112\u001b[0m trace\u001b[38;5;241m.\u001b[39mreturn_value \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 113\u001b[0m http_version,\n\u001b[1;32m 114\u001b[0m status,\n\u001b[1;32m 115\u001b[0m reason_phrase,\n\u001b[1;32m 116\u001b[0m headers,\n\u001b[1;32m 117\u001b[0m )\n\u001b[1;32m 119\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m Response(\n\u001b[1;32m 120\u001b[0m status\u001b[38;5;241m=\u001b[39mstatus,\n\u001b[1;32m 121\u001b[0m headers\u001b[38;5;241m=\u001b[39mheaders,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 127\u001b[0m },\n\u001b[1;32m 128\u001b[0m )\n",
528
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py:176\u001b[0m, in \u001b[0;36mHTTP11Connection._receive_response_headers\u001b[0;34m(self, request)\u001b[0m\n\u001b[1;32m 173\u001b[0m timeout \u001b[38;5;241m=\u001b[39m timeouts\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mread\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 175\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 176\u001b[0m event \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_receive_event(timeout\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 177\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(event, h11\u001b[38;5;241m.\u001b[39mResponse):\n\u001b[1;32m 178\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
529
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_sync/http11.py:212\u001b[0m, in \u001b[0;36mHTTP11Connection._receive_event\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 209\u001b[0m event \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_h11_state\u001b[38;5;241m.\u001b[39mnext_event()\n\u001b[1;32m 211\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m event \u001b[38;5;129;01mis\u001b[39;00m h11\u001b[38;5;241m.\u001b[39mNEED_DATA:\n\u001b[0;32m--> 212\u001b[0m data \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_network_stream\u001b[38;5;241m.\u001b[39mread(\n\u001b[1;32m 213\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mREAD_NUM_BYTES, timeout\u001b[38;5;241m=\u001b[39mtimeout\n\u001b[1;32m 214\u001b[0m )\n\u001b[1;32m 216\u001b[0m \u001b[38;5;66;03m# If we feed this case through h11 we'll raise an exception like:\u001b[39;00m\n\u001b[1;32m 217\u001b[0m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;66;03m# httpcore.RemoteProtocolError: can't handle event type\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 222\u001b[0m \u001b[38;5;66;03m# perspective. Instead we handle this case distinctly and treat\u001b[39;00m\n\u001b[1;32m 223\u001b[0m \u001b[38;5;66;03m# it as a ConnectError.\u001b[39;00m\n\u001b[1;32m 224\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m data \u001b[38;5;241m==\u001b[39m \u001b[38;5;124mb\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_h11_state\u001b[38;5;241m.\u001b[39mtheir_state \u001b[38;5;241m==\u001b[39m h11\u001b[38;5;241m.\u001b[39mSEND_RESPONSE:\n",
530
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/site-packages/httpcore/_backends/sync.py:126\u001b[0m, in \u001b[0;36mSyncStream.read\u001b[0;34m(self, max_bytes, timeout)\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[1;32m 125\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sock\u001b[38;5;241m.\u001b[39msettimeout(timeout)\n\u001b[0;32m--> 126\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sock\u001b[38;5;241m.\u001b[39mrecv(max_bytes)\n",
531
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/ssl.py:1296\u001b[0m, in \u001b[0;36mSSLSocket.recv\u001b[0;34m(self, buflen, flags)\u001b[0m\n\u001b[1;32m 1292\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m flags \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 1293\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 1294\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon-zero flags not allowed in calls to recv() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m\n\u001b[1;32m 1295\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m)\n\u001b[0;32m-> 1296\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mread(buflen)\n\u001b[1;32m 1297\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1298\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mrecv(buflen, flags)\n",
532
+ "File \u001b[0;32m/opt/anaconda3/lib/python3.11/ssl.py:1169\u001b[0m, in \u001b[0;36mSSLSocket.read\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1167\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mread(\u001b[38;5;28mlen\u001b[39m, buffer)\n\u001b[1;32m 1168\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1169\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mread(\u001b[38;5;28mlen\u001b[39m)\n\u001b[1;32m 1170\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SSLError \u001b[38;5;28;01mas\u001b[39;00m x:\n\u001b[1;32m 1171\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m x\u001b[38;5;241m.\u001b[39margs[\u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m==\u001b[39m SSL_ERROR_EOF \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msuppress_ragged_eofs:\n",
533
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
534
+ ]
535
+ }
536
+ ],
537
  "source": [
538
+ "import openai\n",
539
  "import faiss\n",
540
  "import numpy as np\n",
541
  "import joblib\n",
542
+ "import hnswlib\n",
543
+ "from openai import OpenAI\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  "\n",
545
  "import os\n",
546
+ "\n",
547
  "import openai\n",
548
  "from openai import OpenAI\n",
549
+ "os.environ[\"OPENAI_API_KEY\"] = \"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\"\n",
550
  "\n",
 
551
  "client = OpenAI()\n",
552
+ "# 2. Define embedding function\n",
553
  "\n",
554
+ "# 2. Get embeddings from OpenAI (batching for efficiency)\n",
555
+ "batch_size = 20 # You can adjust this value depending on limits\n",
556
+ "embeddings = []\n",
557
+ "\n",
558
+ "for i in range(0, len(chunks), batch_size):\n",
559
+ " batch = chunks[i:i + batch_size]\n",
560
+ " response = client.embeddings.create(\n",
561
+ " model=\"text-embedding-3-small\",\n",
562
+ " input=batch\n",
563
  " )\n",
564
+ " batch_embeddings = [np.array(res.embedding, dtype=np.float32) for res in response.data]\n",
565
+ " embeddings.extend(batch_embeddings)\n",
566
  "\n",
567
+ "embeddings = np.vstack(embeddings)\n",
 
 
568
  "\n",
 
 
 
 
 
 
 
 
 
569
  "\n",
570
+ "# 3. Build HNSWlib index\n",
571
+ "dim = embeddings.shape[1]\n",
572
+ "p = hnswlib.Index(space='l2', dim=dim)\n",
573
+ "p.init_index(max_elements=len(embeddings), ef_construction=200, M=16)\n",
574
+ "p.add_items(embeddings)\n",
575
+ "p.set_ef(10)\n",
 
 
576
  "\n",
577
+ "# 4. Save serialized model\n",
578
+ "joblib.dump({\"chunks\": chunks, \"index\": p}, \"rag_model_hnsw.joblib\")\n",
579
+ "print(\"✅ HNSW RAG model saved to rag_model_hnsw.joblib\")"
 
 
 
 
 
 
580
  ]
581
  },
582
  {
583
  "cell_type": "code",
584
  "execution_count": null,
585
+ "id": "b633d481-e061-4192-b66c-32685939d688",
586
  "metadata": {},
587
  "outputs": [],
588
+ "source": []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
589
  }
590
  ],
591
  "metadata": {
rag_model_hnsw.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61de7477e5b0fe41ff9cb6e07becd3a3674400aa56de92389d851426794548db
3
+ size 2240643
requirements.txt CHANGED
@@ -1,7 +1,5 @@
1
- openai
2
  streamlit
3
- langchain
4
- PyPDF2
5
- faiss-cpu
6
- sentence-transformers
7
- joblib
 
 
1
  streamlit
2
+ openai
3
+ numpy
4
+ joblib
5
+ hnswlib