Tool output formatting should be configurable #28880
jessedhillon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked
Feature request
In 'Tool.run
you have a step where a module-local function
_format_outputis called on the return value of the tool, which invokes the python builtin function
json.dumps` on the output. I suggest two improvements:json.dumps
_format_output
Motivation
We bind tools to the model which are functions that we also use in other parts of our codebase. These functions return Pydantic models, and we have a JSON serializer which automatically dumps these objects to our preferred format. Your formatter is instead sending these objects as the output of their
repr
. We currently monkey-patchlangchain_core.tools.base
and replace thejson
symbol with our own encoder.Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions