AnthropicContent

Represents content that can be processed or generated by Anthropic systems.

This is a sealed class with various types of content including textual data, images, documents, and tool-related operations, encapsulating diverse forms of input or output content. Subtypes are serialized with discriminators to support interoperability and flexibility within the serialization format.

Inheritors

Types

Link copied to clipboard
@SerialName(value = "document")
data class Document(val source: DocumentSource) : AnthropicContent

Represents a document that originates from a specified source. The document can have various source types, such as a URL, base64-encoded data, or plain text.

Link copied to clipboard
@SerialName(value = "image")
data class Image(val source: ImageSource) : AnthropicContent

Represents an image content type within the AnthropicContent hierarchy. This class is used to encapsulate image data, which can be sourced in different ways, such as via URLs or base64-encoded strings.

Link copied to clipboard
@SerialName(value = "text")
data class Text(val text: String) : AnthropicContent

Represents a text-based content within the AnthropicContent hierarchy.

Link copied to clipboard
@SerialName(value = "tool_result")
data class ToolResult(val toolUseId: String, val content: String) : AnthropicContent

Represents the result of a tool invocation within the Anthropic content system.

Link copied to clipboard
@SerialName(value = "tool_use")
data class ToolUse(val id: String, val name: String, val input: JsonObject) : AnthropicContent

Represents the usage of a tool in a structured format.