Overview
The Schema module defines the foundational data structures used throughout LlamaIndex.TS, including documents, nodes, relationships, and response types.BaseNode
Base class for all node types in LlamaIndex.Properties
string
Unique identifier for the node (auto-generated if not provided)
number[]
Vector embedding of the node content
Record<string, any>
Arbitrary metadata associated with the node
string[]
Metadata keys to exclude when generating embeddings
string[]
Metadata keys to exclude when sending to LLM
Record<NodeRelationship, RelatedNodeInfo>
Relationships to other nodes (parent, child, next, previous)
Methods
method
Get node content with metadata based on mode
Convert node to RelatedNodeInfo for relationship storage
TextNode
Node representing a chunk of text, extending BaseNode.Additional Properties
string
The text content of the node
number
Start character index in the parent document
number
End character index in the parent document
string
Template for formatting text with metadata
string
Template for formatting metadata
Example
Document
Represents a complete document, extends TextNode.Additional Properties
string
Document ID (used as doc_id in chunks)
Record<string, any>
Document-level metadata
Example
NodeWithScore
Node with a relevance score, used in retrieval results.EngineResponse
Response from query or chat engines.Properties
string
The generated response text
NodeWithScore[]
Source nodes used to generate the response
Record<string, any>
Additional metadata about the response