• Import from "@langchain/community/document_loaders/web/notionapi" instead. This entrypoint will be removed in 0.3.0.

A class that extends the BaseDocumentLoader class. It represents a document loader for loading documents from Notion using the Notion API.

import { RecursiveCharacterTextSplitter } from "@langchain/textsplitters";

const pageLoader = new NotionAPILoader({
clientOptions: { auth: "<NOTION_INTEGRATION_TOKEN>" },
id: "<PAGE_ID>",
type: "page",
});
const splitter = new RecursiveCharacterTextSplitter();
const pageDocs = await pageLoader.loadAndSplit(splitter);
const dbLoader = new NotionAPILoader({
clientOptions: { auth: "<NOTION_INTEGRATION_TOKEN>" },
id: "<DATABASE_ID>",
type: "database",
propertiesAsHeader: true,
});
const dbDocs = await dbLoader.load();

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

Properties

pageQueueTotal: number

Methods

  • Parameters

    • Optionalsplitter: BaseDocumentTransformer<DocumentInterface<Record<string, any>>[], DocumentInterface<Record<string, any>>[]>

    Returns Promise<Document<Record<string, any>>[]>

    A Promise that resolves with an array of Document instances, each split according to the provided TextSplitter.

    Use this.load() and splitter.splitDocuments() individually. Loads the documents and splits them using a specified text splitter.