Created
January 11, 2024 18:03
-
-
Save heathermiller/bf7e7b9c5918247b0802fd8478ed9cdc to your computer and use it in GitHub Desktop.
DSPy
This file contains 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
class BasicQA(dspy.Signature): | |
"""Answer questions with short factoid answers.""" | |
question = dspy.InputField() | |
answer = dspy.OutputField(desc="often between 1 and 5 words") | |
# Define the predictor. | |
generate_answer = dspy.Predict(BasicQA) | |
# Call the predictor on a particular input. | |
pred = generate_answer(question=dev_example.question) | |
# Or use the Short Hand | |
qa = dspy.Predict("question -> answer") | |
qa(question="Where is Guaraní spoken?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment