Skip to content

Commit

Permalink
docs: Closes #7494 (#7504)
Browse files Browse the repository at this point in the history
Co-authored-by: jacoblee93 <[email protected]>
  • Loading branch information
ucev and jacoblee93 authored Jan 11, 2025
1 parent 9cd72c2 commit 46486be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions examples/src/document_loaders/notionapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ const pageLoader = new NotionAPILoader({

const splitter = new RecursiveCharacterTextSplitter();

// A page contents is likely to be more than 1000 characters so it's split into multiple documents (important for vectorization)
const pageDocs = await pageLoader.loadAndSplit(splitter);
// Load the documents
const pageDocs = await pageLoader.load();
// Split the documents using the text splitter
const splitDocs = await splitter.splitDocuments(pageDocs);

console.log({ pageDocs });
console.log({ splitDocs });

// Loading a database (each row is a separate document with all properties as metadata)
const dbLoader = new NotionAPILoader({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ export type NotionAPILoaderOptions = {
* id: "<PAGE_ID>",
* type: "page",
* });
* const pageDocs = await pageLoader.loadAndSplit();
* const pageDocs = await pageLoader.load();
* const splitDocs = await splitter.splitDocuments(pageDocs);
*
* const dbLoader = new NotionAPILoader({
* clientOptions: { auth: "<NOTION_INTEGRATION_TOKEN>" },
* id: "<DATABASE_ID>",
Expand Down

0 comments on commit 46486be

Please sign in to comment.