ToolCall
@SerialName(value = "tool_call")
@Serializable
A tool invocation requested by the model.
Contains the tool's unique id, name, and serialized argumentsJson. Implements both Response (received from model) and Request (can be forwarded back as an assistant message).
Samples
// ToolCall and ToolResult are used as a request only if you have disabled autoExecute and are processing the tool manually.
val executeResult = executeTool(toolCall.name, toolCall.argumentsJson) // Returns String.
// Create a ToolResult.
val toolResult = Content.ToolResult(
toolCallId = toolCall.id,
name = toolCall.name,
content = toolCall.argumentsJson
)
// Send toolResult to API...Content copied to clipboard
Constructors
Functions
Link copied to clipboard
Wraps this request content as an assistant Message.
Link copied to clipboard
Attempts to cast this response content to a request-compatible content type.
Link copied to clipboard