Skip to content

Commit 0eb1e04

Browse files
committed
tutorial adjustment
1 parent 48fe470 commit 0eb1e04

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

docs/docs/tutorials/rag/index.ipynb

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"\n",
9595
"\n",
9696
"\n",
97-
"\u001b[34m[2024-11-23T22:12:48.901453]\u001b[0m\n",
97+
"\u001b[34m[2024-11-23T23:16:35.966534]\u001b[0m\n",
9898
"\n",
9999
"\u001b[31mSystem message:\u001b[0m\n",
100100
"\n",
@@ -404,7 +404,7 @@
404404
"\n",
405405
"\n",
406406
"\n",
407-
"\u001b[34m[2024-11-23T22:12:49.329836]\u001b[0m\n",
407+
"\u001b[34m[2024-11-23T23:16:36.149518]\u001b[0m\n",
408408
"\n",
409409
"\u001b[31mSystem message:\u001b[0m\n",
410410
"\n",
@@ -527,14 +527,14 @@
527527
"name": "stdout",
528528
"output_type": "stream",
529529
"text": [
530-
"Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 598.18it/s]"
530+
"Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 666.96it/s]"
531531
]
532532
},
533533
{
534534
"name": "stderr",
535535
"output_type": "stream",
536536
"text": [
537-
"2024/11/23 22:12:49 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n"
537+
"2024/11/23 23:16:36 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n"
538538
]
539539
},
540540
{
@@ -699,13 +699,24 @@
699699
"source": [
700700
"## Set up your system's retriever.\n",
701701
"\n",
702-
"As far as DSPy is concerned, you can plug in any Python code for calling tools or retrievers. Here, we'll just use OpenAI Embeddings and do top-K search locally, just for convenience."
702+
"As far as DSPy is concerned, you can plug in any Python code for calling tools or retrievers. Here, we'll just use OpenAI Embeddings and do top-K search locally, just for convenience.\n",
703+
"\n",
704+
"**Note:** The step below will require that you either do `pip install -U faiss-cpu` or pass `brute_force_threshold=30_000` to `dspy.retrievers.Embeddings` to avoid faiss."
703705
]
704706
},
705707
{
706708
"cell_type": "code",
707709
"execution_count": 13,
708710
"metadata": {},
711+
"outputs": [],
712+
"source": [
713+
"# %pip install -U faiss-cpu # or faiss-gpu if you have a GPU"
714+
]
715+
},
716+
{
717+
"cell_type": "code",
718+
"execution_count": 14,
719+
"metadata": {},
709720
"outputs": [
710721
{
711722
"name": "stdout",
@@ -744,7 +755,7 @@
744755
},
745756
{
746757
"cell_type": "code",
747-
"execution_count": 14,
758+
"execution_count": 15,
748759
"metadata": {},
749760
"outputs": [],
750761
"source": [
@@ -767,7 +778,7 @@
767778
},
768779
{
769780
"cell_type": "code",
770-
"execution_count": 15,
781+
"execution_count": 16,
771782
"metadata": {},
772783
"outputs": [
773784
{
@@ -779,7 +790,7 @@
779790
")"
780791
]
781792
},
782-
"execution_count": 15,
793+
"execution_count": 16,
783794
"metadata": {},
784795
"output_type": "execute_result"
785796
}
@@ -791,7 +802,7 @@
791802
},
792803
{
793804
"cell_type": "code",
794-
"execution_count": 16,
805+
"execution_count": 17,
795806
"metadata": {},
796807
"outputs": [
797808
{
@@ -802,7 +813,7 @@
802813
"\n",
803814
"\n",
804815
"\n",
805-
"\u001b[34m[2024-11-23T22:13:02.348625]\u001b[0m\n",
816+
"\u001b[34m[2024-11-23T23:16:49.175612]\u001b[0m\n",
806817
"\n",
807818
"\u001b[31mSystem message:\u001b[0m\n",
808819
"\n",
@@ -879,21 +890,21 @@
879890
},
880891
{
881892
"cell_type": "code",
882-
"execution_count": 17,
893+
"execution_count": 18,
883894
"metadata": {},
884895
"outputs": [
885896
{
886897
"name": "stdout",
887898
"output_type": "stream",
888899
"text": [
889-
"Average Metric: 166.39 / 300 (55.5%): 100%|██████████| 300/300 [00:14<00:00, 20.29it/s]"
900+
"Average Metric: 166.54 / 300 (55.5%): 100%|██████████| 300/300 [00:04<00:00, 61.40it/s] "
890901
]
891902
},
892903
{
893904
"name": "stderr",
894905
"output_type": "stream",
895906
"text": [
896-
"2024/11/23 22:13:17 INFO dspy.evaluate.evaluate: Average Metric: 166.39410892098812 / 300 (55.5%)\n"
907+
"2024/11/23 23:16:54 INFO dspy.evaluate.evaluate: Average Metric: 166.53601368289284 / 300 (55.5%)\n"
897908
]
898909
},
899910
{
@@ -1008,10 +1019,10 @@
10081019
{
10091020
"data": {
10101021
"text/plain": [
1011-
"55.46"
1022+
"55.51"
10121023
]
10131024
},
1014-
"execution_count": 17,
1025+
"execution_count": 18,
10151026
"metadata": {},
10161027
"output_type": "execute_result"
10171028
}
@@ -1057,7 +1068,7 @@
10571068
},
10581069
{
10591070
"cell_type": "code",
1060-
"execution_count": 19,
1071+
"execution_count": 20,
10611072
"metadata": {},
10621073
"outputs": [
10631074
{
@@ -1075,7 +1086,7 @@
10751086
},
10761087
{
10771088
"cell_type": "code",
1078-
"execution_count": 20,
1089+
"execution_count": 21,
10791090
"metadata": {},
10801091
"outputs": [
10811092
{
@@ -1111,21 +1122,21 @@
11111122
},
11121123
{
11131124
"cell_type": "code",
1114-
"execution_count": 21,
1125+
"execution_count": 22,
11151126
"metadata": {},
11161127
"outputs": [
11171128
{
11181129
"name": "stdout",
11191130
"output_type": "stream",
11201131
"text": [
1121-
"Average Metric: 183.28 / 300 (61.1%): 100%|██████████| 300/300 [00:13<00:00, 22.20it/s] "
1132+
"Average Metric: 183.32 / 300 (61.1%): 100%|██████████| 300/300 [00:02<00:00, 104.48it/s]"
11221133
]
11231134
},
11241135
{
11251136
"name": "stderr",
11261137
"output_type": "stream",
11271138
"text": [
1128-
"2024/11/23 22:14:01 INFO dspy.evaluate.evaluate: Average Metric: 183.27658621624977 / 300 (61.1%)\n"
1139+
"2024/11/23 23:17:21 INFO dspy.evaluate.evaluate: Average Metric: 183.3194433591069 / 300 (61.1%)\n"
11291140
]
11301141
},
11311142
{
@@ -1240,10 +1251,10 @@
12401251
{
12411252
"data": {
12421253
"text/plain": [
1243-
"61.09"
1254+
"61.11"
12441255
]
12451256
},
1246-
"execution_count": 21,
1257+
"execution_count": 22,
12471258
"metadata": {},
12481259
"output_type": "execute_result"
12491260
}
@@ -1263,7 +1274,7 @@
12631274
},
12641275
{
12651276
"cell_type": "code",
1266-
"execution_count": 22,
1277+
"execution_count": 23,
12671278
"metadata": {},
12681279
"outputs": [],
12691280
"source": [
@@ -1283,7 +1294,7 @@
12831294
},
12841295
{
12851296
"cell_type": "code",
1286-
"execution_count": 23,
1297+
"execution_count": 24,
12871298
"metadata": {},
12881299
"outputs": [
12891300
{
@@ -1295,7 +1306,7 @@
12951306
")"
12961307
]
12971308
},
1298-
"execution_count": 23,
1309+
"execution_count": 24,
12991310
"metadata": {},
13001311
"output_type": "execute_result"
13011312
}

0 commit comments

Comments
 (0)