About this project
Lexos is an event-driven AI document processing engine built around self-hosted language models. It pairs a high-concurrency Go gateway with asynchronous Python workers to run document summarization, retrieval-augmented generation and speech transcription without blocking HTTP request handling or relying on external AI APIs.
Key capabilities described in the README:
Self-hosted and privacy-focused: document parsing, embeddings, vector retrieval, transcription and LLM inference all run inside the self-hosted Docker environment, with no external AI APIs required.
Asynchronous processing: clients get an immediate 202 Accepted response with a task identifier while CPU-intensive work continues in the background.
Real-time answer streaming: Server-Sent Events stream generated answers token by token from the Python worker, through Redis Pub/Sub and the Go gateway, to the browser.
S3-compatible object storage: MinIO for development and Cloudflare R2 for production, using the same S3-compatible client configuration.
Content-addressed processing: SHA-256 fingerprints combine source content, operation and parameters to reuse completed artifacts and suppress concurrent duplicate processing.
Multilingual retrieval: multilingual embeddings, tokenizer-aware chunking and FAISS cosine-similarity search retrieve relevant evidence across supported languages.
Isolated automated testing: Go handlers use dependency-injected Redis and storage interfaces, while Python tests mock models, storage and network operations with Pytest and pytest-mock.
Architecture: a Next.js frontend provides workflows for transcription, summarization and question answering, with TanStack Query polling and SSE rendering. The Go + Echo gateway handles ingestion, validation, streaming uploads to object storage, task dispatch, duplicate suppression and SSE proxying. Redis acts as broker, task state store, processing cache and distributed lock layer. The Python worker polls queues and runs three pipelines: Distiller for summarization via a Map-Reduce pipeline with Qwen3 0.6B, Gleaner for RAG using FastEmbed embeddings and FAISS indexes, and Scriber for audio transcription via Faster-Whisper.
Deployment: designed for a small CPU-only VPS, roughly 4 vCPUs and 8 GB RAM, with the AI worker around a 2 GB memory budget. Quantized Q4_K_M GGUF models, memory-mapped loading, ONNX-based embeddings, per-document FAISS IndexFlatIP indexes, sequential worker concurrency and externalized state keep resource use predictable.
Running: Docker and Docker Compose are prerequisites; clone the repository and run docker-compose up --build -d. Initial boot may take minutes while model files download and cache. Production storage uses the same S3 configuration surface with an R2 endpoint and S3_REGION=auto, and lifecycle rules can be applied with Wrangler. Raw objects expire after one day and cache objects after eight days, while Redis cache metadata remains reusable for seven days.
Testing: Go gateway tests use Testify mocks for handler behavior, fingerprints, cache hits, stale-lock recovery and storage access; Python tests validate cache ownership, token-aware indexing, streaming cleanup, worker routing, artifact reuse and failure recovery; frontend CI runs TypeScript type checking, ESLint and a production Next.js build.
License: MIT.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.