langchain_community.document_loaders.notebook
.NotebookLoader¶
- class langchain_community.document_loaders.notebook.NotebookLoader(path: Union[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 (Union[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: Union[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 (Union[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: 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]