Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit d1d0e1c

Browse files
author
Rossdan Craig [email protected]
committed
RAG Guide: Comment out set_css logic that breaks for Jupyter notebooks
I noticed that this was breaking for when I was running this in Jupyter notebooks. I also noticed we had comments in the notebook saying `# Uncomment for Google Colab to ...` so figured we could do the same here. If you don't like it, no worries ## Test Plan Before it wasn't working, and we got these errors ``` Error in callback <function set_css at 0x33e33d260> (for pre_run_cell), with arguments args (<ExecutionInfo object at 33e35b110, raw_cell="raw_documents = [ { "title": "Text Emb.." store_history=True silent=False shell_futures=True cell_id=vscode-notebook-cell:/Users/rossdancraig/Projects/cohere-notebooks/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb#X13sZmlsZQ%3D%3D>,),kwargs {}: ``` ``` { "name": "TypeError", "message": "set_css() takes 0 positional arguments but 1 was given", "stack": "--------------------------------------------------------------------------- TypeError Traceback (most recent call last) TypeError: set_css() takes 0 positional arguments but 1 was given" } ``` Now it works!
1 parent be9ac87 commit d1d0e1c

File tree

1 file changed

+22
-186
lines changed

1 file changed

+22
-186
lines changed

notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb

Lines changed: 22 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -127,46 +127,28 @@
127127
},
128128
{
129129
"cell_type": "code",
130-
"execution_count": 3,
130+
"execution_count": 4,
131131
"id": "Dx1cncziCWBB",
132132
"metadata": {
133133
"cellView": "form",
134134
"id": "Dx1cncziCWBB"
135135
},
136-
"outputs": [
137-
{
138-
"data": {
139-
"text/html": [
140-
"\n",
141-
" <style>\n",
142-
" pre {\n",
143-
" white-space: pre-wrap;\n",
144-
" }\n",
145-
" </style>\n",
146-
" "
147-
],
148-
"text/plain": [
149-
"<IPython.core.display.HTML object>"
150-
]
151-
},
152-
"metadata": {},
153-
"output_type": "display_data"
154-
}
155-
],
136+
"outputs": [],
156137
"source": [
157-
"#@title Enable text wrapping in Google Colab\n",
158-
"\n",
159-
"from IPython.display import HTML, display\n",
160-
"\n",
161-
"def set_css():\n",
162-
" display(HTML('''\n",
163-
" <style>\n",
164-
" pre {\n",
165-
" white-space: pre-wrap;\n",
166-
" }\n",
167-
" </style>\n",
168-
" '''))\n",
169-
"get_ipython().events.register('pre_run_cell', set_css)"
138+
"# #@title Enable text wrapping in Google Colab\n",
139+
"# Uncomment the code below for Google Colab\n",
140+
"\n",
141+
"# from IPython.display import HTML, display\n",
142+
"\n",
143+
"# def set_css():\n",
144+
"# display(HTML('''\n",
145+
"# <style>\n",
146+
"# pre {\n",
147+
"# white-space: pre-wrap;\n",
148+
"# }\n",
149+
"# </style>\n",
150+
"# '''))\n",
151+
"# get_ipython().events.register('pre_run_cell', set_css)"
170152
]
171153
},
172154
{
@@ -183,7 +165,7 @@
183165
},
184166
{
185167
"cell_type": "code",
186-
"execution_count": 4,
168+
"execution_count": 5,
187169
"id": "3dca4a88",
188170
"metadata": {
189171
"colab": {
@@ -193,44 +175,7 @@
193175
"id": "3dca4a88",
194176
"outputId": "b05da1ee-0456-4387-c232-a43e0ffed54c"
195177
},
196-
"outputs": [
197-
{
198-
"data": {
199-
"text/html": [
200-
"\n",
201-
" <style>\n",
202-
" pre {\n",
203-
" white-space: pre-wrap;\n",
204-
" }\n",
205-
" </style>\n",
206-
" "
207-
],
208-
"text/plain": [
209-
"<IPython.core.display.HTML object>"
210-
]
211-
},
212-
"metadata": {},
213-
"output_type": "display_data"
214-
},
215-
{
216-
"data": {
217-
"text/html": [
218-
"\n",
219-
" <style>\n",
220-
" pre {\n",
221-
" white-space: pre-wrap;\n",
222-
" }\n",
223-
" </style>\n",
224-
" "
225-
],
226-
"text/plain": [
227-
"<IPython.core.display.HTML object>"
228-
]
229-
},
230-
"metadata": {},
231-
"output_type": "display_data"
232-
}
233-
],
178+
"outputs": [],
234179
"source": [
235180
"raw_documents = [\n",
236181
" {\n",
@@ -276,7 +221,7 @@
276221
},
277222
{
278223
"cell_type": "code",
279-
"execution_count": 113,
224+
"execution_count": 6,
280225
"id": "7c33412c",
281226
"metadata": {
282227
"colab": {
@@ -286,44 +231,7 @@
286231
"id": "7c33412c",
287232
"outputId": "cf04f8ed-8000-4433-f976-2d37747f21e7"
288233
},
289-
"outputs": [
290-
{
291-
"data": {
292-
"text/html": [
293-
"\n",
294-
" <style>\n",
295-
" pre {\n",
296-
" white-space: pre-wrap;\n",
297-
" }\n",
298-
" </style>\n",
299-
" "
300-
],
301-
"text/plain": [
302-
"<IPython.core.display.HTML object>"
303-
]
304-
},
305-
"metadata": {},
306-
"output_type": "display_data"
307-
},
308-
{
309-
"data": {
310-
"text/html": [
311-
"\n",
312-
" <style>\n",
313-
" pre {\n",
314-
" white-space: pre-wrap;\n",
315-
" }\n",
316-
" </style>\n",
317-
" "
318-
],
319-
"text/plain": [
320-
"<IPython.core.display.HTML object>"
321-
]
322-
},
323-
"metadata": {},
324-
"output_type": "display_data"
325-
}
326-
],
234+
"outputs": [],
327235
"source": [
328236
"class Vectorstore:\n",
329237
" \"\"\"\n",
@@ -477,7 +385,7 @@
477385
},
478386
{
479387
"cell_type": "code",
480-
"execution_count": 114,
388+
"execution_count": 7,
481389
"id": "4643e630",
482390
"metadata": {
483391
"colab": {
@@ -488,42 +396,6 @@
488396
"outputId": "fe01fcb6-3574-4322-d8d0-57d37aad397d"
489397
},
490398
"outputs": [
491-
{
492-
"data": {
493-
"text/html": [
494-
"\n",
495-
" <style>\n",
496-
" pre {\n",
497-
" white-space: pre-wrap;\n",
498-
" }\n",
499-
" </style>\n",
500-
" "
501-
],
502-
"text/plain": [
503-
"<IPython.core.display.HTML object>"
504-
]
505-
},
506-
"metadata": {},
507-
"output_type": "display_data"
508-
},
509-
{
510-
"data": {
511-
"text/html": [
512-
"\n",
513-
" <style>\n",
514-
" pre {\n",
515-
" white-space: pre-wrap;\n",
516-
" }\n",
517-
" </style>\n",
518-
" "
519-
],
520-
"text/plain": [
521-
"<IPython.core.display.HTML object>"
522-
]
523-
},
524-
"metadata": {},
525-
"output_type": "display_data"
526-
},
527399
{
528400
"name": "stdout",
529401
"output_type": "stream",
@@ -578,7 +450,7 @@
578450
},
579451
{
580452
"cell_type": "code",
581-
"execution_count": 115,
453+
"execution_count": 8,
582454
"id": "82617b91",
583455
"metadata": {
584456
"colab": {
@@ -589,42 +461,6 @@
589461
"outputId": "7f1f2bc8-8ed9-4190-bd6b-7af2d9dc1980"
590462
},
591463
"outputs": [
592-
{
593-
"data": {
594-
"text/html": [
595-
"\n",
596-
" <style>\n",
597-
" pre {\n",
598-
" white-space: pre-wrap;\n",
599-
" }\n",
600-
" </style>\n",
601-
" "
602-
],
603-
"text/plain": [
604-
"<IPython.core.display.HTML object>"
605-
]
606-
},
607-
"metadata": {},
608-
"output_type": "display_data"
609-
},
610-
{
611-
"data": {
612-
"text/html": [
613-
"\n",
614-
" <style>\n",
615-
" pre {\n",
616-
" white-space: pre-wrap;\n",
617-
" }\n",
618-
" </style>\n",
619-
" "
620-
],
621-
"text/plain": [
622-
"<IPython.core.display.HTML object>"
623-
]
624-
},
625-
"metadata": {},
626-
"output_type": "display_data"
627-
},
628464
{
629465
"data": {
630466
"text/plain": [

0 commit comments

Comments
 (0)