langchain.document_loaders.notebook.NotebookLoader

class langchain.document_loaders.notebook.NotebookLoader(path: str, include_outputs: bool = False, max_output_length: int = 10, remove_newline: bool = False, traceback: bool = False)[source]

Load Jupyter notebook (.ipynb) files.

Initialize with a path.

Parameters
  • path – The path to load the notebook from.

  • include_outputs – Whether to include the outputs of the cell. Defaults to False.

  • max_output_length – Maximum length of the output to be displayed. Defaults to 10.

  • remove_newline – Whether to remove newlines from the notebook. Defaults to False.

  • traceback – Whether to return a traceback of the error. Defaults to False.

Methods

__init__(path[, include_outputs, ...])

Initialize with a path.

lazy_load()

A lazy loader for Documents.

load()

Load documents.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__(path: str, include_outputs: bool = False, max_output_length: int = 10, remove_newline: bool = False, traceback: bool = False)[source]

Initialize with a path.

Parameters
  • path – The path to load the notebook from.

  • include_outputs – Whether to include the outputs of the cell. Defaults to False.

  • max_output_length – Maximum length of the output to be displayed. Defaults to 10.

  • remove_newline – Whether to remove newlines from the notebook. Defaults to False.

  • traceback – Whether to return a traceback of the error. Defaults to False.

lazy_load() Iterator[Document]

A lazy loader for Documents.

load() List[Document][source]

Load documents.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document]

Load Documents and split into chunks. Chunks are returned as Documents.

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using NotebookLoader