Skip to main content

RAG implementation for gptme context management

Project description

gptme-rag

RAG (Retrieval-Augmented Generation) implementation for gptme context management.

Tests PyPI version License

Features

  • 📚 Document indexing with ChromaDB
    • Fast and efficient vector storage
    • Semantic search capabilities
    • Persistent storage
  • 🔍 Semantic search with embeddings
    • Relevance scoring
    • Token-aware context assembly
    • Clean output formatting
  • 🛠️ CLI interface for testing and development
    • Index management
    • Search functionality
    • Context assembly

Installation

# Using pip
pip install gptme-rag

# Using pipx (recommended for CLI tools)
pipx install gptme-rag

# From source (for development)
git clone https://github.com/ErikBjare/gptme-rag.git
cd gptme-rag
poetry install

After installation, the gptme-rag command will be available in your terminal.

Usage

Indexing Documents

# Index markdown files in a directory
poetry run python -m gptme_rag index /path/to/documents --pattern "**/*.md"

# Index with custom persist directory
poetry run python -m gptme_rag index /path/to/documents --persist-dir ./index

Searching

# Basic search
poetry run python -m gptme_rag search "your query here"

# Advanced search with options
poetry run python -m gptme_rag search "your query" \
  --n-results 5 \
  --persist-dir ./index \
  --max-tokens 4000 \
  --show-context

Example Output

Most Relevant Documents:

1. ARCHITECTURE.md (relevance: 0.82)
  The task system is designed to help track and manage work effectively across sessions. Components include task registry, status tracking, and journal integration.

2. TASKS.md (relevance: 0.75)
  Active tasks and their current status. Includes task categories, status indicators, and progress tracking.

3. docs/workflow.md (relevance: 0.65)
  Documentation about workflow integration and best practices for task management.

Full Context:
Total tokens: 1250
Documents included: 3
Truncated: False

Development

Running Tests

# Run all tests
poetry run pytest

# Run with coverage
poetry run pytest --cov=gptme_rag

Project Structure

gptme_rag/
├── __init__.py
├── cli.py               # CLI interface
├── indexing/           # Document indexing
│   ├── document.py    # Document model
│   └── indexer.py     # ChromaDB integration
├── query/             # Search functionality
│   └── context_assembler.py  # Context assembly
└── utils/             # Utility functions

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run tests and linting
  6. Submit a pull request

Integration with gptme

This package is designed to integrate with gptme as a plugin, providing:

  • Automatic context enhancement
  • Semantic search across project files
  • Knowledge base integration
  • Smart context assembly

License

MIT License. See LICENSE for details.

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

gptme_rag-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

gptme_rag-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file gptme_rag-0.1.0.tar.gz.

File metadata

  • Download URL: gptme_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.6.57-1-lts

File hashes

Hashes for gptme_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3822c1d3c49e977977ed9734fe26ede0ca3e801d4f91a2ab8255a4841d3919d
MD5 704324a01081abb7eb1fe22349d945e4
BLAKE2b-256 09aa268000c311fb872b67ffae0ca5808df31d0c2df8beb4479b18bde983ce17

See more details on using hashes here.

File details

Details for the file gptme_rag-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gptme_rag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Linux/6.6.57-1-lts

File hashes

Hashes for gptme_rag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1998c9e79bf780ac1426f11230e5fe5e7e3af3ade4bc27ed98d028a12a52f834
MD5 98d20efbc59a04b14155ddba96d82955
BLAKE2b-256 9005a7331c4c6341ea1e9d74a278060dea74733d7fbe9e65ca3805639f8e74b8

See more details on using hashes here.

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