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
Metadata
Release files for sententia 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sententia-0.0.0.tar.gz | 68.2 kB | Without provenance | Details for sententia-0.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sententia-0.0.0-py3-none-any.whl | Python 3 | none | any | Details for sententia-0.0.0-py3-none-any.whl |
Total release size: 125.3 kB
Release files / sententia-0.0.0.tar.gz
| Download URL | sententia-0.0.0.tar.gz |
|---|---|
| Size | 68.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e16ec3459f564af044dab9fbb58d3cf1d8f855fcf61006e378b753d41aa6c92
|
|
BLAKE2b-256 checksum How to use checksums |
bae1f0871c1ace20324a992169720a7b4f6f205e7f421050993b136df37ffaa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / sententia-0.0.0-py3-none-any.whl
| Download URL | sententia-0.0.0-py3-none-any.whl |
|---|---|
| Size | 57.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd990e99709c0dd43d1a6eaf9638fa79b8a71f42e31ce0eb32e8c8b41d21443c
|
|
BLAKE2b-256 checksum How to use checksums |
1179932414df80c6bc575e873ebe7f2d00332880869c9b6ee1188b081aa9b569
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for sententia 0.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.