langchain_community.document_loaders.notebook.NotebookLoader¶

class langchain_community.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 (str) – The path to load the notebook from.

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

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

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

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

Methods

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

Initialize with a path.

alazy_load()

A lazy loader for Documents.

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 (str) – The path to load the notebook from.

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

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

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

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

async alazy_load() AsyncIterator[Document]¶

A lazy loader for Documents.

Return type

AsyncIterator[Document]

lazy_load() Iterator[Document]¶

A lazy loader for Documents.

Return type

Iterator[Document]

load() List[Document][source]¶

Load documents.

Return type

List[Document]

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

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

Do not override this method. It should be considered to be deprecated!

Parameters

text_splitter (Optional[TextSplitter]) – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Return type

List[Document]

Examples using NotebookLoader¶