@retrivora-ai/rag-engine
v1.0.8
Published
Retrivora AI is a plug-and-play AI engine for RAG chat experiences — generic vector DB + LLM provider, embeddable or standalone.
Maintainers
Readme
@retrivora-ai/rag-engine
Retrivora AI is a plug-and-play AI engine for RAG chat experiences that can be embedded into Next.js apps or used as a standalone demo app. Bring your own vector database, LLM, embeddings, and UI branding.
✨ Features (v1.0.0)
| Category | Options | |---|---| | Vector DBs | Pinecone, pgVector (PostgreSQL), MongoDB Atlas, ChromaDB, Qdrant, Milvus, Weaviate, Redis | | LLM Providers | OpenAI, Anthropic Claude, Google Gemini, Ollama, LiteLLM, Universal REST | | Integrations | LangChain (Agentic orchestration), LlamaIndex (Semantic chunking) | | Document Ingestion | Universal support for PDF, DOCX, CSV, JSON, MD, TXT | | Architecture | Modular & Pluggable registry-based system with static health checks & validators | | RAG Patterns | Simple, Hybrid, Graph-based, and Agentic workflows |
🚀 How it Works
Retrivora AI acts as a universal bridge between your data and your users. It normalizes different AI providers and Vector databases into a single interface using a registry-based architecture.
- Ingest: Upload or send documents to the
/api/uploadendpoint. They are parsed and chunked using LlamaIndex strategies if configured. - Retrieve: Queries are processed via the QueryProcessor to extract semantic hints and filter criteria.
- Generate: Context is retrieved and processed through a Pipeline (or LangChainAgent) to produce grounded, streaming responses.
📦 Installation
npm install @retrivora-ai/rag-engine🛠️ Pluggable Architecture
Starting with v1.0.0, the engine uses a modular registry for all providers. Every provider now exposes:
- Static Validators:
getValidator()for deep configuration schema checks. - Static Health Checkers:
getHealthChecker()for real-time connectivity and capability validation.
This decoupling allows you to add custom providers without modifying the core engine logic.
NPM Package Usage
1. Embed the ChatWidget
import { ConfigProvider, ChatWidget } from '@retrivora-ai/rag-engine';
export default function Layout({ children }) {
return (
<ConfigProvider
config={{
projectId: 'my-project',
ui: {
title: 'Support Bot',
primaryColor: '#6366f1',
accentColor: '#8b5cf6',
welcomeMessage: 'Hi! How can I help you today?',
},
}}
>
{children}
<ChatWidget position="bottom-right" />
</ConfigProvider>
);
}2. Mount the API routes
// src/app/api/chat/route.ts
import { createChatHandler, getRagConfig } from '@retrivora-ai/rag-engine/server';
export const POST = createChatHandler(getRagConfig());
// src/app/api/upload/route.ts
import { createUploadHandler, getRagConfig } from '@retrivora-ai/rag-engine/server';
export const POST = createUploadHandler(getRagConfig());3. Use Pipeline programmatically
import { Pipeline, getRagConfig } from '@retrivora-ai/rag-engine/server';
const config = getRagConfig();
const pipeline = new Pipeline(config);
// Ingest documents
await pipeline.ingest([{ docId: 'readme', content: 'Your document text here' }]);
// Ask questions
const { reply, sources } = await pipeline.ask('What is the refund policy?');Configuration Reference
The library is entirely dynamic. You can switch between providers simply by updating your environment variables.
| Variable | Description |
|---|---|
| RAG_PROJECT_ID | Project namespace for data isolation |
| VECTOR_DB_PROVIDER | pinecone, pgvector, mongodb, milvus, qdrant, weaviate |
| LLM_PROVIDER | openai, anthropic, gemini, ollama |
| EMBEDDING_PROVIDER | openai, ollama, google-gemini |
| RAG_ARCHITECTURE | simple, hybrid, graph, agentic |
License
MIT
