Update default output to string handler in ToolInvoker
to serialize before using json.dumps
#9293
Labels
P2
Medium priority, add to the next sprint if no P1 available
In the
ToolInvoker
we have an option calledconvert_result_to_json_string
which does this currentlyhaystack/haystack/components/tools/tool_invoker.py
Lines 215 to 227 in 9ae7da8
I believe it would be better if we followed the implementation of
coerce_tag_value
haystack/haystack/tracing/utils.py
Lines 31 to 39 in 9ae7da8
_serializable_value
which iteratively goes throughresult
and tries to serialize the value usingto_dict
if it's available.This way Haystack native items like
ChatMessage
andDocuments
are better represented in a JSON format than by directly callingjson.dumps
on them.The text was updated successfully, but these errors were encountered: