struct

Anthropic::DocumentContent

Inherits JSON::Serializable < Struct < Value < Object

Document content block

Constructors

file(file_id : String, title : String | Nil = nil, context : String | Nil = nil, citations : Bool = false, cache_control : CacheControl | Nil = nil) : self

Create a document from an uploaded file ID with optional citations

# Upload a file first
file = client.beta.files.upload(Path["document.pdf"])

# Reference it in a message
doc = Anthropic::DocumentContent.file(file.id, title: "My Document", citations: true)
Source
new(source : DocumentSource, title : String | Nil = nil, context : String | Nil = nil, citations : CitationConfig | Nil = nil, cache_control : CacheControl | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source
pdf(data : String, title : String | Nil = nil, context : String | Nil = nil, citations : Bool = false, cache_control : CacheControl | Nil = nil) : self

Create a document from base64-encoded PDF with optional citations

Source
text(content : String, title : String | Nil = nil, context : String | Nil = nil, citations : Bool = false, cache_control : CacheControl | Nil = nil) : self

Create a document from plain text with optional citations

Source
url(url : String, title : String | Nil = nil, context : String | Nil = nil, citations : Bool = false, cache_control : CacheControl | Nil = nil) : self

Create a document from URL with optional citations

Source

Instance methods

cache_control
Source
citations
Source
context
Source
source
Source
title
Source
type
Source