Created
April 28, 2025 14:11
-
-
Save andrewkkchan/0e7ef7aadef39471e53a3d4db830b213 to your computer and use it in GitHub Desktop.
dspy eval flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dspy.evaluate import SemanticF1 | |
# Instantiate the metric. | |
metric = SemanticF1(decompositional=True) | |
# Produce a prediction from our `cot` module, using the `example` above as input. | |
pred = cot(**example.inputs()) | |
# Compute the metric score for the prediction. | |
score = metric(example, pred) | |
print(f"Question: \t {example.question}\n") | |
print(f"Gold Response: \t {example.response}\n") | |
print(f"Predicted Response: \t {pred.response}\n") | |
print(f"Semantic F1 Score: {score:.2f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment