Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

[Doc PR Part 1] Necessary fixes for API reference generation (#1976)

Chen Qian7f821b81cb0a
diff --git a/dspy/__init__.py b/dspy/__init__.py
index 49fb5f944..f5283f30d 100644
--- a/dspy/__init__.py
+++ b/dspy/__init__.py
@@ -24,6 +24,8 @@ from dspy.dsp.colbertv2 import ColBERTv2
configure = settings.configure
context = settings.context
+BootstrapRS = BootstrapFewShotWithRandomSearch
+
from .__metadata__ import (
__name__,
__version__,
@@ -32,15 +34,3 @@ from .__metadata__ import (
__author__,
__author_email__
)
-
-import dspy.teleprompt
-
-LabeledFewShot = dspy.teleprompt.LabeledFewShot
-BootstrapFewShot = dspy.teleprompt.BootstrapFewShot
-BootstrapFewShotWithRandomSearch = dspy.teleprompt.BootstrapFewShotWithRandomSearch
-BootstrapRS = dspy.teleprompt.BootstrapFewShotWithRandomSearch
-BootstrapFinetune = dspy.teleprompt.BootstrapFinetune
-BetterTogether = dspy.teleprompt.BetterTogether
-COPRO = dspy.teleprompt.COPRO
-MIPROv2 = dspy.teleprompt.MIPROv2
-Ensemble = dspy.teleprompt.Ensemble
diff --git a/dspy/adapters/__init__.py b/dspy/adapters/__init__.py
index 5802bd58d..e6358a27e 100644
--- a/dspy/adapters/__init__.py
+++ b/dspy/adapters/__init__.py
@@ -2,3 +2,10 @@ from dspy.adapters.base import Adapter
from dspy.adapters.chat_adapter import ChatAdapter
from dspy.adapters.json_adapter import JSONAdapter
from dspy.adapters.image_utils import Image
+
+__all__ = [
+ "Adapter",
+ "ChatAdapter",
+ "JSONAdapter",
+ "Image",
+]
diff --git a/dspy/clients/__init__.py b/dspy/clients/__init__.py
index fbeec22e2..869c544d9 100644
--- a/dspy/clients/__init__.py
+++ b/dspy/clients/__init__.py
@@ -36,10 +36,10 @@ def disable_litellm_logging():
__all__ = [
+ "BaseLM",
"LM",
"Provider",
"TrainingJob",
- "BaseLM",
"inspect_history",
"Embedder",
"enable_litellm_logging",
diff --git a/dspy/evaluate/__init__.py b/dspy/evaluate/__init__.py
index c2336c3f9..a4dd669ae 100644
--- a/dspy/evaluate/__init__.py
+++ b/dspy/evaluate/__init__.py
@@ -3,3 +3,13 @@ from dspy.dsp.utils import EM, normalize_text
from dspy.evaluate.metrics import answer_exact_match, answer_passage_match
from dspy.evaluate.evaluate import Evaluate
from dspy.evaluate.auto_evaluation import SemanticF1, CompleteAndGrounded
+
+__all__ = [
+ "EM",
+ "normalize_text",
+ "answer_exact_match",
+ "answer_passage_match",
+ "Evaluate",
+ "SemanticF1",
+ "CompleteAndGrounded",
+]
diff --git a/dspy/experimental/synthesizer/__init__.py b/dspy/experimental/synthesizer/__init__.py
index 40f0c94f7..78f879c74 100644
--- a/dspy/experimental/synthesizer/__init__.py
+++ b/dspy/experimental/synthesizer/__init__.py
@@ -1 +1,8 @@
-from dspy.experimental.synthesizer import *
+from dspy.experimental.synthesizer.synthesizer import Synthesizer
+from dspy.experimental.synthesizer.config import SynthesizerArguments
+
+
+__all__ = [
+ "Synthesizer",
+ "SynthesizerArguments",
+]
diff --git a/dspy/experimental/synthesizer/synthesizer.py b/dspy/experimental/synthesizer/synthesizer.py
index 2fea0f85d..9a2bfcd74 100644
--- a/dspy/experimental/synthesizer/synthesizer.py
+++ b/dspy/experimental/synthesizer/synthesizer.py
@@ -7,13 +7,12 @@ from rich import print as rprint
from tqdm import tqdm, trange
import dspy
-
-from .config import SynthesizerArguments
-from .instruction_suffixes import (
+from dspy.experimental.synthesizer.config import SynthesizerArguments
+from dspy.experimental.synthesizer.instruction_suffixes import (
INPUT_GENERATION_TASK_WITH_EXAMPLES_SUFFIX,
INPUT_GENERATION_TASK_WITH_FEEDBACK_SUFFIX,
)
-from .signatures import (
+from dspy.experimental.synthesizer.signatures import (
ExplainTask,
GenerateFieldDescription,
GenerateInputFieldsData,
@@ -22,12 +21,8 @@ from .signatures import (
UnderstandTask,
UpdateTaskDescriptionBasedOnFeedback,
)
-from .utils import format_examples
+from dspy.experimental.synthesizer.utils import format_examples
-__all__ = [
- "Synthesizer",
- "SynthesizerArguments",
-]
class Synthesizer:
def __init__(self, config: SynthesizerArguments):
diff --git a/dspy/primitives/__init__.py b/dspy/primitives/__init__.py
index 655d9d67d..21ee25be8 100644
--- a/dspy/primitives/__init__.py
+++ b/dspy/primitives/__init__.py
@@ -3,7 +3,7 @@ from dspy.primitives.example import Example
from dspy.primitives.module import BaseModule
from dspy.primitives.prediction import Prediction, Completions
from dspy.primitives.program import Program, Module
-from dspy.primitives.python_interpreter import PythonInterpreter, TextPrompt, CodePrompt
+from dspy.primitives.python_interpreter import PythonInterpreter
__all__ = [
@@ -15,6 +15,4 @@ __all__ = [
"Program",
"Module",
"PythonInterpreter",
- "TextPrompt",
- "CodePrompt",
]
diff --git a/dspy/signatures/__init__.py b/dspy/signatures/__init__.py
index b94fb579f..3b902dbb5 100644
--- a/dspy/signatures/__init__.py
+++ b/dspy/signatures/__init__.py
@@ -8,6 +8,7 @@ from dspy.signatures.signature import (
infer_prefix,
)
+
__all__ = [
"InputField",
"OutputField",