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.
A lazy loader for Documents.
aload
()Load data into Document objects.
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]
- 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