How aarya695/edge-ai-offline-assistant works
Purpose and entry point
This repository provides a privacy-focused offline AI assistant backend. The sole application entry point is backend.py, served with Uvicorn as backend:app. It is intended to use a locally running, quantized GGUF language model rather than a hosted model API.
API backend
backend.py defines the application server and is the central integration boundary for clients. It likely owns request intake, prompt construction/control, safety enforcement, forwarding inference requests, and returning generated responses. No frontend, CLI application, or separate service modules are present in the repository.
Local model inference boundary
The assistant does not package or execute model inference directly. Instead, it depends on an externally built and launched llama.cpp llama-server process. backend.py is expected to communicate with that local inference server, separating application policy/API concerns from model execution.
Relevant repository path:
• backend.py
Model and runtime deployment
A user manually downloads a GGUF model, such as a small Qwen model, and stores it outside the repository (example: C:\models\). llama.cpp is cloned and compiled separately with CMake, then started with the selected model file. This keeps model weights, native inference binaries, and potentially hardware-specific build settings out of version control.
Safety and prompt-control stage
The stated product design includes safety and prompt-control layers around the local model. These controls belong at the backend-to-inference boundary: validate or constrain incoming user prompts before inference, and potentially inspect or constrain generated output before returning it. Their implementation, if present, is consolidated in:
• backend.py
Primary control flow
1. A client sends a request to the Uvicorn-hosted application.
2. backend.py accepts and processes the request.
3. The backend applies assistant prompt and safety policy.
4. The backend sends the resulting inference request to the local llama-server.
5. The local llama.cpp runtime loads the GGUF model and generates output.
6. backend.py returns the controlled response to the caller.
Infrastructure and external dependencies
Runtime infrastructure consists of Python/Uvicorn for the API service and a separately compiled native llama.cpp server for inference. External acquisition is limited to the llama.cpp source repository and a manually downloaded Hugging Face GGUF model; normal operation is intended to remain local/offline after setup.
Relevant paths:
• README.md
• backend.py
Main entry points: backend.py Prompt & Safety Control · README.md Setup Documentation
Components 8
Python API Backend
Uvicorn-hosted local assistant service.
- Uvicorn · Serves backend:app.
backend.py - Assistant API · Central request, policy, inference, and response boundary.
backend.py - Prompt & Safety Control · Constrains input prompts and generated output.
backend.py - Inference Client · Forwards controlled inference requests.
backend.py
External Local Runtime
Built and operated outside this repository.
- llama-server · Separately compiled native local inference process.
- GGUF Model · Manually downloaded and stored outside the repository.
Other components
- Local Client
- Setup Documentation · Documents local model and llama.cpp setup.
README.md
Connections 10
- Local Client → Uvicorn: HTTP request
- Uvicorn → Assistant API: ASGI
- Assistant API → Prompt & Safety Control: process request
- Prompt & Safety Control → Inference Client: controlled prompt
- Inference Client → llama-server: local inference request
- llama-server → GGUF Model: loads
- llama-server → Prompt & Safety Control: generated output
- Prompt & Safety Control → Assistant API: controlled response
- Setup Documentation → llama-server: setup guidance
- Setup Documentation → GGUF Model: model setup guidance