feat: Add default (de-)serialization for ComponentDevice #10413
Merged
+216
−5
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.
Related Issues
default_from_dict,default_to_dictautomatically #10412Proposed Changes:
default_to_dictso that we callto_dict()for any init parameters that are of type ComponentDevicedefault_from_dictso that we callComponentDevice.from_dictfor any dict values that havesingleormultipleas value of fieldtypeand adevicestring or adevice_mapdictcomponent_to_dict/component_from_dict, which internally usedefault_to_dict/default_from_dictHow did you test it?
Notes for the reviewer
Once this PR is merged I am happy to do a follow up PR that makes use of these changes in all ready-made components in Haystack that use ComponentDevice. I will simplify the
to_dictandfrom_dictmethods.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.