はじめに
お目目パッチン、nikkieです。
llms.txtなるものを知り、作り方に興味を持ったところ、Firecrawlがサポートしているらしいと知り、試しました。
目次
llms.txt
SEOはもう終わり、時代はLLMOですよ pic.twitter.com/xFIjVZp9GT
— ところてん (@tokoroten) 2025年2月28日
ウェブサイトに設置するLLMエージェントに向けた参考文献
2024年9月提案
We propose adding a /llms.txt markdown file to websites to provide LLM-friendly content.
私が知ったきっかけは2月下旬のはてなブックマーク1。
辿った先のページに
このクラスメソッドさん記事からリンクしている LLMS.txt: AI時代のWebサイト最適化ガイド では2種類紹介されています。
- /llms.txt: サマリー
- /llms-full.txt: 完全版2
llms.txtの作り方
言及している記事を見つけました。
「How to generate LLMs.txt files」より
3点目は過去に触ったことがあるFirecrawlです。
OSSの実装の方でも、ちょうどllms.txt生成機能が追加されたようです。
LLM Text Generator: Added a new endpoint for llms.txt generation (#1201)
セルフホストしたFirecrawlでllms.txtを作る
過去記事同様に mendableai/firecrawl をgit cloneして始めました(コミットはfea249c568c4a8d63bcc2e560fd3655e73350be6)。
% docker --version Docker version 27.5.0-rd, build 7a37716
% cp apps/api/.env.example .env % docker compose build % docker compose up
.env編集内容
## To turn on DB authentication, you need to set up supabase. -USE_DB_AUTHENTICATION=true +USE_DB_AUTHENTICATION=false # add for LLM dependednt features (image alt generation, etc.) +OPENAI_BASE_URL=https://api.openai.com/v1/ -OPENAI_API_KEY= +OPENAI_API_KEY=<入力する>
これでllms.txtが作れます3。
% curl http://localhost:3002/v1/llmstxt --json '{"url": "https://firecrawl.dev", "maxUrls": 2, "showFullText": false}'
% curl http://localhost:3002/v1/llmstxt/3928d51b-83a7-49ef-84a7-b1f43e16a49b | jq . > firecrawl.llms.txt
% jq -r '.data.llmstxt' firecrawl.llms.txt
# https://firecrawl.dev llms.txt
- [Web Data Extraction](https://www.firecrawl.dev/): Transform websites into clean, LLM-ready data effortlessly.
- [Flexible Web Scraping Pricing](https://www.firecrawl.dev/pricing): Flexible pricing plans for web scraping and data extraction.
http://localhost:3002/admin/@/queues から状況が見えました。
http://localhost:3002/admin/@/queues/queue/%7BgenerateLlmsTxtQueue%7D?status=completed
OpenAIのBASE_URLとAPI_KEYを設定する必要があるというのは、プルリクエストから当たりをつけました。
https://github.com/mendableai/firecrawl/pull/1201/files#diff-84d99b7f2375d99875234d5e138420b3dcf6aaccfe3d1c942a0f2fc781fdcd60
gpt-4o-miniを使っているんですよ!
Generate a 9-10 word description and a 3-4 word title of the entire page based on ALL the content one will find on the page for this url: ${document.metadata?.url}. This will help in a user finding the page for its intended purpose. Here is the content: ${document.markdown}
終わりに
llms.txtを知り、またFirecrawlがそれを作るツールにもなることを知りました。
Firecrawlでの作り方はLLM(gpt-4o-mini)を使うものですが、プロンプトを参考にして任意のモデルでllms.txtを作れそうですね。
llms.txtやllms-full.txt、標準化はまだだと思いますが、サポートした方が有利な雰囲気があり、普及していくんじゃないかと思います。
これが用意してサイトは閲覧者がNotebookLMなどで恩恵を受けられそうですからね。
おまけ:Geminiなら無料で?
GeminiはOpenAIのAPI互換のエンドポイントも提供しているのですよ4。
.envを編集するだけで切り替えられたと思います!5
MODEL_NAME=gemini-2.0-flash OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/ OPENAI_API_KEY=<Google AIから発行したGemini APIキー(※Vertex AIではないです)>
% curl http://localhost:3002/v1/llmstxt --json '{"url": "https://firecrawl.dev", "maxUrls": 2, "showFullText": false}'
% curl http://localhost:3002/v1/llmstxt/63f62916-d8ec-4bf0-ac15-ad4a3113102d | jq -r '.data.llmstxt'
# https://firecrawl.dev llms.txt
- [Firecrawl: Web Scraping](https://www.firecrawl.dev/): Firecrawl: Web scraping and crawling API for AI, offering clean, LLM-ready data.
- [Firecrawl Pricing](https://www.firecrawl.dev/pricing): Explore Firecrawl's flexible pricing plans for web scraping and data extraction needs
- https://b.hatena.ne.jp/entry/s/dev.classmethod.jp/articles/aws-waf-bot-control-claudebot-spike/↩
-
このZennの記事では /llms-full.txt を NotebookLM に入れるという使い方が紹介されています
↩I provided @aisdk llms.txt to @NotebookLM.
— vivek patel (@patelvivekdev) 2025年2月3日
It created an Audio Overview.
You can listen to AI's conversation, covering generateText, streamText, Tools, GenerateObject, and more.https://t.co/X9dXKjYZB5 -
curl --json便利〜! ↩ - 過去の出来心 ↩
-
上で見たプルリクはモデル名のハードコードでしたが、最新では環境変数
MODEL_NAMEを見て、なければハードコードしたモデルというイケてる実装でした。https://github.com/mendableai/firecrawl/blob/fea249c568c4a8d63bcc2e560fd3655e73350be6/apps/api/src/lib/generate-llmstxt/generate-llmstxt-service.ts#L140↩