feat(rag): Native RAG & Hybrid Vector Search Engine with Lucene & OpenSearch Parity - #2931
Open
ruisantana wants to merge 14 commits into
Open
feat(rag): Native RAG & Hybrid Vector Search Engine with Lucene & OpenSearch Parity#2931ruisantana wants to merge 14 commits into
ruisantana wants to merge 14 commits into
Conversation
…ster is unreachable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
This PR started out of curiosity to see whether it would be viable to embed a native RAG (Retrieval-Augmented Generation) engine directly into IPED processing. As the architecture evolved and proved to be genuinely viable for production use, I decided to share this implementation so maintainers can test it and evaluate whether this concept adds value to IPED.
The solution is designed with a highly configurable architecture:
bge-m3) and LLM providers (local offline models likeqwen3:4bvia Ollama as well as cloud APIs like Gemini/Claude).RAGAssistantPanel.java) featuring multi-session management, incremental token-by-token response rendering, interactive evidence source tables, and double-click navigation.This work can certainly evolve further with community collaboration. By providing pre-computed case embeddings and a hybrid retrieval API, it can naturally act as a high-performance backend for AI assistant interfaces and MCP agents built on top of IPED.
Summary
This PR introduces a native Retrieval-Augmented Generation (RAG) & Hybrid Vector Search Engine to IPED. It empowers forensic examiners to perform case-wide semantic search and vector-assisted retrieval across large evidence repositories.
The architecture provides full feature parity between Local Lucene KNN and Corporate OpenSearch REST Clusters, combining dense vector retrieval with classic BM25 lexical search via Reciprocal Rank Fusion (RRF).
It serves as a core retrieval backend for case search and AI assistant extensions.
Key Features
RAGAssistantPanel.java):chkScopeOnly), and evidence source tables with double-click item navigation.Targeted Scope Reduction & Item Selection Filtering (
allowedItemIds):Dual Vector Store Backends (Lucene & OpenSearch Parity):
knn_vectorindices with bulk REST ingestion and REST KNN search capabilities for enterprise multi-node setups.Complementary Hybrid Search (BM25 + Dense KNN via RRF):
Pluggable RAG Engine Backend:
Multi-Provider LLM & Remote Integration (Ollama qwen3:4b, OpenAI gpt-4o/gpt-4o-mini, Gemini, Claude):
qwen3:4b), OpenAI endpoints (gpt-4o,gpt-4o-mini, vLLM, LMStudio), and cloud APIs (Google Gemini, Anthropic Claude).chunkSimilarityThreshold) and retrieval limits (maxRetrievedChunks = 5) to fit LLM context windows efficiently.System Overview
flowchart TD subgraph Phase1["1. Ingestion Phase"] A[Extract & Fragment Text] --> B[Generate Embeddings - bge-m3] B --> C[Store Vectors in Lucene HNSW / OpenSearch KNN] end subgraph Phase2["2. Query Phase"] D[User Prompt & Scope Selection] --> E[Scope Filter - Selection / IPED Filters] E --> F1[BM25 Lexical Search] E --> F2[KNN Vector Search] F2 --> G[Apply Vector Similarity Threshold >= 0.62] F1 --> H[RRF Fusion Ranking] G --> H H --> I[Display in RAGAssistantPanel & Source Table] I --> J[LLM Response Generation - qwen3:4b / Gemini / Claude] end C --> D