Type Alias: DocumentSource
@providerprotocol/ai / @providerprotocol/ai / DocumentSource
Type Alias: DocumentSource
Section titled “Type Alias: 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.
Example
Section titled “Example”// Base64 encoded PDFconst base64Source: DocumentSource = { type: 'base64', data: 'JVBERi0xLjQK...'};
// URL reference to PDFconst urlSource: DocumentSource = { type: 'url', url: 'https://example.com/document.pdf'};
// Plain text documentconst textSource: DocumentSource = { type: 'text', data: 'This is the document content...'};