Home Applications iris-vector-rag

iris-vector-rag

Community Project
This project is maintained by its author and is not officially supported by InterSystems. For technical support, please contact the project developer.
0
0 reviews
0
Awards
299
Views
0
IPM installs
0
1
Details
Releases (3)
Reviews
Issues
Pull requests (15)
6 RAG pipelines using IRIS vector search

What's new in this version

Release Notes: iris-vector-rag v0.11.4 (OEX 1.0.2)

This release represents a complete rewrite and production hardening of the
framework since the initial OEX listing (1.0.1).

Package renamed

Previously listed on OEX as intersystems-iris-rag (rag-templates on PyPI).
Now published as iris-vector-rag on PyPI with a matching OEX module name.
Importable as iris_vector_rag. The iris_rag/ shim preserves legacy imports.

Six pipeline strategies, unified interface

All pipelines share one factory call and one response shape — answer,
retrieved_documents, contexts, sources, metadata — swappable with a
single create_pipeline(type, ...) call:

  • BasicRAG — dense vector retrieval
  • BasicRAGReranking — retrieval + cross-encoder reranking
  • CRAG — Corrective RAG with relevance-gated web fallback
  • HybridGraphRAG — GraphRAG + vector hybrid with entity extraction
  • MultiQueryRRF — multi-query generation fused via Reciprocal Rank Fusion
  • ColBERT/PyLate (PLAID) — late-interaction ColBERT with in-DB PLAID index

ObjectScript SDK (RAG.SDK.*)

Five ObjectScript classes callable directly from IRIS without touching Python:

  • RAG.SDK.Pipeline — run any pipeline strategy by name
  • RAG.SDK.Search — BM25, IVFFlat, and vector search paths
  • RAG.SDK.Schema — table initialization, schema status, pip install hook
  • RAG.SDK.Bridge — overlay support and default table configuration
  • RAG.SDK.Evaluate — RAGAS evaluation from ObjectScript

Connection layer overhauled

  • All IRIS connections route through get_iris_connection() — one path,
    no duplicates.
  • Auto-detects embedded runtime via iris.runtime.get().state — skips TCP
    entirely when running inside IRIS or when IRISINSTALLDIR is set.
  • Lazy import iris.dbapi in connection_pool.py — no ImportError at
    import time when iris is absent.
  • Unified via iris-embedded-python-wrapper — handles embedded-kernel,
    embedded-local, and native-remote backends transparently.

attach_existing_corpus

Zero-copy bridge: point any pipeline at tables already in IRIS without
re-ingesting data.

Validation layer

Pre-flight checks before any pipeline runs: required tables exist, embeddings
are ≥95% non-NULL, IRIS VECTOR format valid. auto_setup=True creates missing
tables and embeddings on first use.

RAGAS evaluation

Side-by-side pipeline comparison with faithfulness, context precision, and
context recall. Uses real PMC biomedical documents — no synthetic data.

REST API and MCP server

  • FastAPI REST API ([api] extra) with Redis-backed sessions.
  • MCP server ([mcp] extra) — all pipelines exposed as MCP tools, usable
    from Claude and other MCP clients.

iris-vector-graph integration

GraphRAG, ColBERT/PLAID, BM25, IVFFlat, and shortestPath delegate to
iris-vector-graph — IRIS-native graph and vector operations without leaving
the database.

IPM/ZPM install

zpm install iris-vector-rag now also runs
pip install iris-vector-rag==0.11.4 via RAG.SDK.Schema.Install().

CI/CD

  • GitHub Actions CI on Python 3.11 and 3.12.
  • Release workflow: tests → build → PyPI (OIDC trusted publishing) →
    GitHub Release with changelog notes attached.

IRIS Vector RAG

RAG (Retrieval-Augmented Generation) pipelines powered by InterSystems IRIS vector search.

Author: Thomas Dyar (thomas.dyar@intersystems.com)

Quick Start

# 1. Clone and install
git clone https://github.com/intersystems-community/iris-vector-rag.git
cd iris-vector-rag
pip install -e .

2. Start IRIS

docker compose up -d

3. Configure

cp .env.example .env

Edit .env — add your OPENAI_API_KEY

4. Query

python -c " from iris_vector_rag import create_pipeline from iris_vector_rag.core.models import Document

pipeline = create_pipeline('basic') pipeline.load_documents(documents=[ Document(page_content='RAG combines retrieval with generation for accurate AI.', metadata={'source': 'intro.pdf'}), Document(page_content='Vector search finds similar content using embeddings.', metadata={'source': 'vectors.pdf'}), ]) result = pipeline.query('What is RAG?', top_k=5, generate_answer=True) print(result['answer']) "

