Update docs

This commit is contained in:
Yiorgis Gozadinos 2025-07-19 19:57:37 +03:00
parent c1d5334804
commit 942be2271c
No known key found for this signature in database
5 changed files with 19 additions and 12 deletions

View file

@ -10,7 +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
- **Reranking**: Default search 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
@ -50,8 +50,8 @@ async with HaikuRAG("database.db") as client:
# Add document
doc = await client.create_document("Your content")
# Search (with optional reranking)
results = await client.search("query", rerank=True)
# Search (reranking enabled by default)
results = await client.search("query")
for chunk, score in results:
print(f"{score:.3f}: {chunk.content}")

View file

@ -105,12 +105,17 @@ 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.
Reranking is **enabled by default** and 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.
If you use the default reranked (running locally), it can slow down searching significantly. To disable reranking for faster searches:
```bash
RERANK=false
```
### MixedBread AI (Default)
```bash
RERANK=true
RERANK_PROVIDER="mxbai"
RERANK_MODEL="mixedbread-ai/mxbai-rerank-base-v2"
```
@ -126,7 +131,6 @@ 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"

View file

@ -1,13 +1,13 @@
# haiku.rag
`haiku.rag` is a Retrieval-Augmented Generation (RAG) library built to work on SQLite alone without the need for external vector databases. It uses [sqlite-vec](https://github.com/asg017/sqlite-vec) for storing the embeddings and performs semantic (vector) search as well as full-text search combined through Reciprocal Rank Fusion. Both open-source (Ollama) as well as commercial (OpenAI, VoyageAI) embedding providers are supported.
`haiku.rag` is a Retrieval-Augmented Generation (RAG) library built to work on SQLite alone without the need for external vector databases. It uses [sqlite-vec](https://github.com/asg017/sqlite-vec) for storing the embeddings and performs semantic (vector) search as well as full-text search combined through Reciprocal Rank Fusion. Both open-source (Ollama, MixedBread AI) as well as commercial (OpenAI, VoyageAI) embedding providers are supported.
## Features
- **Local SQLite**: No need to run additional servers
- **Support for various embedding providers**: Ollama, VoyageAI, OpenAI or add your own
- **Hybrid Search**: Vector search using `sqlite-vec` combined with full-text search `FTS5`, using Reciprocal Rank Fusion
- **Reranking**: Optional result reranking with MixedBread AI or Cohere
- **Question Answering**: Built-in QA agents using Ollama, OpenAI, or Anthropic.
- **File monitoring**: Automatically index files when run as a server
- **Extended file format support**: Parse 40+ file formats including PDF, DOCX, HTML, Markdown, audio and more. Or add a URL!
@ -34,7 +34,7 @@ async with HaikuRAG("database.db") as client:
results = await client.search("query")
# Ask questions
answer = await client.ask("Who is the author of haiku.rag?")
answer = await client.ask("Who is the author of haiku.rag?", rerank=False)
```
Or use the CLI:

View file

@ -76,7 +76,9 @@ async for doc_id in client.rebuild_database():
## Searching Documents
Basic search:
The search method performs hybrid search (vector + full-text) with **reranking enabled by default** for improved relevance:
Basic search (with reranking):
```python
results = await client.search("machine learning algorithms", limit=5)
for chunk, score in results:
@ -90,7 +92,8 @@ With options:
results = await client.search(
query="machine learning",
limit=5, # Maximum results to return
k=60 # RRF parameter for reciprocal rank fusion
k=60, # RRF parameter for reciprocal rank fusion
rerank=False # Disable reranking for faster search
)
# Process results

View file

@ -19,7 +19,7 @@ class AppConfig(BaseModel):
EMBEDDINGS_MODEL: str = "mxbai-embed-large"
EMBEDDINGS_VECTOR_DIM: int = 1024
RERANK: bool = False
RERANK: bool = True
RERANK_PROVIDER: str = "mxbai"
RERANK_MODEL: str = "mixedbread-ai/mxbai-rerank-base-v2"