package anthropic
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Anthropic.ToolsSource
Tools module for handling tool execution patterns.
This module provides utilities to simplify tool handling in conversations.
Source
type tool_execution_result = | Success of Yojson.Safe.t| Error of string(*Result of executing a tool.
*)
Source
val make_tool_result :
tool_use_id:string ->
result:tool_execution_result ->
input_content_blockmake_tool_result ~tool_use_id ~result creates a tool result content block.
Example:
let result =
Tools.make_tool_result ~tool_use_id:"tool_123"
~result:(Success (`Assoc [ ("answer", `Int 42) ]))requires_tool_execution blocks checks if response contains tool use requests.
Source
val extract_tool_calls :
Messages.response_content_block list ->
(string * string * Yojson.Safe.t) listextract_tool_calls blocks extracts all tool calls from response blocks. Returns a list of (id, name, input) tuples.