Langchain
Configure Browserbase for Langchain.js
1
Get your API Key
Go over the Dashboard’s Settings tab:
![](https://mintlify.s3-us-west-1.amazonaws.com/browserbase/images/quickstart/api-key.png)
Then, copy your API Key directly from the input and set the BROWSERBASE_API_KEY
environment variable.
2
Install the Browserbase SDK
npm i @browserbasehq/sdk
3
Load documents or images
Load documents
import {
BrowserbaseLoader
} from "langchain/document_loaders/web/browserbase.js";
const loader = new BrowserbaseLoader(
["https://example.com"],
{ textContent: true }
);
const docs = await loader.load();
The default value textContent: false
will return HTML as a LlamaIndex Document
.
Setting textContent: true
will return LlamaIndex Document
with text only.
Was this page helpful?