-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
When adding type annotations to some of the output fields, the final parsed field orders are wrong:
class ExampleSignature(dspy.Signature):
"""Evaluate the text as "good" or "bad"."""
text = dspy.InputField(desc="The text to evaluate.")
output = dspy.OutputField(desc="The evaluation of the text.")
pass_evaluation: bool = dspy.OutputField(desc="The evaluation result, True if the text is good, False otherwise.")
print(ExampleSignature.fields)In the output, the orders of two output fields are swapped:
{'text': FieldInfo(annotation=str, required=True, json_schema_extra={'desc': 'The text to evaluate.', '__dspy_field_type': 'input', 'prefix': 'Text:'}),
'pass_evaluation': FieldInfo(annotation=bool, required=True, json_schema_extra={'desc': 'The evaluation result, True if the text is good, False otherwise.', '__dspy_field_type': 'output', 'prefix': 'Pass Evaluation:'}),
'output': FieldInfo(annotation=str, required=True, json_schema_extra={'desc': 'The evaluation of the text.', '__dspy_field_type': 'output', 'prefix': 'Output:'})}
This only happens when output fields are partially typed. If all output fields are typed, the order is correct.
Steps to reproduce
See above.
DSPy version
2.6.0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working