Skip to content

Commit 1400d19

Browse files
committed
updated tool call decoding to use concrete type of tool result instead of annotations
1 parent 41beb78 commit 1400d19

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

effectful/handlers/llm/completions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def call_tool(
114114

115115
sig = inspect.signature(tool)
116116
param_model = _parameter_model(sig)
117-
return_type = type_to_encodable_type(sig.return_annotation)
118117

119118
# build dict of raw encodable types U
120119
raw_args = param_model.model_validate_json(json_str)
@@ -133,6 +132,7 @@ def call_tool(
133132
result = tool(*bound_sig.args, **bound_sig.kwargs)
134133

135134
# serialize back to U using encoder for return type
135+
return_type = type_to_encodable_type(type(result))
136136
encoded_result = return_type.serialize(return_type.encode(result))
137137
return typing.cast(
138138
Message, dict(role="tool", content=encoded_result, tool_call_id=tool_call.id)

0 commit comments

Comments
 (0)