From 09be3ff54a7af5020930371eebfe49e0106cf43a Mon Sep 17 00:00:00 2001 From: bracesproul Date: Thu, 1 Aug 2024 13:03:36 -0700 Subject: [PATCH] docs[minor]: Updated puppeteer loader --- .../web_loaders/web_puppeteer.ipynb | 543 ++++++++++++++++++ .../web_loaders/web_puppeteer.mdx | 73 --- .../src/cli/docs/document_loaders.ts | 128 +++-- .../cli/docs/templates/document_loaders.ipynb | 15 +- 4 files changed, 630 insertions(+), 129 deletions(-) create mode 100644 docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb delete mode 100644 docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb new file mode 100644 index 000000000000..332ded7ae820 --- /dev/null +++ b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb @@ -0,0 +1,543 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "sidebar_label: Puppeteer\n", + "sidebar_class_name: node-only\n", + "---" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# PuppeteerWebBaseLoader\n", + "\n", + "```{=mdx}\n", + ":::tip Compatibility\n", + "\n", + "Only available on Node.js.\n", + "\n", + ":::\n", + "```\n", + "\n", + "This notebook provides a quick overview for getting started with [PuppeteerWebBaseLoader](/docs/integrations/document_loaders/). For detailed documentation of all PuppeteerWebBaseLoader features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain_community_document_loaders_web_puppeteer.PuppeteerWebBaseLoader.html).\n", + "\n", + "Puppeteer is a Node.js library that provides a high-level API for controlling headless Chrome or Chromium. You can use Puppeteer to automate web page interactions, including extracting data from dynamic web pages that require JavaScript to render.\n", + "\n", + "If you want a lighterweight solution, and the webpages you want to load do not require JavaScript to render, you can use the [CheerioWebBaseLoader](/docs/integrations/document_loaders/web_loaders/web_cheerio) instead.\n", + "\n", + "## Overview\n", + "### Integration details\n", + "\n", + "| Class | Package | Local | Serializable | PY support |\n", + "| :--- | :--- | :---: | :---: | :---: |\n", + "| [PuppeteerWebBaseLoader](https://api.js.langchain.com/classes/langchain_community_document_loaders_web_puppeteer.PuppeteerWebBaseLoader.html) | [@langchain/community](https://api.js.langchain.com/modules/langchain_community_document_loaders_web_puppeteer.html) | ✅ | beta | ❌ | \n", + "### Loader features\n", + "| Source | Web Loader | Node Envs Only\n", + "| :---: | :---: | :---: | \n", + "| PuppeteerWebBaseLoader | ✅ | ✅ | \n", + "\n", + "## Setup\n", + "\n", + "To access `PuppeteerWebBaseLoader` document loader you'll need to install the `@langchain/community` integration package, along with the `puppeteer` peer dependency.\n", + "\n", + "### Credentials\n", + "\n", + "If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n", + "\n", + "```bash\n", + "# export LANGCHAIN_TRACING_V2=\"true\"\n", + "# export LANGCHAIN_API_KEY=\"your-api-key\"\n", + "```\n", + "\n", + "### Installation\n", + "\n", + "The LangChain PuppeteerWebBaseLoader integration lives in the `@langchain/community` package:\n", + "\n", + "```{=mdx}\n", + "import IntegrationInstallTooltip from \"@mdx_components/integration_install_tooltip.mdx\";\n", + "import Npm2Yarn from \"@theme/Npm2Yarn\";\n", + "\n", + "\n", + "\n", + "\n", + " @langchain/community puppeteer\n", + "\n", + "\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Instantiation\n", + "\n", + "Now we can instantiate our model object and load documents:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import { PuppeteerWebBaseLoader } from \"@langchain/community/document_loaders/web/puppeteer\"\n", + "\n", + "const loader = new PuppeteerWebBaseLoader(\"https://langchain.com\", {\n", + " // required params = ...\n", + " // optional params = ...\n", + "})" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Load" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Document {\n", + " pageContent: '
\\n' +\n", + " '\\n' +\n", + " ' Promise;\n", + "};\n", + "```\n", + "\n", + "1. `launchOptions`: an optional object that specifies additional options to pass to the puppeteer.launch() method. This can include options such as the headless flag to launch the browser in headless mode, or the slowMo option to slow down Puppeteer's actions to make them easier to follow.\n", + "\n", + "2. `gotoOptions`: an optional object that specifies additional options to pass to the page.goto() method. This can include options such as the timeout option to specify the maximum navigation time in milliseconds, or the waitUntil option to specify when to consider the navigation as successful.\n", + "\n", + "3. `evaluate`: an optional function that can be used to evaluate JavaScript code on the page using the page.evaluate() method. This can be useful for extracting data from the page or interacting with page elements. The function should return a Promise that resolves to a string containing the result of the evaluation.\n", + "\n", + "By passing these options to the `PuppeteerWebBaseLoader` constructor, you can customize the behavior of the loader and use Puppeteer's powerful features to scrape and interact with web pages.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Screenshots\n", + "\n", + "To take a screenshot of a site, initialize the loader the same as above, and call the `.screenshot()` method.\n", + "This will return an instance of `Document` where the page content is a base64 encoded image, and the metadata contains a `source` field with the URL of the page." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "iVBORw0KGgoAAAANSUhEUgAACWAAAAdoCAIAAAA/Q2IJAAAAAXNSR0IArs4c6QAAIABJREFUeJzsvUuzHUeSJuaPiMjMk3nOuU88\n", + "{ source: 'https://langchain.com' }\n" + ] + } + ], + "source": [ + "import { PuppeteerWebBaseLoader } from \"@langchain/community/document_loaders/web/puppeteer\";\n", + "\n", + "const loaderForScreenshot = new PuppeteerWebBaseLoader(\"https://langchain.com\", {\n", + " launchOptions: {\n", + " headless: true,\n", + " },\n", + " gotoOptions: {\n", + " waitUntil: \"domcontentloaded\",\n", + " },\n", + "});\n", + "const screenshot = await loaderForScreenshot.screenshot();\n", + "\n", + "console.log(screenshot.pageContent.slice(0, 100));\n", + "console.log(screenshot.metadata);" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## API reference\n", + "\n", + "For detailed documentation of all PuppeteerWebBaseLoader features and configurations head to the API reference: https://api.js.langchain.com/classes/langchain_community_document_loaders_web_puppeteer.PuppeteerWebBaseLoader.html" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "TypeScript", + "language": "typescript", + "name": "tslab" + }, + "language_info": { + "codemirror_mode": { + "mode": "typescript", + "name": "javascript", + "typescript": true + }, + "file_extension": ".ts", + "mimetype": "text/typescript", + "name": "typescript", + "version": "3.7.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx b/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx deleted file mode 100644 index 8398a175eec8..000000000000 --- a/docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.mdx +++ /dev/null @@ -1,73 +0,0 @@ ---- -sidebar_position: 2 -sidebar_label: Puppeteer -hide_table_of_contents: true -sidebar_class_name: node-only ---- - -# Webpages, with Puppeteer - -:::tip Compatibility -Only available on Node.js. -::: - -This example goes over how to load data from webpages using Puppeteer. One document will be created for each webpage. - -Puppeteer is a Node.js library that provides a high-level API for controlling headless Chrome or Chromium. You can use Puppeteer to automate web page interactions, including extracting data from dynamic web pages that require JavaScript to render. - -If you want a lighterweight solution, and the webpages you want to load do not require JavaScript to render, you can use the [CheerioWebBaseLoader](/docs/integrations/document_loaders/web_loaders/web_cheerio) instead. - -## Setup - -```bash npm2yarn -npm install puppeteer -``` - -## Usage - -```typescript -import { PuppeteerWebBaseLoader } from "@langchain/community/document_loaders/web/puppeteer"; - -/** - * Loader uses `page.evaluate(() => document.body.innerHTML)` - * as default evaluate function - **/ -const loader = new PuppeteerWebBaseLoader("https://www.tabnews.com.br/"); - -const docs = await loader.load(); -``` - -## Options - -Here's an explanation of the parameters you can pass to the PuppeteerWebBaseLoader constructor using the PuppeteerWebBaseLoaderOptions interface: - -```typescript -type PuppeteerWebBaseLoaderOptions = { - launchOptions?: PuppeteerLaunchOptions; - gotoOptions?: PuppeteerGotoOptions; - evaluate?: (page: Page, browser: Browser) => Promise; -}; -``` - -1. `launchOptions`: an optional object that specifies additional options to pass to the puppeteer.launch() method. This can include options such as the headless flag to launch the browser in headless mode, or the slowMo option to slow down Puppeteer's actions to make them easier to follow. - -2. `gotoOptions`: an optional object that specifies additional options to pass to the page.goto() method. This can include options such as the timeout option to specify the maximum navigation time in milliseconds, or the waitUntil option to specify when to consider the navigation as successful. - -3. `evaluate`: an optional function that can be used to evaluate JavaScript code on the page using the page.evaluate() method. This can be useful for extracting data from the page or interacting with page elements. The function should return a Promise that resolves to a string containing the result of the evaluation. - -By passing these options to the `PuppeteerWebBaseLoader` constructor, you can customize the behavior of the loader and use Puppeteer's powerful features to scrape and interact with web pages. - -Here is a basic example to do it: - -import CodeBlock from "@theme/CodeBlock"; -import Example from "@examples/document_loaders/puppeteer_web.ts"; -import ScreenshotExample from "@examples/document_loaders/puppeteer_screenshot_web.ts"; - -{Example} - -### Screenshots - -To take a screenshot of a site, initialize the loader the same as above, and call the `.screenshot()` method. -This will return an instance of `Document` where the page content is a base64 encoded image, and the metadata contains a `source` field with the URL of the page. - -{ScreenshotExample} diff --git a/libs/langchain-scripts/src/cli/docs/document_loaders.ts b/libs/langchain-scripts/src/cli/docs/document_loaders.ts index 359b94034e44..0ffbfde2da31 100644 --- a/libs/langchain-scripts/src/cli/docs/document_loaders.ts +++ b/libs/langchain-scripts/src/cli/docs/document_loaders.ts @@ -9,15 +9,12 @@ import { } from "../utils/get-input.js"; const NODE_OR_WEB_PLACEHOLDER = "__fs_or_web__"; -const PACKAGE_NAME_PLACEHOLDER = "__package_name__"; +const NODE_OR_WEB_IMPORT_PATH_PLACEHOLDER = "__fs_or_web_import_path__"; +const FILE_NAME_PLACEHOLDER = "__file_name__"; const MODULE_NAME_PLACEHOLDER = "__ModuleName__"; -const PACKAGE_NAME_SHORT_SNAKE_CASE_PLACEHOLDER = - "__package_name_short_snake_case__"; -const PACKAGE_NAME_SNAKE_CASE_PLACEHOLDER = "__package_name_snake_case__"; -const PACKAGE_IMPORT_PATH_PLACEHOLDER = "__import_path__"; -// This should not be prefixed with `Chat` as it's used for API keys. -const MODULE_NAME_ALL_CAPS_PLACEHOLDER = "__MODULE_NAME_ALL_CAPS__"; +const API_REF_BASE_PACKAGE_URL = `https://api.js.langchain.com/modules/langchain_community_document_loaders_${NODE_OR_WEB_PLACEHOLDER}_${FILE_NAME_PLACEHOLDER}.html`; +const API_REF_BASE_MODULE_URL = `https://v02.api.js.langchain.com/classes/langchain_community_document_loaders_${NODE_OR_WEB_PLACEHOLDER}_${FILE_NAME_PLACEHOLDER}.${MODULE_NAME_PLACEHOLDER}.html`; const SERIALIZABLE_PLACEHOLDER = "__serializable__"; const LOCAL_PLACEHOLDER = "__local__"; @@ -26,7 +23,11 @@ const PY_SUPPORT_PLACEHOLDER = "__py_support__"; const WEB_SUPPORT_PLACEHOLDER = "__web_support__"; const NODE_SUPPORT_PLACEHOLDER = "__fs_support__"; -const API_REF_BASE_MODULE_URL = `https://api.js.langchain.com/classes/langchain_community_document_loaders_${NODE_OR_WEB_PLACEHOLDER}_${PACKAGE_NAME_PLACEHOLDER}.${MODULE_NAME_PLACEHOLDER}.html`; +const NODE_ONLY_SIDEBAR_BADGE_PLACEHOLDER = "__node_only_sidebar__"; +const NODE_ONLY_TOOL_TIP_PLACEHOLDER = "__node_only_tooltip__"; + +// This should not be suffixed with `Loader` as it's used for API keys. +const MODULE_NAME_ALL_CAPS_PLACEHOLDER = "__MODULE_NAME_ALL_CAPS__"; const TEMPLATE_PATH = path.resolve( "./src/cli/docs/templates/document_loaders.ipynb" @@ -35,6 +36,17 @@ const INTEGRATIONS_DOCS_PATH = path.resolve( "../../docs/core_docs/docs/integrations/document_loaders" ); +const NODE_ONLY_TOOLTIP = `\`\`\`{=mdx} + +:::tip Compatibility + +Only available on Node.js. + +::: + +\`\`\``; +const NODE_ONLY_SIDEBAR_BADGE = `sidebar_class_name: node-only`; + const fetchAPIRefUrl = async (url: string): Promise => { try { const res = await fetch(url); @@ -48,25 +60,25 @@ const fetchAPIRefUrl = async (url: string): Promise => { }; type ExtraFields = { - nodeSupport: boolean; - webSupport: boolean; + webLoader: boolean; + nodeOnly: boolean; serializable: boolean; pySupport: boolean; local: boolean; }; async function promptExtraFields(): Promise { - const hasNodeSupport = await getUserInput( - "Does this integration support Node environments? (y/n) ", + const isWebLoader = await getUserInput( + "Is this integration a web loader? (y/n) ", undefined, true ); - const hasWebSupport = await getUserInput( - "Does this integration support web environments? (y/n) ", + const isNodeOnly = await getUserInput( + "Does this integration _only_ support Node environments? (y/n) ", undefined, true ); - const hasSerializable = await getUserInput( + const isSerializable = await getUserInput( "Does this integration support serializable output? (y/n) ", undefined, true @@ -83,14 +95,23 @@ async function promptExtraFields(): Promise { ); return { - nodeSupport: hasNodeSupport.toLowerCase() === "y", - webSupport: hasWebSupport.toLowerCase() === "y", - serializable: hasSerializable.toLowerCase() === "y", + webLoader: isWebLoader.toLowerCase() === "y", + nodeOnly: isNodeOnly.toLowerCase() === "y", + serializable: isSerializable.toLowerCase() === "y", pySupport: hasPySupport.toLowerCase() === "y", local: hasLocalSupport.toLowerCase() === "y", }; } +/** + * Will always be community. We care about: + * Module name + * file name + * Is web loader (boolean) + * Is node only (boolean) + * Does it run locally (boolean) + */ + export async function fillDocLoaderIntegrationDocTemplate(fields: { packageName: string; moduleName: string; @@ -107,55 +128,62 @@ export async function fillDocLoaderIntegrationDocTemplate(fields: { extraFields = await promptExtraFields(); } + const formattedPackageApiRefUrl = API_REF_BASE_PACKAGE_URL.replace( + NODE_OR_WEB_PLACEHOLDER, + extraFields?.webLoader ? "web" : "fs" + ).replace(FILE_NAME_PLACEHOLDER, fields.packageName); + const formattedApiRefModuleUrl = API_REF_BASE_MODULE_URL.replace( - PACKAGE_NAME_PLACEHOLDER, - fields.packageName + NODE_OR_WEB_PLACEHOLDER, + extraFields?.webLoader ? "web" : "fs" ) - .replace(MODULE_NAME_PLACEHOLDER, fields.moduleName) - .replace(NODE_OR_WEB_PLACEHOLDER, extraFields?.webSupport ? "web" : "fs"); - - const success = await fetchAPIRefUrl(formattedApiRefModuleUrl); - if (!success) { + .replace(FILE_NAME_PLACEHOLDER, fields.packageName) + .replace(MODULE_NAME_PLACEHOLDER, fields.moduleName); + + const success = await Promise.all([ + fetchAPIRefUrl(formattedApiRefModuleUrl), + fetchAPIRefUrl(formattedPackageApiRefUrl), + ]); + if (!success.find((s) => s === false)) { // Don't error out because this might be used before the package is released. console.error("Invalid package or module name. API reference not found."); } - const packageNameShortSnakeCase = fields.packageName.replaceAll("-", "_"); - const fullPackageNameSnakeCase = `langchain_community_document_loaders_${ - extraFields?.webSupport ? "web" : "fs" - }_${packageNameShortSnakeCase}`; - const fullPackageImportPath = `@langchain/community/document_loaders/${ - extraFields?.webSupport ? "web" : "fs" - }/${fields.packageName}`; - let moduleNameAllCaps = _.snakeCase(fields.moduleName).toUpperCase(); - if (moduleNameAllCaps.endsWith("DOCUMENT_LOADER")) { - moduleNameAllCaps = moduleNameAllCaps.replace("DOCUMENT_LOADER", ""); + if (moduleNameAllCaps.endsWith("_LOADER")) { + moduleNameAllCaps = moduleNameAllCaps.replace("_LOADER", ""); } const docTemplate = (await fs.promises.readFile(TEMPLATE_PATH, "utf-8")) - .replaceAll(PACKAGE_NAME_PLACEHOLDER, fields.packageName) - .replaceAll(PACKAGE_NAME_SNAKE_CASE_PLACEHOLDER, fullPackageNameSnakeCase) - .replaceAll( - PACKAGE_NAME_SHORT_SNAKE_CASE_PLACEHOLDER, - packageNameShortSnakeCase - ) - .replaceAll(PACKAGE_IMPORT_PATH_PLACEHOLDER, fullPackageImportPath) + .replaceAll(NODE_OR_WEB_PLACEHOLDER, extraFields?.webLoader ? "web" : "fs") .replaceAll(MODULE_NAME_PLACEHOLDER, fields.moduleName) .replaceAll(MODULE_NAME_ALL_CAPS_PLACEHOLDER, moduleNameAllCaps) - .replace(WEB_SUPPORT_PLACEHOLDER, extraFields?.webSupport ? "✅" : "❌") - .replace(NODE_SUPPORT_PLACEHOLDER, extraFields?.nodeSupport ? "✅" : "❌") - .replace(LOCAL_PLACEHOLDER, extraFields?.local ? "✅" : "❌") - .replace( + .replaceAll( + NODE_OR_WEB_IMPORT_PATH_PLACEHOLDER, + extraFields?.webLoader ? "web" : "fs" + ) + .replaceAll(FILE_NAME_PLACEHOLDER, fields.packageName) + .replaceAll( + NODE_ONLY_SIDEBAR_BADGE_PLACEHOLDER, + extraFields?.nodeOnly ? NODE_ONLY_SIDEBAR_BADGE : "" + ) + .replaceAll( + NODE_ONLY_TOOL_TIP_PLACEHOLDER, + extraFields?.nodeOnly ? NODE_ONLY_TOOLTIP : "" + ) + .replaceAll(WEB_SUPPORT_PLACEHOLDER, extraFields?.webLoader ? "✅" : "❌") + .replaceAll(NODE_SUPPORT_PLACEHOLDER, extraFields?.nodeOnly ? "✅" : "❌") + .replaceAll(LOCAL_PLACEHOLDER, extraFields?.local ? "✅" : "❌") + .replaceAll( SERIALIZABLE_PLACEHOLDER, - extraFields?.serializable ? "✅" : "beta" + extraFields?.serializable ? "beta" : "❌" ) - .replace(PY_SUPPORT_PLACEHOLDER, extraFields?.pySupport ? "✅" : "❌"); + .replaceAll(PY_SUPPORT_PLACEHOLDER, extraFields?.pySupport ? "✅" : "❌"); const docPath = path.join( INTEGRATIONS_DOCS_PATH, - extraFields?.webSupport ? "web_loaders" : "file_loaders", - `${packageNameShortSnakeCase}.ipynb` + extraFields?.webLoader ? "web_loaders" : "file_loaders", + `${fields.packageName}.ipynb` ); await fs.promises.writeFile(docPath, docTemplate); const prettyDocPath = docPath.split("docs/core_docs/")[1]; diff --git a/libs/langchain-scripts/src/cli/docs/templates/document_loaders.ipynb b/libs/langchain-scripts/src/cli/docs/templates/document_loaders.ipynb index bc49c5c0801c..88146d075fb2 100644 --- a/libs/langchain-scripts/src/cli/docs/templates/document_loaders.ipynb +++ b/libs/langchain-scripts/src/cli/docs/templates/document_loaders.ipynb @@ -6,6 +6,7 @@ "source": [ "---\n", "sidebar_label: __ModuleName__\n", + "__node_only_sidebar__\n", "---" ] }, @@ -17,7 +18,9 @@ "\n", "- TODO: Make sure API reference link is correct.\n", "\n", - "This notebook provides a quick overview for getting started with [__ModuleName__](/docs/integrations/document_loaders/). For detailed documentation of all __ModuleName__ features and configurations head to the [API reference](https://api.js.langchain.com/classes/__package_name_snake_case__.__ModuleName__.html).\n", + "__node_only_tooltip__\n", + "\n", + "This notebook provides a quick overview for getting started with [__ModuleName__](/docs/integrations/document_loaders/). For detailed documentation of all __ModuleName__ features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain_community_document_loaders___fs_or_web_____file_name__.__ModuleName__.html).\n", "\n", "- TODO: Add any other relevant links, like information about underlying API, etc.\n", "\n", @@ -28,11 +31,11 @@ "- TODO: Remove JS support link if not relevant, otherwise ensure link is correct.\n", "- TODO: Make sure API reference links are correct.\n", "\n", - "| Class | Package | Local | Serializable | [PY support](https://python.langchain.com/docs/integrations/document_loaders/__package_name_short_snake_case__)|\n", + "| Class | Package | Local | Serializable | [PY support](https://python.langchain.com/docs/integrations/document_loaders/__file_name__)|\n", "| :--- | :--- | :---: | :---: | :---: |\n", - "| [__ModuleName__](https://api.js.langchain.com/classes/__package_name_snake_case__.__ModuleName__.html) | @langchain/community | __local__ | __serializable__ | __py_support__ | \n", + "| [__ModuleName__](https://api.js.langchain.com/classes/langchain_community_document_loaders___fs_or_web_____file_name__.__ModuleName__.html) | [@langchain/community](https://api.js.langchain.com/modules/langchain_community_document_loaders___fs_or_web_____file_name__.html) | __local__ | __serializable__ | __py_support__ | \n", "### Loader features\n", - "| Source | Web Support | Node Support\n", + "| Source | Web Loader | Node Envs Only\n", "| :---: | :---: | :---: | \n", "| __ModuleName__ | __web_support__ | __fs_support__ | \n", "\n", @@ -97,7 +100,7 @@ }, "outputs": [], "source": [ - "import { __ModuleName__ } from \"__import_path__\"\n", + "import { __ModuleName__ } from \"@langchain/community/document_loaders/__fs_or_web_import_path__/__file_name__\"\n", "\n", "const loader = new __ModuleName__({\n", " // required params = ...\n", @@ -156,7 +159,7 @@ "source": [ "## API reference\n", "\n", - "For detailed documentation of all __ModuleName__ features and configurations head to the API reference: https://api.js.langchain.com/classes/__package_name_snake_case__.__ModuleName__.html" + "For detailed documentation of all __ModuleName__ features and configurations head to the API reference: https://api.js.langchain.com/classes/langchain_community_document_loaders___fs_or_web_____file_name__.__ModuleName__.html" ] }, {