How abiolr/aeterna-rag works
Aeterna is a FastAPI service that accepts files and returns explainable, citation-backed survivability scores. The main workflow authenticates and rate-limits a request, checks for a cached result, extracts file metadata, gathers PRONOM/LoC facts and semantic context, then asks an LLM for evidence-based sub-scores. Python computes the final weighted score before the response is cached and returned. The README documents capabilities beyond the sampled code; those links are shown where documented, while uncertain internal wiring is omitted.
Main entry points: app.py FastAPI routes · llm_inference.py LLM inference · data_pipeline.py Context assembly · auth.py API key auth
Components 19
API and access
- FastAPI routes
app.py - API key auth
services/auth.py - Rate limiting
services/cache.py - Temporary upload
app.py
Evidence gathering
- Metadata extraction
services/file_extraction.py - Context assembly
services/data_pipeline.py - Format lookup
services/build_lookup_db.py - Similar formats
services/vector_db_setup.py
Scoring
- Scoring prompt
services/system_prompt.py - LLM inference
services/llm_inference.py - Weighted score
services/llm_inference.py
Data and state
- Score cache
services/cache.py - PostgreSQL
- Redis
- Chroma store
db/aeterna_vector_db - PRONOM and LoC data
data - LoC vector documents
data/loc_vector_docs.json
Other components
- API client
- Anthropic API
Connections 27
- API client → FastAPI routes: submits file
- FastAPI routes → API key auth: validates key
- API key auth → PostgreSQL: checks key hash
- FastAPI routes → Rate limiting: checks limits
- Rate limiting → Redis: increments counter
- API client → FastAPI routes: requests key
- FastAPI routes → API key auth: generates key
- API key auth → PostgreSQL: stores key hash
- FastAPI routes → Temporary upload: saves upload
- FastAPI routes → Score cache: checks result
- Score cache → Redis: reads cache
- FastAPI routes → LLM inference: runs scoring
- LLM inference → Context assembly: requests context
- Context assembly → Metadata extraction: extracts metadata
- Context assembly → Format lookup: looks up extension
- Format lookup → PostgreSQL: queries formats
- PRONOM and LoC data → PostgreSQL: seeds lookup data
- Context assembly → Similar formats: searches context
- Similar formats → Chroma store: queries documents
- LoC vector documents → Chroma store: seeds documents
- LLM inference → Scoring prompt: builds prompt
- LLM inference → Anthropic API: requests analysis
- LLM inference → Weighted score: computes from subscores
- LLM inference → FastAPI routes: returns result
- FastAPI routes → Score cache: stores result
- Score cache → Redis: writes cached result
- FastAPI routes → API client: returns score