Vector Databases
Learn how to configure and use vector databases with Orka JS for semantic search andRAG applications.
What is a Vector Database?
A vector database stores text as numerical vectors (embeddings) that capture semantic meaning. When you search, it finds documents with similar meaning, not just matching keywords. This is the foundation of RAG (Retrieval-Augmented Generation).
Example: Searching for "How do I authenticate users?" will find documents about "login", "OAuth", "JWT tokens", etc. — even if they don't contain the exact words.
Supported Adapters
Orka AI supports multiple vector database backends. All adapters implement the same interface, so you can switch between them without changing your application code.
# MemoryVectorAdapter
In-memory vector store — zero configuration required
import { createOrka } from '@orka-js/core';import { OpenAIAdapter } from '@orka-js/openai';import { MemoryVectorAdapter } from '@orka-js/memory'; const orka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new MemoryVectorAdapter(),}); // That's it! No external services needed.Strategic Advantages
- —Zero setup — instant 'Plug & Play' logic
- —Ultra-low latency for small datasets (<10k)
- —Ideal for CI/CD pipelines and local prototyping
Known Constraints
- —Volatile storage — cleared on process restart
- —Lacks horizontal scaling capabilities
- —In-process memory usage increases with data
# PineconeAdapter
Fully managed cloud vector database with enterprise features
npm install @pinecone-database/pinecone
import { createOrka } from '@orka-js/core';import { OpenAIAdapter } from '@orka-js/openai';import { PineconeAdapter } from '@orka-js/pinecone'; const orka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new PineconeAdapter({ apiKey: process.env.PINECONE_API_KEY!, indexHost: 'https://your-index-abc123.svc.pinecone.io', }),});Infrastructure Setup
Pinecone Vector Database
Cloud Provisioning
Create your account at pinecone.iopinecone.io
Index Architecture
CriticalSet dimensions: 1536 for OpenAI / 384 for Small Models.
Credential Retrieval
Extract API Key and Index Host URL.
Environment Sync
Inject variables into your .env.local file.
Enterprise Scalability
- Fully managed Serverless infrastructure
- Scales seamlessly to billions of vectors
- 99.99% high-availability SLA
- Advanced metadata filtering & namespaces
Trade-offs & Logistics
- Requires external cloud account & API keys
- Consumption-based pricing structure
- Data resides outside your local infrastructure
- Network latency for remote vector lookups
# QdrantAdapter
High-performance vector database — self-hosted or cloud
npm install @qdrant/js-client-rest
import { createOrka } from '@orka-js/core';import { OpenAIAdapter } from '@orka-js/openai';import { QdrantAdapter } from '@orka-js/qdrant'; const orka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new QdrantAdapter({ url: 'http://localhost:6333', // Local Docker instance // url: 'https://xyz.qdrant.io', // Or Qdrant Cloud apiKey: process.env.QDRANT_API_KEY, // Optional for local collectionName: 'my-knowledge-base', // Optional, defaults to 'orka' }),});Quick Start with Docker:
docker run -p 6333:6333 qdrant/qdrant- Full control over your data
- No vendor lock-in
- Advanced filtering & payloads
- Written in Rust — very fast
- Requires Docker or server setup
- You manage backups & scaling
# ChromaAdapter
Open-source, AI-native embedding database
npm install chromadb
import { createOrka } from '@orka-js/core';import { OpenAIAdapter } from '@orka-js/openai';import { ChromaAdapter } from '@orka-js/chroma'; const orka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new ChromaAdapter({ url: 'http://localhost:8000', collectionName: 'my-docs', }),});Quick Start with Docker:
docker run -p 8000:8000 chromadb/chromaComparison Table
| Comparison Feature | Memory | Pinecone | Qdrant | Chroma |
|---|---|---|---|---|
| Infrastructure | None | Cloud SaaS | Docker / Cloud | Docker / Local |
| Persistence | Volatile | Permanent | Permanent | Permanent |
| Scalability | < 10K | Unlimited | Millions+ | 100K+ |
| Self-hosted | N/A | No | Yes | Yes |
| Best for | Dev & Tests | Enterprise | Production | Self-Host |
Switching Between Adapters
One of Orka AI's core strengths is adapter portability. Your application code stays exactly the same — only the configuration changes:
// Development: Use in-memory storageconst devOrka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new MemoryVectorAdapter(),}); // Production: Switch to Pineconeconst prodOrka = createOrka({ llm: new OpenAIAdapter({ apiKey: process.env.OPENAI_API_KEY! }), vectorDB: new PineconeAdapter({ apiKey: process.env.PINECONE_API_KEY!, indexHost: process.env.PINECONE_INDEX_HOST!, }),}); // Your application code is IDENTICAL for bothawait orka.knowledge.create({ name: 'docs', source: [...] });const result = await orka.ask({ knowledge: 'docs', question: '...' });💡 Pro Tip: Environment-Based Configuration
Use environment variables to automatically switch adapters based on your deployment environment:
const vectorDB = process.env.NODE_ENV === 'production' ? new PineconeAdapter({ apiKey: process.env.PINECONE_API_KEY!, indexHost: process.env.PINECONE_INDEX_HOST! }) : new MemoryVectorAdapter(); const orka = createOrka({ llm, vectorDB });