Skip to content

Commit

Permalink
tutorial adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
okhat committed Nov 24, 2024
1 parent 48fe470 commit 0eb1e04
Showing 1 changed file with 36 additions and 25 deletions.
61 changes: 36 additions & 25 deletions docs/docs/tutorials/rag/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"\n",
"\n",
"\n",
"\u001b[34m[2024-11-23T22:12:48.901453]\u001b[0m\n",
"\u001b[34m[2024-11-23T23:16:35.966534]\u001b[0m\n",
"\n",
"\u001b[31mSystem message:\u001b[0m\n",
"\n",
Expand Down Expand Up @@ -404,7 +404,7 @@
"\n",
"\n",
"\n",
"\u001b[34m[2024-11-23T22:12:49.329836]\u001b[0m\n",
"\u001b[34m[2024-11-23T23:16:36.149518]\u001b[0m\n",
"\n",
"\u001b[31mSystem message:\u001b[0m\n",
"\n",
Expand Down Expand Up @@ -527,14 +527,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 598.18it/s]"
"Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 666.96it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024/11/23 22:12:49 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n"
"2024/11/23 23:16:36 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n"
]
},
{
Expand Down Expand Up @@ -699,13 +699,24 @@
"source": [
"## Set up your system's retriever.\n",
"\n",
"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."
"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",
"\n",
"**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."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"# %pip install -U faiss-cpu # or faiss-gpu if you have a GPU"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -744,7 +755,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -767,7 +778,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand All @@ -779,7 +790,7 @@
")"
]
},
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -791,7 +802,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand All @@ -802,7 +813,7 @@
"\n",
"\n",
"\n",
"\u001b[34m[2024-11-23T22:13:02.348625]\u001b[0m\n",
"\u001b[34m[2024-11-23T23:16:49.175612]\u001b[0m\n",
"\n",
"\u001b[31mSystem message:\u001b[0m\n",
"\n",
Expand Down Expand Up @@ -879,21 +890,21 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Average Metric: 166.39 / 300 (55.5%): 100%|██████████| 300/300 [00:14<00:00, 20.29it/s]"
"Average Metric: 166.54 / 300 (55.5%): 100%|██████████| 300/300 [00:04<00:00, 61.40it/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024/11/23 22:13:17 INFO dspy.evaluate.evaluate: Average Metric: 166.39410892098812 / 300 (55.5%)\n"
"2024/11/23 23:16:54 INFO dspy.evaluate.evaluate: Average Metric: 166.53601368289284 / 300 (55.5%)\n"
]
},
{
Expand Down Expand Up @@ -1008,10 +1019,10 @@
{
"data": {
"text/plain": [
"55.46"
"55.51"
]
},
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -1057,7 +1068,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {},
"outputs": [
{
Expand All @@ -1075,7 +1086,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1111,21 +1122,21 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Average Metric: 183.28 / 300 (61.1%): 100%|██████████| 300/300 [00:13<00:00, 22.20it/s] "
"Average Metric: 183.32 / 300 (61.1%): 100%|██████████| 300/300 [00:02<00:00, 104.48it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024/11/23 22:14:01 INFO dspy.evaluate.evaluate: Average Metric: 183.27658621624977 / 300 (61.1%)\n"
"2024/11/23 23:17:21 INFO dspy.evaluate.evaluate: Average Metric: 183.3194433591069 / 300 (61.1%)\n"
]
},
{
Expand Down Expand Up @@ -1240,10 +1251,10 @@
{
"data": {
"text/plain": [
"61.09"
"61.11"
]
},
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1263,7 +1274,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1283,7 +1294,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 24,
"metadata": {},
"outputs": [
{
Expand All @@ -1295,7 +1306,7 @@
")"
]
},
"execution_count": 23,
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
Expand Down

0 comments on commit 0eb1e04

Please sign in to comment.