Alfred ML is your local, privacy-focused RAG (Retrieval-Augmented Generation) assistant. It uses Ollama to analyze your personal documents and answer questions about them, all running offline on your machine.
Before setting up Alfred ML, ensure you have the following installed:
- Python 3.10 or higher
- Ollama: This powers the LLM backend.
- Install: Follow instructions at ollama.com.
- Run: Ensure Ollama is running (
ollama serve). - Model: Alfred uses
llama3.2:1b-instruct-q4_K_Mby default. You can pull it via:ollama pull llama3.2:1b-instruct-q4_K_M
Follow these steps to set up the project on your local machine.
git clone https://github.com/yourusername/alfred-ml.git
cd alfred-mlIt is recommended to use a virtual environment to manage dependencies.
# Create the virtual environment
python3 -m venv .venv
# Activate it
source .venv/bin/activate
# On Windows, use: .venv\Scripts\activateInstall the required Python packages.
pip install -r requirements.txtThe repository includes an alfred_docs/ directory. This is where you put the documents you want Alfred to read.
- Action: Copy your
.md(Markdown) or.txt(Text) files intoalfred_docs/. - Note: This directory is tracked (or you may choose to gitignore it if you fork the repo). By default, it may contain sample files. Feel free to remove them.
Alfred comes with a convenient wrapper script ./alfred.
Simply run the script to launch the visual interface (TUI):
./alfredFrom here, you can:
- Chat: Interactively ask questions about your documents.
- Sync Documents: Index new or changed files in
alfred_docs/. - Manage Models: Switch between available Ollama models.
You can also run specific commands directly:
- Ingest/Sync: Manually trigger the indexing process.
./alfred ingest
- Quick Ask: Ask a single question without entering interactive mode.
./alfred ask "What is the summary of project X?" - Watch: Automatically sync whenever you save a file in
alfred_docs/../alfred watch
Settings are stored in alfred_config.json. This file is automatically created when you change settings (like the model) in the TUI. You can also manually edit alfred_ml/config.py to change defaults.
alfred_docs/: Drop your documents here.alfred_db/: This directory is created automatically to store the vector database. Do not commit this to version control. (It is already in.gitignore)..venv/: Your Python environment. (Ignored by.gitignore).
- "Ollama isn't reachable": Make sure the Ollama server is running (usually on port 11434).
- "No module named...": Ensure you activated your virtual environment (
source .venv/bin/activate) and installed requirements.