Pipelines

All pipelines share the same interface — switch with one line:

from iris_vector_rag import create_pipeline

pipeline = create_pipeline('basic') # Vector similarity search pipeline = create_pipeline('basic_rerank') # + cross-encoder reranking pipeline = create_pipeline('crag') # + self-correction + web fallback pipeline = create_pipeline('graphrag') # + knowledge graph + entity reasoning pipeline = create_pipeline('multi_query_rrf') # + query expansion + rank fusion pipeline = create_pipeline('pylate_colbert') # + ColBERT late interaction

Pipeline Method Best For
basic Vector similarity General Q&A, getting started
basic_rerank Vector + reranking Higher accuracy, medical/legal
crag Vector + evaluation + web Fact-checking, current events
graphrag Vector + text + graph + RRF Complex relationships, research
multi_query_rrf Query expansion + fusion Comprehensive coverage
pylate_colbert ColBERT embeddings Fine-grained matching

Response Format

All pipelines return the same structure (LangChain/RAGAS compatible):

result = pipeline.query("What is diabetes?", top_k=5)

result["answer"] # LLM-generated answer result["retrieved_documents"] # List[Document] result["contexts"] # List[str] — for RAGAS evaluation result["sources"] # Source citations result["metadata"] # Timing, pipeline type, method used

Configuration

Environment variables (loaded automatically from .env):

OPENAI_API_KEY=sk-...          # Required for answer generation
IRIS_HOST=localhost             # IRIS SuperServer host
IRIS_PORT=1972                  # IRIS SuperServer port
IRIS_NAMESPACE=USER             # IRIS namespace
IRIS_USERNAME=_SYSTEM           # IRIS username
IRIS_PASSWORD=SYS               # IRIS password

Evaluate with RAGAS

Compare pipelines side-by-side using real RAGAS metrics:

python examples/compare_pipelines.py --pipelines basic,basic_rerank

Or in code:

from iris_vector_rag import create_pipeline
from ragas import evaluate, EvaluationDataset, SingleTurnSample
from ragas.metrics import faithfulness, context_precision, context_recall

pipeline = create_pipeline('basic') pipeline.load_documents(documents=docs) result = pipeline.query("What is diabetes?", top_k=3, generate_answer=True)

sample = SingleTurnSample( user_input="What is diabetes?", response=result["answer"], retrieved_contexts=result["contexts"], reference="Diabetes is a chronic condition...", ) scores = evaluate(EvaluationDataset(samples=[sample]), metrics=[faithfulness, context_precision, context_recall])

Optional Extras

pip install iris-vector-rag[colbert]     # ColBERT/PyLate support
pip install iris-vector-rag[dspy]        # DSPy prompt optimization
pip install iris-vector-rag[evaluation]  # RAGAS evaluation framework
pip install iris-vector-rag[api]         # REST API server (FastAPI + Redis)

MCP Server

The MCP server is implemented and available at iris_vector_rag/mcp/. It exposes 8 tools
(rag_basic, rag_basic_rerank, rag_crag, rag_graphrag, rag_pylate_colbert,
rag_iris_global_graphrag, rag_health_check, rag_metrics) over the Model Context Protocol.

pip install iris-vector-rag[mcp]
python -m iris_vector_rag.mcp start       # start server
python -m iris_vector_rag.mcp list-tools  # list available tools
python -m iris_vector_rag.mcp status      # server status

For MCP tool orchestration across IRIS packages, use
iris-agentic-dev.

Development

pip install -e ".[dspy,evaluation]"
pytest tests/unit/                    # Fast, no IRIS needed
pytest tests/unit/ tests/contract/    # Full suite, needs IRIS running

Architecture

iris_vector_rag/
├── pipelines/      # 6 RAG implementations (basic, crag, graphrag, etc.)
├── core/           # Base classes, models, connection management
├── storage/        # IRIS vector store, schema management
├── embeddings/     # Embedding generation and caching
├── services/       # Entity extraction, storage adapters
├── config/         # Configuration management
├── mcp/            # MCP server implementation
└── api/            # Optional REST API (FastAPI)

License

MIT

Last checked by moderator
06 May, 2026Impossible to Test
Made with
Install
zpm install iris-vector-rag
Version
1.0.219 Jul, 2026
Python package
iris-vector-rag
Category
Frameworks
Works with
InterSystems IRISInterSystems IRIS for HealthInterSystems Vector Search
First published
24 Jun, 2025
Last edited
19 Jul, 2026