Pipeline

Document


Chunking ──── markdown (by headers)
               paragraph (by double newlines)
               sliding (fixed window + overlap)


Embedding ─── Workers AI (@cf/baai/bge-base-en-v1.5)
               Free embeddings, ~100ms per call


Storage ───── Vectorize (vectors) + D1 (metadata)
               Free tier: 5M vectors + 5GB SQLite


Query ─────── Embed query → Vectorize search → D1 metadata lookup
               ~20ms edge latency

Chunking Strategies

Strategy Best For Split Logic
markdown Documentation Split on ##, ### headers
paragraph Articles Split on double newlines
sliding Unstructured Fixed window (512 chars) + overlap (64 chars)

Cost Comparison

Service TideRAG Pinecone Supabase
Monthly cost $0 $70+ $25+
Free vectors 5M 0 ~100K
Embeddings Free $0.02/1K $0.02/1K
Latency ~20ms ~80ms ~50ms

Cloudflare Free Tier Limits

Service Free Limit Overage
Vectorize 5M vectors $0.50/M
Workers AI 10K embeddings/day ~$0.001/1K
D1 5GB storage $0.75/GB

Agent Integration

Wrap TideRAG as a Tinkuy tool:

const searchDocs = defineTool({
  name: 'search_docs',
  description: 'Search documentation',
  execute: async (args) => {
    const results = await rag.query(args.query, { topK: 3 });
    return results.map(r => r.text).join('\n---\n');
  },
});