> ## Documentation Index
> Fetch the complete documentation index at: https://firecrawl-docs-firecrawl-replit-connector.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Langchain

> Firecrawl はドキュメントローダーとして Langchain と統合されています。

> 注記: この連携は現在も [Firecrawl API の v0 版](/ja/v0/introduction) を使用しています。Python SDK は 0.0.20、Node SDK は 0.0.36 をインストールしてください。

<div id="installation">
  ## インストール
</div>

```bash theme={null}
pip install firecrawl-py==0.0.20
```

<div id="usage">
  ## 使い方
</div>

ご自身の API キーが必要です。[https://firecrawl.dev](https://firecrawl.dev) をご確認ください

```python theme={null}
from langchain_community.document_loaders import FireCrawlLoader

loader = FireCrawlLoader(
    api_key="YOUR_API_KEY", url="https://firecrawl.dev", mode="crawl"
)

docs = loader.load()
```

<div id="modes">
  ### モード
</div>

Scrape: 単一のURLをスクレイピングし、Markdownを返します。
Crawl: 指定のURLとアクセス可能なすべてのサブページをクロールし、それぞれのページのMarkdownを返します。

```python theme={null}
loader = FireCrawlLoader(
    api_key="YOUR_API_KEY",
    url="https://firecrawl.dev",
    mode="scrape",
)

data = loader.load()
```

<div id="crawler-options">
  ### クローラーのオプション
</div>

ローダーにパラメータを渡すこともできます。これはクローラーに渡すオプションのディクショナリです。詳細は Firecrawl の API ドキュメントを参照してください。

<div id="langchain-js">
  ## Langchain JS
</div>

Langchain JS で使うには、npm でインストールします。

```bash theme={null}
npm install @mendableai/firecrawl-js
```

次に、次のように使えます。

```typescript theme={null}
import { FireCrawlLoader } from "langchain/document_loaders/web/firecrawl";

const loader = new FireCrawlLoader({
  url: "https://firecrawl.dev", // スクレイプ対象のURL
  apiKey: process.env.FIRECRAWL_API_KEY, // 省略可。環境変数 `FIRECRAWL_API_KEY` がデフォルト
  mode: "scrape", // クローラーの実行モード。"scrape" は単一URL用、"crawl" はアクセス可能なサブページ全体用
  params: {
    // Firecrawl API ドキュメントに基づく任意パラメータ
    // API ドキュメント: https://docs.firecrawl.dev
  },
});

const docs = await loader.load();
```
