| name | blink-rag |
| description | Knowledge base with vector search, document upload, collections, and AI-powered Q&A with citations. Semantic search over uploaded documents. |
Getting Started
blink rag search docs "How do I configure auth?"
blink rag upload docs ./guide.txt
blink rag collections
MCP Tools
| Tool | Description |
|---|
blink_rag_search | Semantic search or AI Q&A over a collection |
blink_rag_collections | List available collections |
SDK Methods
const col = await blink.rag.createCollection({ name: 'docs', description: 'Product docs' })
const doc = await blink.rag.upload({
collectionName: 'docs',
filename: 'guide.txt',
content: 'Your content...',
})
await blink.rag.waitForReady(doc.id)
const results = await blink.rag.search({
collectionName: 'docs',
query: 'How do I configure auth?',
maxResults: 5,
})
const result = await blink.rag.aiSearch({
collectionName: 'docs',
query: 'What are the main features?',
model: 'google/gemini-3-flash',
})
console.log(result.answer, result.sources)
Upload Methods
await blink.rag.upload({ collectionName: 'docs', filename: 'notes.txt', content: 'Text...' })
await blink.rag.upload({ collectionName: 'docs', filename: 'article.html', url: 'https://example.com/article' })
await blink.rag.upload({ collectionName: 'docs', filename: 'report.pdf', file: { data: base64, contentType: 'application/pdf' } })
Critical: PDF Upload Pattern
Do NOT upload PDFs directly as base64 — embeddings may store incorrectly. Extract text first:
const { publicUrl } = await blink.storage.upload(pdfFile, `docs/${Date.now()}_${pdfFile.name}`)
const text = await blink.data.extractFromUrl(publicUrl)
await blink.rag.upload({ collectionName: 'docs', filename: pdfFile.name, content: text })
Document Lifecycle
Documents go through: pending → processing → ready (or error). Processing takes 30-40 seconds. Always wait before searching:
const doc = await blink.rag.upload({ ... })
await blink.rag.waitForReady(doc.id, { timeoutMs: 120000 })
Streaming AI Search
const stream = await blink.rag.aiSearch({
collectionName: 'docs',
query: 'Explain the architecture',
stream: true,
})
Model Selection
Always use google/gemini-3-flash for RAG AI search. Deprecated models will fail.
Common Errors
| Error | Fix |
|---|
| 409 "Collection exists" | Catch and reuse existing collection |
| Zero tokens in search | Document still processing — wait for ready status |
| "Identical content" on upload | Duplicate doc — catch error, use existing doc ID |