Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Cost-Effective RAG with Intelligent Routing and Reflection on Cloudflare

Описание и применение

Автор описывает разработку эффективной системы RAG на Cloudflare Workers, использующую интеллектуальную маршрутизацию запросов (SQL/BM25/Vector) для снижения затрат на эмбеддинги на 71%. Система включает слой рефлексии для синтеза знаний и интегрируется с Claude через MCP.

Задача

Standard RAG tutorials often result in expensive production deployments by embedding every query and lacking context-specific retrieval, while LLMs fail to answer questions about internal, non-public knowledge.

Результат

Implemented a hybrid RAG system with intelligent routing that cuts embedding costs by 71% and adds a reflection layer for better knowledge synthesis, deployed entirely on Cloudflare's free tier infrastructure.

Рабочий процесс

  • Clone the vectorize-mcp-worker repository.
  • Install dependencies using npm.
  • Create a 1024d Vectorize index using wrangler.
  • Create a D1 SQLite database using wrangler.
  • Configure wrangler.toml with database IDs and deploy the schema.
  • Deploy the worker using wrangler deploy.
  • Set the API_KEY secret.
  • Configure Claude Desktop with the MCP server URL and API key.
  • Use the exposed tools (search, ingest, etc.) via Claude Desktop.

Доказательства

In testing, that cuts average embedding cost by 71% compared to running everything through vectors.

Источник

Rough cost at 1,000 queries/day with intelligent routing: ~$0.11/month.

Источник

  • Дата записи: 2026-09-08T04:52:41.240Z