Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are doing a rework of
dspy.Signature
. This is 98% internal code quality improvement, and our users don't need to be aware of this change at all.class Signature
with@classmethod
decorator, which does the same job as before.replace
method andupdate_signature
utility function. The history of these 2 methods can be found here: Feature/make signatures replaceable with context manager #1090. But reading the context it's unclear how this in-place swapping helps with i18n. For i18n, we should probably use the translation way instead of having users do challenging hacks with swapping signatures. Furthermore, if users can access the signature, they can set it to a new one, which is how we play with built-in predictors. In all, I don't see the necessity of these 2 methods, while meanwhile they are pretty complex._parse_type_node
, which is a very intelligent implementation while very hard to follow without examples.The only risk is
update_signature
is removed, however I am not aware of any actual usage of it. I am almost sure that users can do similar as our avatar code:dspy/dspy/predict/avatar/avatar.py
Line 74 in 238e312