Skip to content

Commit fca4056

Browse files
koicsergiobayona
andauthored
Use public_send instead of send (#996)
Since tool invocation from assistant is expected to be limited to public methods, `public_send` is used instead of `send` to avoid unintended invocation of private method. Co-authored-by: Sergio Bayona <bayona.sergio@gmail.com>
1 parent 8d60d6a commit fca4056

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/langchain/assistant.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def run_tool(tool_call)
372372
# Call the callback if set
373373
tool_execution_callback.call(tool_call_id, tool_name, method_name, tool_arguments) if tool_execution_callback # rubocop:disable Style/SafeNavigation
374374

375-
output = tool_instance.send(method_name, **tool_arguments)
375+
output = tool_instance.public_send(method_name, **tool_arguments)
376376

377377
# Handle both ToolResponse and legacy return values
378378
if output.is_a?(ToolResponse)

0 commit comments

Comments
 (0)