I am trying to provide a custom rationale_type kwarg into ChainOfThought as described here and running into a cryptic error.
The same example works w/o rationale_type.
rationale_type = dsp.Type(prefix="Reasoning: Let's think step by step in order to",
desc="${understand whether the two inputs match and provide correction if needed}. We ...")
dspy.ChainOfThought(Equivalence, rationale_type=rationale_type)(source=source, target=target)
File ~/.conda/envs/dspy/lib/python3.11/site-packages/dspy/predict/chain_of_thought.py:45, in ChainOfThought.init(self, signature, rationale_type, activated, *config)
38 _keys, last_key = signature.output_fields.keys()
40 rationale_type = rationale_type or dspy.OutputField(
41 prefix="Reasoning: Let's think step by step in order to",
42 desc="${produce the " + last_key + "}. We ...",
43 )
---> 45 self.extended_signature = signature.prepend("rationale", rationaletype, type=str)
File ~/.conda/envs/dspy/lib/python3.11/site-packages/dspy/signatures/signature.py:145, in SignatureMeta.insert(cls, index, name, field, type_)
142 output_fields = list(cls.output_fields.items())
144 # Choose the list to insert into based on the field type
--> 145 lst = input_fields if field.json_schema_extra["__dspy_field_type"] == "input" else output_fields
146 # We support negative insert indices
147 if index < 0:
AttributeError: 'Type' object has no attribute 'json_schema_extra'
I am trying to provide a custom
rationale_type
kwarg into ChainOfThought as described here and running into a cryptic error. The same example works w/orationale_type
.