DSPy: The framework for programming—not prompting—language models
Python
Automatic Style fixes
thomasahle5dc385fcce33
diff --git a/dspy/__init__.py b/dspy/__init__.pyindex d0abf41b6..d76b3f828 100644--- a/dspy/__init__.py+++ b/dspy/__init__.py@@ -1,11 +1,11 @@import dspfrom dsp.modules.hf_client import ChatModuleClient, HFClientSGLang, HFClientVLLM, HFServerTGI+from .functional import *from .predict import *from .primitives import *from .retrieve import *from .signatures import *-from .functional import *settings = dsp.settingsdiff --git a/dspy/functional/functional.py b/dspy/functional/functional.pyindex aaf0f26ed..292a6bef1 100644--- a/dspy/functional/functional.py+++ b/dspy/functional/functional.py@@ -226,7 +226,7 @@ class TypedPredictor(dspy.Module):else:# If there are no errors, we return the parsed resultsreturn Prediction.from_completions(- {key: [r[key] for r in parsed_results] for key in signature.output_fields}+ {key: [r[key] for r in parsed_results] for key in signature.output_fields},)raise ValueError("Too many retries trying to get the correct output format. " + "Try simplifying the requirements.",@@ -353,8 +353,8 @@ def gold_passages_retrieved(example, pred, _trace=None) -> bool:def hotpot() -> None:- from dsp.utils import deduplicateimport dspy.evaluate+ from dsp.utils import deduplicatefrom dspy.datasets import HotPotQAfrom dspy.evaluate.evaluate import Evaluatefrom dspy.teleprompt.bootstrap import BootstrapFewShotdiff --git a/dspy/primitives/module.py b/dspy/primitives/module.pyindex d503345ea..90908e5c3 100644--- a/dspy/primitives/module.py+++ b/dspy/primitives/module.py@@ -1,5 +1,5 @@import copy-from typing import Generator+from collections.abc import Generatorimport ujsondiff --git a/dspy/teleprompt/signature_opt_typed.py b/dspy/teleprompt/signature_opt_typed.pyindex 956ea0f0c..1921f8cd1 100644--- a/dspy/teleprompt/signature_opt_typed.py+++ b/dspy/teleprompt/signature_opt_typed.py@@ -2,10 +2,11 @@ import textwrapfrom typing import Generic, Literal, TypeVarimport pydantic+import dspy+from dspy import BaseModelfrom dspy.functional.functional import TypedChainOfThought, TypedPredictorfrom dspy.signatures import Signature-from dspy import BaseModelfrom dspy.signatures.field import InputField, OutputField# TODO:diff --git a/examples/generation.py b/examples/generation.pyindex 36d3d1c92..4ccb2d8fe 100644--- a/examples/generation.py+++ b/examples/generation.py@@ -1,8 +1,9 @@from pydantic import BaseModel, Field-from dspy.teleprompt import LabeledFewShot-from dspy.functional import TypedPredictorimport dspy+from dspy.functional import TypedPredictor+from dspy.teleprompt import LabeledFewShot+turbo = dspy.OpenAI(model='gpt-3.5-turbo')colbertv2_wiki17_abstracts = dspy.ColBERTv2(url='http://20.102.90.50:2017/wiki17_abstracts')dspy.settings.configure(lm=turbo, rm=colbertv2_wiki17_abstracts)