Dosu LogoDosu Logo
Ask
Join our Discord
LlamaIndexPublic
LlamaIndex
DocumentsLlamaIndex
SimpleFileNodeParser
SimpleFileNodeParser
Type
Topic
Status
Published
Created
Oct 2, 2026
Updated
Oct 2, 2026
Created by
Dosu Bot
Updated by
Dosu Bot

SimpleFileNodeParser#

SimpleFileNodeParser is a format-dispatching node parser in llama-index-core. Given a sequence of documents, it reads each document's metadata["extension"] field and routes parsing to the appropriate format-specific parser — or falls back to a plain text split for unsupported extensions.

Dispatch table#

The routing is driven by a module-level registry :

ExtensionDelegated parser
.mdMarkdownNodeParser
.htmlHTMLNodeParser
.jsonJSONNodeParser
(other)build_nodes_from_splits (raw text)

Delegation and config propagation#

For each recognized extension, _parse_nodes instantiates the matching parser, forwarding three fields from self :

  • include_metadata
  • include_prev_next_rel
  • callback_manager

id_func is not forwarded. The delegated parsers are constructed without an explicit id_func= argument, so they fall back to the inherited default (default_id_func) defined in NodeParser. This means a custom id_func set on a SimpleFileNodeParser instance is not propagated to the sub-parsers that handle .md, .html, or .json documents.

By contrast, for unsupported extensions the fallback path calls build_nodes_from_splits with id_func=self.id_func explicitly , so custom IDs are respected for those files.

id_func in the base class and sub-parsers#

id_func is declared on the NodeParser base class as an Optional[IdFuncCallable] field . A BeforeValidator replaces None with default_id_func at construction time, so the field is never truly None after initialization . All three delegated parsers inherit this field and pass self.id_func through to build_nodes_from_splits within their own _build_node_from_split / get_nodes_from_node methods .

Known issue: JSON array ID stability#

JSONNodeParser had a separate bug (independent of SimpleFileNodeParser) where a custom id_func produced duplicate IDs for JSON arrays because the chunk index reset to zero per element. PR #23221 fixes this by collecting all per-element text splits first, then calling build_nodes_from_splits once, so the id_func receives sequential chunk indexes across the full array.

Entry points#

ItemPath
SimpleFileNodeParser sourcenode_parser/file/simple_file.py
NodeParser base / id_funcnode_parser/interface.py
MarkdownNodeParsernode_parser/file/markdown.py
HTMLNodeParsernode_parser/file/html.py
JSONNodeParsernode_parser/file/json.py
Documents
Bedrock Converse Model Compatibility
Conversation Memory Write Fencing
DocumentSummaryIndex Lifecycle
Integration Package Dependency Constraints
MarkdownNodeParser
QueryFusionRetriever Score Fusion
SimpleFileNodeParser