Skip to content

Commit 7e102fe

Browse files
authored
Cleanup and fixing some imports (#1949)
1 parent 866730f commit 7e102fe

File tree

6 files changed

+3
-663
lines changed

6 files changed

+3
-663
lines changed

dspy/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66

77
import dspy.retrievers
88

9-
# Functional must be imported after primitives, predict and signatures
10-
from dspy.functional import * # isort: skip
119
from dspy.evaluate import Evaluate # isort: skip
1210
from dspy.clients import * # isort: skip
13-
from dspy.adapters import * # isort: skip
11+
from dspy.adapters import Adapter, ChatAdapter, JSONAdapter, Image # isort: skip
1412
from dspy.utils.logging_utils import configure_dspy_loggers, disable_logging, enable_logging
1513
from dspy.utils.asyncify import asyncify
1614
from dspy.utils.saving import load

dspy/evaluate/__init__.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
from dspy.dsp.utils import EM, normalize_text
22

3-
from dspy.evaluate import auto_evaluation
3+
from dspy.evaluate.metrics import answer_exact_match, answer_passage_match
44
from dspy.evaluate.evaluate import Evaluate
5-
from dspy.evaluate import metrics
6-
7-
__all__ = [
8-
"auto_evaluation",
9-
"Evaluate",
10-
"metrics",
11-
"EM",
12-
"normalize_text",
13-
]
5+
from dspy.evaluate.auto_evaluation import SemanticF1, CompleteAndGrounded

dspy/evaluate/auto_evaluation.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -98,45 +98,3 @@ def forward(self, example, pred, trace=None):
9898
score = f1_score(groundedness.groundedness, completeness.completeness)
9999

100100
return score if trace is None else score >= self.threshold
101-
102-
103-
104-
# """
105-
# Soon-to-be deprecated Signatures & Modules Below.
106-
# """
107-
108-
109-
# class AnswerCorrectnessSignature(dspy.Signature):
110-
# """Verify that the predicted answer matches the gold answer."""
111-
112-
# question = dspy.InputField()
113-
# gold_answer = dspy.InputField(desc="correct answer for question")
114-
# predicted_answer = dspy.InputField(desc="predicted answer for question")
115-
# is_correct = dspy.OutputField(desc="True or False")
116-
117-
118-
# class AnswerCorrectness(dspy.Module):
119-
# def __init__(self):
120-
# super().__init__()
121-
# self.evaluate_correctness = dspy.ChainOfThought(AnswerCorrectnessSignature)
122-
123-
# def forward(self, question, gold_answer, predicted_answer):
124-
# return self.evaluate_correctness(question=question, gold_answer=gold_answer, predicted_answer=predicted_answer)
125-
126-
127-
# class AnswerFaithfulnessSignature(dspy.Signature):
128-
# """Verify that the predicted answer is based on the provided context."""
129-
130-
# context = dspy.InputField(desc="relevant facts for producing answer")
131-
# question = dspy.InputField()
132-
# answer = dspy.InputField(desc="often between 1 and 5 words")
133-
# is_faithful = dspy.OutputField(desc="True or False")
134-
135-
136-
# class AnswerFaithfulness(dspy.Module):
137-
# def __init__(self):
138-
# super().__init__()
139-
# self.evaluate_faithfulness = dspy.ChainOfThought(AnswerFaithfulnessSignature)
140-
141-
# def forward(self, context, question, answer):
142-
# return self.evaluate_faithfulness(context=context, question=question, answer=answer)

dspy/functional/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)