Skip to main content

Citation-verified RAG service with deterministic + semantic claim verification.

Project description

Axiom Engine

Citation-verified RAG with 6-tier confidence scoring.

Axiom Engine is a retrieval-augmented generation (RAG) service that verifies every cited claim before presenting answers. Each claim is assigned a confidence tier (1-6) based on deterministic + semantic verification.

Install

pip install axiom-rag-engine

Or with uv:

uv add axiom-rag-engine

Quick start

From PyPI

# Set required env vars (or create a .env file)
export AXIOM_ENV=development
export TAVILY_API_KEY=your_key   # or use AXIOM_ALLOW_MOCK_SEARCH=true

# Start the server
axiom-rag-engine serve

# In another terminal — send a test query
axiom-rag-engine probe "What are solid-state batteries?"

# Check resolved configuration (secrets redacted)
axiom-rag-engine check-config

From source

git clone https://github.com/FurkhanShaikh/axiom-rag-engine.git
cd axiom-rag-engine
python tasks.py install          # scaffold .env + install deps via uv
# Edit .env — fill in TAVILY_API_KEY for live web search
python tasks.py run              # start FastAPI server at http://localhost:8000
python tasks.py probe "your question"

Configuration

All settings are controlled via environment variables (or a .env file). No code changes required. Run axiom-rag-engine check-config to see the full resolved configuration.

Variable Default Description
AXIOM_ENV production Runtime environment. Set to development to disable auth.
AXIOM_API_KEYS (empty) Comma-separated API keys. Required when env != development.
TAVILY_API_KEY (empty) Tavily search API key for live web retrieval.
AXIOM_DEFAULT_SYNTHESIZER_MODEL claude-sonnet-4-5 LiteLLM model ID for synthesis.
AXIOM_DEFAULT_VERIFIER_MODEL gpt-4o-mini LiteLLM model ID for semantic verification.
AXIOM_RATE_LIMIT 20/minute Rate limit per API key or IP.
AXIOM_CACHE_TTL_SECONDS 300 Response cache TTL.
AXIOM_REDIS_URL (empty) Optional Redis URL for distributed cache.
AXIOM_CORS_ORIGINS (empty) Comma-separated allowed CORS origins.
AXIOM_DOCS_ENABLED true Set false to disable /docs and /redoc.
AXIOM_SEMANTIC_VERIFICATION_ENABLED true Enable/disable Stage 2 semantic verification.
LOG_FORMAT text json for structured log output.

See .env.example for the full list with comments.

Architecture

retriever -> scorer -> ranker -> synthesizer -> verifier -+
   ^                    ^                                 |
   |                    +-- (rewrite loop) <--------------+  (Tier 4/5 & loop < max)
   +-- (re-retrieve) <-----------------------------------+  (loop exhausted & retries left)
Module Responsibility
Retriever Web search via Tavily, dedup, HTML strip, paragraph chunking
Scorer Domain authority + content quality scoring (deterministic)
Ranker BM25-based relevance ranking with quality blend
Synthesizer LLM-powered answer generation with strict citation format
Verifier Two-stage verification: mechanical (exact match) + semantic (LLM)

Verification tiers

Tier Label Meaning
1 Authoritative Verified against official/primary source
2 Multi-Source Verified against multiple independent domains
3 Model Assisted Mechanically verified; semantic relied on model knowledge
4 Misrepresented Quote exists but claim distorts context
5 Hallucinated Quote not found in source chunk
6 Conflicted Reserved for future contradiction detection

CLI reference

axiom-rag-engine serve [--host 0.0.0.0] [--port 8000] [--reload]
axiom-rag-engine probe "question" [--url URL] [--model MODEL] [--debug]
axiom-rag-engine check-config [--format text|json]

Development

python tasks.py test             # unit tests (>=70% coverage required)
python tasks.py lint             # ruff + mypy
python tasks.py format           # auto-format
python tasks.py clean            # remove caches + venv

API

  • POST /v1/synthesize — Run the verification pipeline
  • GET /health — Liveness probe
  • GET /health/ready — Readiness probe
  • GET /metrics — Prometheus metrics

See the interactive docs at http://localhost:8000/docs when the server is running.

Docker

docker compose up --build

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axiom_rag_engine-0.1.0b1.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axiom_rag_engine-0.1.0b1-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file axiom_rag_engine-0.1.0b1.tar.gz.

File metadata

  • Download URL: axiom_rag_engine-0.1.0b1.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for axiom_rag_engine-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 24e12886153cf3eb98fe9eee2282d45e9129e4651cb7844eed2788b88cd8ccae
MD5 03ecbfee0c17c0e704dde5c976f7050b
BLAKE2b-256 de9260234ce78b9afd081679b70edc300f1a8306af0f661d09eb77a6ec29a02a

See more details on using hashes here.

File details

Details for the file axiom_rag_engine-0.1.0b1-py3-none-any.whl.

File metadata

  • Download URL: axiom_rag_engine-0.1.0b1-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for axiom_rag_engine-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 d46412f5495523c296f492b9f18812741f9131428908990b9396c2f4f9924e76
MD5 969194461a108634bdc93c6821914857
BLAKE2b-256 9f07ca3f0ce34410aaa564f73afb03833a10be5e5629ef9da2c982496b99947c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page