If you've ever built AI applications in Ruby — semantic search, RAG, recommendation engines, or embedding queries — you know how quickly it becomes tedious to support multiple vector databases. Each provider has its own API, client, and quirks.
Vectra solves this problem by providing a single, unified API for all popular vector DBs, freeing you from vendor lock-in. Write your code once and switch backends effortlessly — Pinecone, Qdrant, Weaviate, and even PostgreSQL with pgvector.
GitHub Repository
🧠 Why Vectra?
Vector databases are becoming a standard in modern AI applications, yet the Ruby ecosystem lacks a consistent way to work with them. Vectra changes that with:
✨ Provider-agnostic API
- One set of methods:
upsert,query,delete, and more — no need to learn each vendor's SDK. Documentation
⚙️ Support for multiple databases
- Pinecone
- Qdrant
- Weaviate
- pgvector All through the same client. GitHub
💪 Production-ready
- Retry logic, configurable backoff, observability through metrics, and ready-to-use classes for production workloads. Docs
📦 Rails Integration
- Use
has_vectorDSL for ActiveRecord models — embedding fields can be automatically indexed and searched. GitHub
📚 Well-documented gem
- Guides, YARD documentation, and examples for each provider. Documentation
Example usage:
require 'vectra'
# Initialize client for any provider
client = Vectra::Client.new(
provider: :pinecone,
api_key: ENV['PINECONE_API_KEY'],
environment: 'us-west-4'
)
# Upsert an embedding
client.upsert(
vectors: [
{ id: 'doc-1', values: [0.1,0.2,0.3], metadata: { title: 'Hello' } }
]
)
# Query for similar vectors
results = client.query(vector: [0.1,0.2,0.3], top_k: 5)
results.each { |m| puts "#{m.id}: #{m.score}" }
# Delete
client.delete(ids: ['doc-1'])
The same API works without changes if you switch the client to Qdrant, Weaviate, or pgvector.
💡 When Vectra is Useful
Building applications with semantic search
Implementing RAG (retrieval-augmented generation) with embeddings
Avoiding vendor lock-in across vector databases
Having a consistent Ruby API surface for all vector databases
📦 Where to Find It
GitHub: [https://github.com/stokry/vectra
Documentation: [https://vectra-docs.netlify.app/
If you’re working with embeddings and vector search in Ruby (especially in Rails apps), Vectra can save you hours of frustration and make your architecture future-proof — letting you switch backends without rewriting code
Top comments (0)