Skip to main content

RAG system for querying Obsidian notes using LangGraph and local LLMs

Project description

ObsidianRAG Backend

PyPI version Python 3.11+ License: MIT

The Python backend for ObsidianRAG - a RAG system for querying Obsidian notes using LangGraph and local LLMs.

Installation

For Users (via Obsidian Plugin)

The plugin handles installation automatically. If you need to install manually:

pip install obsidianrag

For Developers

We use uv for fast, reliable dependency management:

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup
git clone https://github.com/Vasallo94/ObsidianRAG.git
cd ObsidianRAG/backend

# Install dependencies (creates virtual environment automatically)
uv sync

# Install with dev dependencies
uv sync --dev

# Run commands via uv
uv run obsidianrag serve --vault /path/to/vault
uv run pytest tests/ -v

Quick Start

As a CLI

# Start the server
obsidianrag serve --vault /path/to/your/vault

# Index/reindex the vault
obsidianrag index --vault /path/to/your/vault

# Check status
obsidianrag status

# Ask a question directly
obsidianrag ask "What are my notes about Python?"

As a Library

from obsidianrag import ObsidianRAG

# Initialize with your vault path
rag = ObsidianRAG(vault_path="/path/to/your/vault")

# Ask questions
answer, sources = rag.ask("What are my notes about Python?")
print(answer)

# Get vault stats
stats = rag.get_stats()
print(f"Total notes: {stats['total_notes']}")

Requirements

  • Python 3.11+
  • Ollama running locally with at least one LLM model

Configuration

Environment variables (prefix with OBSIDIANRAG_ for settings):

Variable Default Description
OBSIDIAN_PATH - Path to your Obsidian vault
LLM_MODEL gemma3 Ollama model to use
EMBEDDING_PROVIDER huggingface huggingface or ollama
USE_RERANKER true Enable CrossEncoder reranking
CHUNK_SIZE 1500 Text chunk size for indexing

API Endpoints

When running the server:

Endpoint Method Description
/ask POST Ask a question, returns answer + sources
/health GET System status, model info
/stats GET Vault statistics
/rebuild_db POST Force reindex all notes

Development

cd backend

# Run tests
uv run pytest tests/ -v

# Run with coverage
uv run pytest tests/ --cov=obsidianrag --cov-report=html

# Lint and format
uv run ruff check obsidianrag/ tests/
uv run ruff format obsidianrag/ tests/

# Build package
uv build

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsidianrag-3.0.1.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsidianrag-3.0.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file obsidianrag-3.0.1.tar.gz.

File metadata

  • Download URL: obsidianrag-3.0.1.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for obsidianrag-3.0.1.tar.gz
Algorithm Hash digest
SHA256 e2217a2d4ac081e797777025462acf09dd595e26be93f6b4faa1abde552a5638
MD5 5362e15750d47dae88a8631efd66a22d
BLAKE2b-256 691df73d19a733d72f17cd629a376e081b3eb9301b2f29347aed2b07b9bf97be

See more details on using hashes here.

Provenance

The following attestation bundles were made for obsidianrag-3.0.1.tar.gz:

Publisher: release-backend.yml on Vasallo94/ObsidianRAG

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file obsidianrag-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: obsidianrag-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for obsidianrag-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 396164193d229140663d86815c2d191e1c0f7f5e15d17b57ab913bc1534016ae
MD5 da9129e5995a375e439adb0e83f2f061
BLAKE2b-256 9277162c3666050abfc9f0527b081f360f72dd4fefb974f3c5ff581440cfd0f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for obsidianrag-3.0.1-py3-none-any.whl:

Publisher: release-backend.yml on Vasallo94/ObsidianRAG

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page