A tool result content block: the output of one tool use.
It goes in a user message, answering an Omni.Content.ToolUse in the
assistant message before it. The tool loop builds these for you; build
them yourself with Omni.tool_result/1 when you run tools by hand (see
Running tools yourself).
Struct fields
:tool_use_id- the:idof the tool use this answers:name- the tool's name:content- the result, asOmni.Content.TextandOmni.Content.Attachmentblocks. Only some providers take images in a tool result:is_error-truewhen the tool failed, so the model knows the content describes an error
Summary
Functions
Creates a new tool result content block from a keyword list or map.
Types
@type content() :: Omni.Content.Text.t() | Omni.Content.Attachment.t()
Allowed content types within a tool result.
@type t() :: %Omni.Content.ToolResult{ content: [content()], is_error: boolean(), name: String.t(), tool_use_id: String.t() }
The output of a tool use, linked to it by id.
Functions
@spec new(Enumerable.t()) :: t()
Creates a new tool result content block from a keyword list or map.
String content is wrapped in an Omni.Content.Text block, and so is each
string in a content list. Missing content becomes [].
ToolResult.new(tool_use_id: tool_use.id, name: tool_use.name, content: "72°F and sunny")