Skip to content

Commit 11d6296

Browse files
committed
SkyCamp 2023 commit 04
1 parent 19bb293 commit 11d6296

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

skycamp2023.ipynb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
" # !pip install dspy-ai\n",
5050
" !pip install -e $repo_path\n",
5151
"\n",
52-
"import dspy"
52+
"!pip install transformers"
5353
]
5454
},
5555
{
@@ -58,11 +58,8 @@
5858
"metadata": {},
5959
"outputs": [],
6060
"source": [
61-
"!pip install transformers\n",
62-
"\n",
6361
"import dspy\n",
6462
"from dspy.evaluate import Evaluate\n",
65-
"from dspy.datasets.hotpotqa import HotPotQA\n",
6663
"from dspy.teleprompt import BootstrapFewShot, BootstrapFewShotWithRandomSearch, BootstrapFinetune"
6764
]
6865
},
@@ -414,8 +411,8 @@
414411
" self.retrieve = dspy.Retrieve(k=num_passages)\n",
415412
" self.generate_query = dspy.ChainOfThought(\"question -> search_query\")\n",
416413
"\n",
417-
" # TODO: Define a dspy.ChainOfThought module with the signature `context, question -> answer`.\n",
418-
" self.generate_query_from_context = dspy.ChainOfThought(\"context, question -> search_query\")\n",
414+
" # TODO: Replace `None` with a dspy.ChainOfThought module that has the signature `context, question -> answer`.\n",
415+
" self.generate_query_from_context = None\n",
419416
"\n",
420417
" self.generate_answer = dspy.ChainOfThought(\"context, question -> answer\")\n",
421418
" \n",
@@ -425,12 +422,12 @@
425422
" search_query = self.generate_query(question=question).search_query\n",
426423
" passages += self.retrieve(search_query).passages\n",
427424
"\n",
428-
" # TODO: Use self.generate_query_from_context to generate a search query.\n",
429-
" # Note: Modules require named keyword arguments (e.g., context=..., question=...).\n",
430-
" search_query = self.generate_query_from_context(context=passages, question=question).search_query\n",
425+
" # TODO: Replace `None` with a call to self.generate_query_from_context to generate a search query.\n",
426+
" # Note: In DSPy, always pass keyword arguments (e.g., context=..., question=...) to the modules to avoid ambiguity.\n",
427+
" search_query2 = None\n",
431428
"\n",
432-
" # TODO: Use self.retrieve to retrieve passages. Append them to the list `passages`.\n",
433-
" passages += self.retrieve(search_query).passages\n",
429+
" # TODO: Replace `None` with a call to self.retrieve to retrieve passages. Append them to the list `passages`.\n",
430+
" passages += None\n",
434431
"\n",
435432
" return self.generate_answer(context=deduplicate(passages), question=question)"
436433
]

0 commit comments

Comments
 (0)