DocumentBlock
Defined in: src/types/media.ts:471
Document content block.
Implements
Section titled “Implements”DocumentBlockDataJSONSerializable<{document:Serialized<DocumentBlockData>; }>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DocumentBlock(data): DocumentBlock;Defined in: src/types/media.ts:502
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data | DocumentBlockData |
Returns
Section titled “Returns”DocumentBlock
Properties
Section titled “Properties”readonly type: "documentBlock";Defined in: src/types/media.ts:475
Discriminator for document content.
readonly name: string;Defined in: src/types/media.ts:480
Document name.
Implementation of
Section titled “Implementation of”format
Section titled “format”readonly format: DocumentFormat;Defined in: src/types/media.ts:485
Document format.
Implementation of
Section titled “Implementation of”source
Section titled “source”readonly source: DocumentSource;Defined in: src/types/media.ts:490
Document source.
Implementation of
Section titled “Implementation of”citations?
Section titled “citations?”readonly optional citations: { enabled: boolean;};Defined in: src/types/media.ts:495
Citation configuration.
enabled
Section titled “enabled”enabled: boolean;Implementation of
Section titled “Implementation of”context?
Section titled “context?”readonly optional context: string;Defined in: src/types/media.ts:500
Context information for the document.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON(): { document: { name: string; format: DocumentFormat; source: | { bytes: string; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; }; citations?: { enabled: boolean; }; context?: string; };};Defined in: src/types/media.ts:547
Serializes the DocumentBlock to a JSON-compatible ContentBlockData object. Called automatically by JSON.stringify(). Uint8Array bytes are encoded as base64 string.
Returns
Section titled “Returns”{ document: { name: string; format: DocumentFormat; source: | { bytes: string; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; }; citations?: { enabled: boolean; }; context?: string; };}| Name | Type | Description | Defined in |
|---|---|---|---|
document | { name: string; format: DocumentFormat; source: | { bytes: string; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; }; citations?: { enabled: boolean; }; context?: string; } | - | src/types/media.ts:547 |
document.name | string | Document name. | src/types/media.ts:445 |
document.format | DocumentFormat | Document format. | src/types/media.ts:450 |
document.source | | { bytes: string; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; } | Document source. | src/types/media.ts:455 |
document.citations? | { enabled: boolean; } | Citation configuration. | src/types/media.ts:460 |
document.citations.enabled | boolean | - | src/types/media.ts:460 |
document.context? | string | Context information for the document. | src/types/media.ts:465 |
Implementation of
Section titled “Implementation of”JSONSerializable.toJSONfromJSON()
Section titled “fromJSON()”static fromJSON(data): DocumentBlock;Defined in: src/types/media.ts:576
Creates a DocumentBlock instance from its wrapped data format. Base64-encoded bytes are decoded back to Uint8Array.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | { document: { name: string; format: DocumentFormat; source: | { bytes: string | Uint8Array<ArrayBufferLike>; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; }; citations?: { enabled: boolean; }; context?: string; }; } | Wrapped DocumentBlockData to deserialize (accepts both string and Uint8Array for bytes) |
data.document | { name: string; format: DocumentFormat; source: | { bytes: string | Uint8Array<ArrayBufferLike>; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; }; citations?: { enabled: boolean; }; context?: string; } | - |
data.document.name | string | Document name. |
data.document.format | DocumentFormat | Document format. |
data.document.source | | { bytes: string | Uint8Array<ArrayBufferLike>; } | { text: string; } | { content: { text: string; }[]; } | { s3Location: { uri: string; bucketOwner?: string; }; } | Document source. |
data.document.citations? | { enabled: boolean; } | Citation configuration. |
data.document.citations.enabled | boolean | - |
data.document.context? | string | Context information for the document. |
Returns
Section titled “Returns”DocumentBlock
DocumentBlock instance