package anthropic
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Anthropic.Content_blockSource
Helper functions for creating content blocks.
text s creates a text content block.
image ~media_type ~data creates an image content block.
The data must be base64-encoded image data. Supported formats include JPEG, PNG, GIF, and WebP.
document ~name ~content ~media_type creates a document content block.
The content must be base64-encoded document data. The name is displayed to the model for context.
val tool_result :
tool_use_id:string ->
content:Yojson.Safe.t ->
?is_error:bool ->
unit ->
input_content_blocktool_result ~tool_use_id ~content ?is_error () creates a tool result block.
Tool results must reference a tool_use_id from a previous assistant message. Set is_error to true when the tool execution failed. The content parameter accepts structured JSON data which will be automatically serialized.
tool_use ~id ~name ~input creates a tool use content block.
This is used to represent tool invocations from assistant responses when maintaining conversation history.