|
|
3 روز پیش | |
|---|---|---|
| .. | ||
| README.md | 3 روز پیش | |
| api.md | 3 روز پیش | |
| configuration.md | 3 روز پیش | |
| gotchas.md | 3 روز پیش | |
| patterns.md | 3 روز پیش | |
Expert guidance for implementing Cloudflare AI Search (formerly AutoRAG), Cloudflare's managed semantic search and RAG service.
AI Search is a managed RAG (Retrieval-Augmented Generation) pipeline that combines:
Key value propositions:
Data source options:
Indexing lifecycle:
1. Create AI Search instance in dashboard:
2. Configure Worker:
// wrangler.jsonc
{
"ai": {
"binding": "AI"
}
}
3. Use in Worker:
export default {
async fetch(request, env) {
const answer = await env.AI.autorag("my-search-instance").aiSearch({
query: "How do I configure caching?",
model: "@cf/meta/llama-3.3-70b-instruct-fp8-fast"
});
return Response.json({ answer: answer.response });
}
};
| Factor | AI Search | Vectorize |
|---|---|---|
| Management | Fully managed | Manual embedding + indexing |
| Use when | Want zero-ops RAG pipeline | Need custom embeddings/control |
| Indexing | Automatic (6hr cycle) | Manual via API |
| Generation | Built-in optional | Bring your own LLM |
| Data sources | R2 or website | Manual insert |
| Best for | Docs, support, enterprise search | Custom ML pipelines, real-time |
| Factor | AI Search | Workers AI (direct) |
|---|---|---|
| Context | Automatic retrieval | Manual context building |
| Use when | Need RAG (search + generate) | Simple generation tasks |
| Indexing | Built-in | Not applicable |
| Best for | Knowledge bases, docs | Simple chat, transformations |
| Method | Returns | Use When |
|---|---|---|
search() |
Search results only | Building custom UI, need raw chunks |
aiSearch() |
AI response + results | Need ready-to-use answer (chatbot, Q&A) |
AI Search is NOT ideal if:
AI Search IS ideal if:
| Limit | Value |
|---|---|
| Max instances per account | 10 |
| Max files per instance | 100,000 |
| Max file size | 4 MB |
| Index frequency | Every 6 hours |
| Force Sync rate limit | Once per 30 seconds |
| Filter nesting depth | 2 levels |
| Filters per compound | 10 |
| Score threshold range | 0.0 - 1.0 |
Navigate these references based on your task:
| Task | Read | Est. Time |
|---|---|---|
| Understand AI Search | README only | 5 min |
| Implement basic search | README → api.md | 10 min |
| Configure data source | README → configuration.md | 10 min |
| Production patterns | patterns.md | 15 min |
| Debug issues | gotchas.md | 10 min |
| Full implementation | README → api.md → patterns.md | 30 min |