RLAMA is a powerful AI-driven question-answering tool for your documents, seamlessly integrating with your local Ollama models. It enables you to create, manage, and interact with Retrieval-Augmented Generation (RAG) systems tailored to your documentation needs.
- Ollama installed and running
curl -fsSL https://raw.githubusercontent.com/dontizi/rlama/main/install.sh | sh
RLAMA is built with:
- Core Language: Go (chosen for performance, cross-platform compatibility, and single binary distribution)
- CLI Framework: Cobra (for command-line interface structure)
- LLM Integration: Ollama API (for embeddings and completions)
- Storage: Local filesystem-based storage (JSON files for simplicity and portability)
- Vector Search: Custom implementation of cosine similarity for embedding retrieval
RLAMA follows a clean architecture pattern with clear separation of concerns:
rlama/
├── cmd/ # CLI commands (using Cobra)
│ ├── root.go # Base command
│ ├── rag.go # Create RAG systems
│ ├── run.go # Query RAG systems
│ └── ...
├── internal/
│ ├── client/ # External API clients
│ │ └── ollama_client.go # Ollama API integration
│ ├── domain/ # Core domain models
│ │ ├── rag.go # RAG system entity
│ │ └── document.go # Document entity
│ ├── repository/ # Data persistence
│ │ └── rag_repository.go # Handles saving/loading RAGs
│ └── service/ # Business logic
│ ├── rag_service.go # RAG operations
│ ├── document_loader.go # Document processing
│ └── embedding_service.go # Vector embeddings
└── pkg/ # Shared utilities
└── vector/ # Vector operations
- Document Processing: Documents are loaded from the file system, parsed based on their type, and converted to plain text.
- Embedding Generation: Document text is sent to Ollama to generate vector embeddings.
- Storage: The RAG system (documents + embeddings) is stored in the user's home directory (~/.rlama).
- Query Process: When a user asks a question, it's converted to an embedding, compared against stored document embeddings, and relevant content is retrieved.
- Response Generation: Retrieved content and the question are sent to Ollama to generate a contextually-informed response.
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Documents │────>│ Document │────>│ Embedding │
│ (Input) │ │ Processing │ │ Generation │
└─────────────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Query │────>│ Vector │<────│ Vector Store│
│ Response │ │ Search │ │ (RAG System)│
└─────────────┘ └─────────────┘ └─────────────┘
▲ │
│ ▼
┌─────────────┐ ┌─────────────┐
│ Ollama │<────│ Context │
│ LLM │ │ Building │
└─────────────┘ └─────────────┘
RLAMA is designed to be lightweight and portable, focusing on providing RAG capabilities with minimal dependencies. The entire system runs locally, with the only external dependency being Ollama for LLM capabilities.
You can get help on all commands by using:
rlama --help
These flags can be used with any command:
--host string Ollama host (default: localhost)
--port string Ollama port (default: 11434)
Creates a new RAG system by indexing all documents in the specified folder.
rlama rag [model] [rag-name] [folder-path]
Parameters:
model
: Name of the Ollama model to use (e.g., llama3, mistral, gemma).rag-name
: Unique name to identify your RAG system.folder-path
: Path to the folder containing your documents.
Example:
rlama rag llama3 documentation ./docs
Starts an interactive session to interact with an existing RAG system.
rlama run [rag-name]
Parameters:
rag-name
: Name of the RAG system to use.
Example:
rlama run documentation
> How do I install the project?
> What are the main features?
> exit
Displays a list of all available RAG systems.
rlama list
Permanently deletes a RAG system and all its indexed documents.
rlama delete [rag-name] [--force/-f]
Parameters:
rag-name
: Name of the RAG system to delete.--force
or-f
: (Optional) Delete without asking for confirmation.
Example:
rlama delete old-project
Or to delete without confirmation:
rlama delete old-project --force
Checks if a new version of RLAMA is available and installs it.
rlama update [--force/-f]
Options:
--force
or-f
: (Optional) Update without asking for confirmation.
Displays the current version of RLAMA.
rlama --version
or
rlama -v
To uninstall RLAMA:
If you installed via go install
:
rlama uninstall
RLAMA stores its data in ~/.rlama
. To remove it:
rm -rf ~/.rlama
RLAMA supports many file formats:
- Text:
.txt
,.md
,.html
,.json
,.csv
,.yaml
,.yml
,.xml
- Code:
.go
,.py
,.js
,.java
,.c
,.cpp
,.h
,.rb
,.php
,.rs
,.swift
,.kt
- Documents:
.pdf
,.docx
,.doc
,.rtf
,.odt
,.pptx
,.ppt
,.xlsx
,.xls
,.epub
Installing dependencies via install_deps.sh
is recommended to improve support for certain formats.
If you encounter connection errors to Ollama:
- Check that Ollama is running.
- By default, Ollama must be accessible at
http://localhost:11434
or the host and port specified by the OLLAMA_HOST environment variable. - If your Ollama instance is running on a different host or port, use the
--host
and--port
flags:rlama --host 192.168.1.100 --port 8000 list rlama --host my-ollama-server --port 11434 run my-rag
- Check Ollama logs for potential errors.
If you encounter problems with certain formats:
- Install dependencies via
./scripts/install_deps.sh
. - Verify that your system has the required tools (
pdftotext
,tesseract
, etc.).
If the answers are not relevant:
- Check that the documents are properly indexed with
rlama list
. - Make sure the content of the documents is properly extracted.
- Try rephrasing your question more precisely.
For any other issues, please open an issue on the GitHub repository providing:
- The exact command used.
- The complete output of the command.
- Your operating system and architecture.
- The RLAMA version (
rlama --version
).
RLAMA provides multiple ways to connect to your Ollama instance:
-
Command-line flags (highest priority):
rlama --host 192.168.1.100 --port 8080 run my-rag
-
Environment variable:
# Format: "host:port" or just "host" export OLLAMA_HOST=remote-server:8080 rlama run my-rag
-
Default values (used if no other method is specified):
- Host:
localhost
- Port:
11434
- Host:
The precedence order is: command-line flags > environment variable > default values.