Skip to main content
Docs/Vector DB & RAG
DocsVector DB & RAG
Pro

Vector DB & RAG

Semantic search and Retrieval-Augmented Generation for your generated apps. Backed by pgvector with automatic chunking, embedding, and similarity search.

Vector DB requires the Pro plan or higher.

What It Does

The Vector DB SDK lets your app ingest text or files, automatically embed and chunk them, and search across that content by semantic meaning. Available at window.genmb.vectordb.

  • Backed by pgvector on the shared Cloud SQL instance, no external vector store to wire up.
  • Auto-chunking with sensible overlap so long documents are split into searchable segments.
  • Embedding via Gemini text-embedding-004 (768 dimensions), no model selection or API keys.
  • File ingestion supports PDF, TXT, MD, and CSV.
  • Metadata filters scope results before similarity ranking.

Quickstart

The SDK is exposed on window.genmb.vectordb when the capability is enabled in your app.

1

Ingest content

Call ingest(text, metadata) with raw text, or ingestFile(file, metadata) with a File from an upload input. Returns { documentId, chunks }.
2

Search by meaning

Call search(query, { limit, filter }). Each result includes content, a similarity score, the original metadata, and the parent documentId.
3

List or delete documents

Use list() for an admin view or delete(documentId) to remove a document and its chunks.

RAG Pattern

Combine Vector DB with the AI Chatbot SDK to build knowledge-base Q&A. Search retrieves the most relevant chunks; the chatbot uses them as grounded context.

const { results } = await window.genmb.vectordb.search(userQuestion, { limit: 3 }) const context = results.map(r => r.content).join('\n\n') const answer = await window.genmb.chatbot.send( `Answer based on this context:\n${context}\n\nQuestion: ${userQuestion}`, { systemPrompt: 'Answer based only on the provided context. If the answer is not in the context, say so.' } )

Show citations

Pass documentId back to the UI alongside the answer so users can click through to the source. This pattern is what turns a generic chatbot into a trusted knowledge assistant.

Quotas & Rate Limits

Quotas are per app and refresh hourly for the rate-limited operations.

LimitProBusiness
Max documents10,000100,000
Max storage1 GB10 GB
Searches per hour1,00010,000
Ingestions per hour1001,000

When to Use It

Vector DB is the right tool when search by meaning matters more than exact keyword match.

  • Knowledge bases - internal docs, FAQs, support runbooks, product handbooks.
  • Customer support agents that need to ground answers in your own content.
  • Document Q&A apps - let users ask questions across uploaded PDFs.
  • Recommendation features - find related articles, products, or items by description similarity.
For structured business data - users, orders, projects - use the relational Database & Schema feature instead. The two complement each other in the same app.

FAQs

How is the Vector DB different from the Database & Schema feature?
The Database & Schema feature gives you relational tables for structured data - users, products, orders. The Vector DB stores embedded text chunks for semantic search by meaning. They are complementary: keep your business data relational, keep your knowledge content vectorized.
What embedding model is used?
GenMB uses Gemini's native text-embedding-004 (768 dimensions) for both ingestion and queries. You do not provide a model or an API key - embedding is fully managed.
Do I need to chunk content myself?
No. The SDK chunks content automatically with sensible overlap when you call ingest() or ingestFile(). Chunks are returned as part of the result so you can show progress.
Can I filter searches by metadata?
Yes. Pass an optional metadata object during ingestion (e.g., { category: "support", language: "en" }), then pass a filter on search() to scope the result set. The filter applies before the vector similarity ranking.
What happens when I exceed the document quota?
New ingestions fail with a quota error until you delete documents or upgrade the plan. Use list() to inspect what is currently stored and delete() to remove individual documents. Quotas are per app, not per user.

Ready to build?

Create your first app for free, no credit card required.