NotebookLoader#

class langchain_community.document_loaders.notebook.NotebookLoader(path: str | Path, 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 | Path) – 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.

aload()

Load data into Document objects.

lazy_load()

A lazy loader for Documents.

load()

Load documents.

load_and_split([text_splitter])

Load Documents and split into chunks.

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

Initialize with a path.

Parameters:
  • path (str | Path) – 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]

async aload() β†’ List[Document]#

Load data into Document objects.

Return type:

List[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: TextSplitter | None = 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