💬 Retail / Streaming / Support

Ask our Knowledge Base

A classic 'search our FAQ' box, powered by Cloudflare AI Search (AutoRAG) for retrieval — no Vectorize index, no embedding pipeline, no D1 schema to build for this one.

The Problem

""We want customers to get instant answers from our product docs, FAQs, and policies — but building a real RAG pipeline means an embedding step, a vector database, a retrieval API, and a generation step to wire together and operate.""

The Outcome

1

AI Search call for retrieval — no Vectorize index to provision, no embedding model to call directly, no reranking logic to write.

Live demo below
💬

Ask our Knowledge Base

Cloudflare AI Search (AutoRAG)

Productionising this

What changes when you ship this for real

This demo intentionally shows a real gap, not a rosy version

AI Search's response field (its own generated answer) only comes back via the Workers binding, not the public REST endpoint this Pages project uses. See src/lib/ai-search.ts and src/pages/api/faq.ts for the honest architecture notes — a real Workers project with the binding configured gets generation for free.

Grounded generation still needs prompt discipline

The fallback generation call explicitly instructs the model to answer ONLY from the provided context and say so when it can't — without that instruction, a model will happily blend retrieved context with its own general knowledge, which defeats the point of grounding.

Timeout + fallback, and empty-response detection

This endpoint uses the same resilience wrapper as the rest of this site (src/lib/ai.ts) — but generation-on-retrieved-context is a heavier reasoning task than a short direct answer, and glm-4.7-flash needed a bump from empty-response detection (not just thrown-error detection) to reliably fail over on this specific task.

Rate limiting

This is 1-2 Workers AI/AI Search calls per question — same abuse-prevention need as any public AI endpoint. Add a KV-backed rate limiter per session/IP before this goes near production traffic.

Content freshness

AI Search re-indexes its source bucket on a schedule (default ~6h). For a real FAQ/help-center use case with frequently-updated docs, trigger a re-index via the API after publishing rather than waiting for the schedule.

When retrieval finds nothing relevant

The demo explicitly returns "I couldn't find that in the knowledge base" rather than letting the model guess from general knowledge — a real support FAQ tool should never confidently answer from outside the indexed content.