Internal Service: scrape_ai_site
Fetches thellms.txt file from our deployed AI-optimized site. For product-specific AI articles, also fetches the dedicated product llms file.
Function Signature
Parameters
Returns
Scalable Product LLMs Architecture
For sites with many products (up to 5,000+), we use a scalable file structure:For Business AI Articles:
- Fetches only
/llms.txt - Uses general business context
For Product AI Articles:
- Fetches
/llms.txt(business context) - Also fetches
/llms/{product-slug}.txt(product details) - Falls back to root llms.txt if product file doesnβt exist
Behavior
- Strips trailing slash from deployment URL
- Adds Vercel bypass protection header if
VERCEL_BYPASS_PROTECTION_SECRETis set - Fetches
/llms.txtwith up to 5 retries (8 second delay between retries) - If
product_nameis provided, also fetches/llms/{product-slug}.txt - Returns the content for use in Step 3
Why This Architecture?
Benefits:
- Constant memory - Each AI article loads ~5KB total
- No token limits - Never hits Geminiβs context window
- Fast - Small files = fast fetches
- Independent - Update one product without touching others