Use pydantic field validator to serialize ToolCall callable (#412)#413
Draft
fightingmonk wants to merge 1 commit intoMadcowD:mainfrom
Draft
Use pydantic field validator to serialize ToolCall callable (#412)#413fightingmonk wants to merge 1 commit intoMadcowD:mainfrom
fightingmonk wants to merge 1 commit intoMadcowD:mainfrom
Conversation
alex-dixon
reviewed
Jan 2, 2025
Contributor
alex-dixon
left a comment
There was a problem hiding this comment.
I should be able to provide a better review just linking this for now: https://github.com/MadcowD/ell/pull/362/files?file-filters%5B%5D=.py&show-viewed-files=true#diff-349d03abf627edb1ae7fa8c4e625bf3afd4620942915228f894af3f6b56bc8dfR25
Author
|
@alex-dixon this is definitely still WIP. it seems to work ok for the naive case of 0-param tools but I don't think it's persisting args provided by the LLM and it's probably not retaining whatever trace info you need for ell studio, etc. See my comment on the Issue - after some thought there may be other ways to solve my specific need. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ToolCall's
toolis a Callable, which isn't serializable by Pydantic. This PR adds a @field_serializer and @field_validator that serialize the tool's FQN and then resolve the named function when validating from serialized form.