DSPy: The framework for programming—not prompting—language models
Python
Update longformqa_assertions.ipynb
arnavsinghvi116609517a4f94
diff --git a/examples/longformqa/longformqa_assertions.ipynb b/examples/longformqa/longformqa_assertions.ipynbindex f814c60dd..40df53a24 100644--- a/examples/longformqa/longformqa_assertions.ipynb+++ b/examples/longformqa/longformqa_assertions.ipynb@@ -80,7 +80,6 @@"if repo_path not in sys.path:\n"," sys.path.append(repo_path)\n","\n",- "%cd dspy/examples/longformqa","\n","import pkg_resources # Install the package if it's not installed\n","if not \"dspy-ai\" in {pkg.key for pkg in pkg_resources.working_set}:\n",@@ -94,6 +93,10 @@"\n","from dspy.teleprompt import BootstrapFewShotWithRandomSearch\n","from dsp.utils import EM, normalize_text\n",+ "from dspy.primitives.assertions import assert_transform_module, backtrack_handler\n",+ "\n",+ "%cd dspy/examples/longformqa\n",+ "\n","from utils import extract_text_by_citation, correct_citation_format, has_citations, citations_check"]},@@ -508,7 +511,6 @@"metadata": {},"outputs": [],"source": [- "from dspy.primitives.assertions import assert_transform_module, backtrack_handler\n","longformqa_with_assertions = assert_transform_module(LongFormQAWithAssertions().map_named_predictors(Retry), backtrack_handler) \n","evaluate(longformqa_with_assertions)"]