Skip to content

Type Alias: DocumentSource

@providerprotocol/ai


@providerprotocol/ai / @providerprotocol/ai / DocumentSource

DocumentSource = { data: string; type: "base64"; } | { type: "url"; url: string; } | { data: string; type: "text"; }

Defined in: src/types/content.ts:170

Document source variants for DocumentBlock.

Documents can be provided as base64-encoded data (PDFs), URLs (PDFs), or plain text.

// Base64 encoded PDF
const base64Source: DocumentSource = {
type: 'base64',
data: 'JVBERi0xLjQK...'
};
// URL reference to PDF
const urlSource: DocumentSource = {
type: 'url',
url: 'https://example.com/document.pdf'
};
// Plain text document
const textSource: DocumentSource = {
type: 'text',
data: 'This is the document content...'
};