From a6595b15974f59e1cd63a2e472bd1e3c0c61e3ec Mon Sep 17 00:00:00 2001 From: Yiorgis Gozadinos Date: Sat, 19 Jul 2025 13:16:09 +0300 Subject: [PATCH] Update docs --- README.md | 5 +++-- docs/configuration.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 968c6fa1..2d70755b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Retrieval-Augmented Generation (RAG) library on SQLite. - **Multiple embedding providers**: Ollama, VoyageAI, OpenAI - **Multiple QA providers**: Ollama, OpenAI, Anthropic - **Hybrid search**: Vector + full-text search with Reciprocal Rank Fusion +- **Reranking**: Optional result reranking with MixedBread AI or Cohere - **Question answering**: Built-in QA agents on your documents - **File monitoring**: Auto-index files when run as server - **40+ file formats**: PDF, DOCX, HTML, Markdown, audio, URLs @@ -49,8 +50,8 @@ async with HaikuRAG("database.db") as client: # Add document doc = await client.create_document("Your content") - # Search - results = await client.search("query") + # Search (with optional reranking) + results = await client.search("query", rerank=True) for chunk, score in results: print(f"{score:.3f}: {chunk.content}") diff --git a/docs/configuration.md b/docs/configuration.md index 5dbba71b..ef5fb00a 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -103,6 +103,35 @@ QA_MODEL="claude-3-5-haiku-20241022" # or claude-3-5-sonnet-20241022, etc. ANTHROPIC_API_KEY="your-api-key" ``` +## Reranking + +Reranking improves search quality by re-ordering the initial search results using specialized models. When enabled, the system retrieves more candidates (3x the requested limit) and then reranks them to return the most relevant results. + +### MixedBread AI (Default) + +```bash +RERANK=true +RERANK_PROVIDER="mxbai" +RERANK_MODEL="mixedbread-ai/mxbai-rerank-base-v2" +``` + +### Cohere + +For Cohere reranking, install with Cohere extras: + +```bash +uv pip install haiku.rag --extra cohere +``` + +Then configure: + +```bash +RERANK=true +RERANK_PROVIDER="cohere" +RERANK_MODEL="rerank-v3.5" +COHERE_API_KEY="your-api-key" +``` + ## Other Settings ### Database and Storage