FastAPI-based search and RAG engine for local Markdown files powered by FAISS and multilingual E5 embeddings
Project description
Sententia
FastAPI-based search and RAG engine for local Markdown files, powered by FAISS and multilingual E5 embeddings.
Quick Start
Install:
pip install sententia
Run with OpenAI-compatible LLM:
sententia /path/to/markdown/docs \
--llm-protocol openai \
--llm-url https://api.openai.com \
--llm-model gpt-4o \
--llm-token sk-...
Run with Anthropic:
sententia /path/to/markdown/docs \
--llm-protocol anthropic \
--llm-url https://api.anthropic.com \
--llm-model claude-sonnet-4-6 \
--llm-token sk-ant-...
Run with Ollama (no API key needed):
sententia /path/to/markdown/docs \
--llm-protocol ollama \
--llm-url http://localhost:11434 \
--llm-model llama3
Features
- Semantic search — FAISS index with
intfloat/multilingual-e5-baseembeddings - RAG Q&A — retrieve relevant chunks and generate answers via LLM
- Multiple LLM providers — OpenAI, Anthropic, Ollama
- Dual interface — REST API server or MCP server (Model Context Protocol)
- File access — read original Markdown files by relative path
Usage
sententia DATA_DIR [OPTIONS]
| Option | Description | Default |
|---|---|---|
DATA_DIR |
Path to Markdown files directory | (required) |
--index-path |
Path to FAISS index file (persisted) | in-memory |
--llm-protocol |
LLM provider: openai, anthropic, ollama |
(required) |
--llm-url |
LLM API base URL (without /v1 version path) |
(required) |
--llm-model |
LLM model identifier | (required) |
--llm-token |
API key (falls back to SENTENTIA_LLM_TOKEN env var) |
— |
--host |
Server bind address | 0.0.0.0 |
--port |
Server port | 8000 |
--mcp |
Run as MCP server instead of REST API | false |
Reference
REST API
Search documents
POST /search
{ "query": "how to configure logging", "top": 10 }
Response:
{
"results": [
{ "text": "...", "source": "docs/guide.md", "score": 0.87 }
]
}
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string |
"" |
Search query |
top |
integer |
10 |
Number of results (1–100) |
Ask a question (RAG)
POST /ask
{ "query": "how to configure logging" }
Response:
{
"answer": "To configure logging...",
"sources": ["docs/guide.md", "docs/reference.md"]
}
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string |
"" |
Question to answer |
Read file
GET /files/{path}
Response:
{ "text": "file contents...", "source": "docs/guide.md" }
MCP Tools
Launch with --mcp flag to expose tools via Model Context Protocol.
search — Search for relevant documents in the knowledge base.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string |
— | Search query |
top |
integer |
10 |
Number of results |
Returns list of { text, source, score }.
ask — Ask a question and get an answer based on indexed documents.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string |
— | Question to answer |
Returns { answer, sources }.
files — Read file content by path.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
string |
— | Relative file path |
Returns { text, source }.
Development
Clone and install with dev dependencies:
git clone https://github.com/qarium/sententia.git
cd sententia
pip install -e ".[test]"
Run tests:
pytest
Lint:
ruff check sententia tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sententia-0.0.0.tar.gz.
File metadata
- Download URL: sententia-0.0.0.tar.gz
- Upload date:
- Size: 68.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e16ec3459f564af044dab9fbb58d3cf1d8f855fcf61006e378b753d41aa6c92
|
|
| MD5 |
f740aeb12c4537509674d59ea39b6c11
|
|
| BLAKE2b-256 |
bae1f0871c1ace20324a992169720a7b4f6f205e7f421050993b136df37ffaa6
|
File details
Details for the file sententia-0.0.0-py3-none-any.whl.
File metadata
- Download URL: sententia-0.0.0-py3-none-any.whl
- Upload date:
- Size: 57.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd990e99709c0dd43d1a6eaf9638fa79b8a71f42e31ce0eb32e8c8b41d21443c
|
|
| MD5 |
3c9ce90325c9b6db1f995cdb6947c06a
|
|
| BLAKE2b-256 |
1179932414df80c6bc575e873ebe7f2d00332880869c9b6ee1188b081aa9b569
|