gitmyhub

qindex-rag

Python ★ 4 updated 27d ago

Q-Index: Ingest generates questions per chunk, embeds questions (not chunks), stores chunk as payload. Query matches question-to-question.

A retrieval augmented generation tool that indexes AI generated questions instead of raw text chunks, so user questions match more accurately against your documents.

PythonQdrantOpenAI APIAnthropic APIOllamaPlaywrightsetup: moderatecomplexity 4/5

QIndex-RAG is a system for building a question answering tool over your own documents, using an approach called retrieval augmented generation. The usual version of this approach stores chunks of document text and tries to match a user's question against that raw text, which often fails because people phrase questions very differently from how documentation is written. QIndex changes this by having an AI model generate a list of likely questions for each chunk of text when the documents are first processed, then storing those generated questions instead of the raw text for matching. When a real user asks a question, it is compared against these stored questions rather than the original prose, which the project reports produces much better matches.

Before generating questions, the tool splits documents in a way that respects their structure, first by headings, then by paragraphs, and only down to individual sentences if a paragraph is still too long. Short pages are kept as one single chunk. Each chunk also gets a short summary of its source page attached to the front, so it still makes sense if it is read on its own later. Generated questions are checked against the chunk they came from and thrown out if they do not share enough real words with it, which helps prevent the system from inventing irrelevant questions.

The README includes a comparison table showing this approach scoring notably higher on matching queries to the right page than a standard chunk based approach in the author's own tests against a real documentation site.

The project ships two versions, one that uses OpenAI and Anthropic cloud APIs for embeddings and question generation, and a fully local version that runs through Ollama with no API keys required. Both store the question vectors in a Qdrant database, which can be run locally with Docker. Setup requires installing Python dependencies, a Playwright browser for crawling documentation pages, and either API keys or locally pulled Ollama models depending on which version you use.

Where it fits