Skip to main content

Browserbase 加载器

¥Browserbase Loader

说明

¥Description

Browserbase 是一个开发者平台,可以可靠地运行、管理和监控无头浏览器。

¥Browserbase is a developer platform to reliably run, manage, and monitor headless browsers.

使用以下工具为你的 AI 数据检索提供支持:

¥Power your AI data retrievals with:

安装

¥Installation

  • browserbase.com 获取 API 密钥和项目 ID,并将其设置为环境变量(BROWSERBASE_API_KEYBROWSERBASE_PROJECT_ID)。

    ¥Get an API key and Project ID from browserbase.com and set it in environment variables (BROWSERBASE_API_KEY, BROWSERBASE_PROJECT_ID).

  • 安装 Browserbase SDK

    ¥Install the Browserbase SDK:

npm i @langchain/community @langchain/core @browserbasehq/sdk

示例

¥Example

按如下方式利用 BrowserbaseLoader 让你的代理加载网站:

¥Utilize the BrowserbaseLoader as follows to allow your agent to load websites:

import { BrowserbaseLoader } from "@langchain/community/document_loaders/web/browserbase";

const loader = new BrowserbaseLoader(["https://example.com"], {
textContent: true,
});
const docs = await loader.load();

API Reference:

参数

¥Arguments

  • urls:必需。要加载的 URL 列表。

    ¥urls: Required. List of URLs to load.

选项

¥Options

  • textContent 仅检索文本内容。默认为 false

    ¥textContent Retrieve only text content. Default is false.

  • sessionId 可选。提供现有的会话 ID。

    ¥sessionId Optional. Provide an existing Session ID.

  • proxy 可选。启用/禁用代理。

    ¥proxy Optional. Enable/Disable Proxies.