Skip to content

Use pydantic field validator to serialize ToolCall callable (#412)#413

Draft
fightingmonk wants to merge 1 commit intoMadcowD:mainfrom
fightingmonk:serialize-tool-calls
Draft

Use pydantic field validator to serialize ToolCall callable (#412)#413
fightingmonk wants to merge 1 commit intoMadcowD:mainfrom
fightingmonk:serialize-tool-calls

Conversation

@fightingmonk
Copy link

ToolCall's tool is 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.

Copy link
Contributor

@alex-dixon alex-dixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fightingmonk
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants