NodeParser#

pydantic model llama_index.node_parser.NodeParser#

Base interface for node parser.

Show JSON schema
{
   "title": "NodeParser",
   "description": "Base interface for node parser.",
   "type": "object",
   "properties": {
      "include_metadata": {
         "title": "Include Metadata",
         "description": "Whether or not to consider metadata when splitting.",
         "default": true,
         "type": "boolean"
      },
      "include_prev_next_rel": {
         "title": "Include Prev Next Rel",
         "description": "Include prev/next node relationships.",
         "default": true,
         "type": "boolean"
      },
      "callback_manager": {
         "title": "Callback Manager"
      },
      "id_func": {
         "title": "Id Func"
      },
      "class_name": {
         "title": "Class Name",
         "type": "string",
         "default": "base_component"
      }
   }
}

Config
  • arbitrary_types_allowed: bool = True

Fields
  • callback_manager (llama_index.callbacks.base.CallbackManager)

  • id_func (llama_index.node_parser.node_utils.IdFuncCallable)

  • include_metadata (bool)

  • include_prev_next_rel (bool)

field callback_manager: CallbackManager [Optional]#
field id_func: IdFuncCallable = <function default_id_func>#

Function to generate node IDs.

field include_metadata: bool = True#

Whether or not to consider metadata when splitting.

field include_prev_next_rel: bool = True#

Include prev/next node relationships.

get_nodes_from_documents(documents: Sequence[Document], show_progress: bool = False, **kwargs: Any) List[BaseNode]#

Parse documents into nodes.

Parameters
  • documents (Sequence[Document]) – documents to parse

  • show_progress (bool) – whether to show progress bar