Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup and fixing some imports #1949

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions dspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

import dspy.retrievers

# Functional must be imported after primitives, predict and signatures
from dspy.functional import * # isort: skip
from dspy.evaluate import Evaluate # isort: skip
from dspy.clients import * # isort: skip
from dspy.adapters import * # isort: skip
from dspy.adapters import Adapter, ChatAdapter, JSONAdapter, Image # isort: skip
from dspy.utils.logging_utils import configure_dspy_loggers, disable_logging, enable_logging
from dspy.utils.asyncify import asyncify
from dspy.utils.saving import load
Expand Down
12 changes: 2 additions & 10 deletions dspy/evaluate/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
from dspy.dsp.utils import EM, normalize_text

from dspy.evaluate import auto_evaluation
from dspy.evaluate.metrics import answer_exact_match, answer_passage_match
from dspy.evaluate.evaluate import Evaluate
from dspy.evaluate import metrics

__all__ = [
"auto_evaluation",
"Evaluate",
"metrics",
"EM",
"normalize_text",
]
from dspy.evaluate.auto_evaluation import SemanticF1, CompleteAndGrounded
42 changes: 0 additions & 42 deletions dspy/evaluate/auto_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,45 +98,3 @@ def forward(self, example, pred, trace=None):
score = f1_score(groundedness.groundedness, completeness.completeness)

return score if trace is None else score >= self.threshold



# """
# Soon-to-be deprecated Signatures & Modules Below.
# """


# class AnswerCorrectnessSignature(dspy.Signature):
# """Verify that the predicted answer matches the gold answer."""

# question = dspy.InputField()
# gold_answer = dspy.InputField(desc="correct answer for question")
# predicted_answer = dspy.InputField(desc="predicted answer for question")
# is_correct = dspy.OutputField(desc="True or False")


# class AnswerCorrectness(dspy.Module):
# def __init__(self):
# super().__init__()
# self.evaluate_correctness = dspy.ChainOfThought(AnswerCorrectnessSignature)

# def forward(self, question, gold_answer, predicted_answer):
# return self.evaluate_correctness(question=question, gold_answer=gold_answer, predicted_answer=predicted_answer)


# class AnswerFaithfulnessSignature(dspy.Signature):
# """Verify that the predicted answer is based on the provided context."""

# context = dspy.InputField(desc="relevant facts for producing answer")
# question = dspy.InputField()
# answer = dspy.InputField(desc="often between 1 and 5 words")
# is_faithful = dspy.OutputField(desc="True or False")


# class AnswerFaithfulness(dspy.Module):
# def __init__(self):
# super().__init__()
# self.evaluate_faithfulness = dspy.ChainOfThought(AnswerFaithfulnessSignature)

# def forward(self, context, question, answer):
# return self.evaluate_faithfulness(context=context, question=question, answer=answer)
1 change: 0 additions & 1 deletion dspy/functional/__init__.py

This file was deleted.

Loading
Loading