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.1.tar.gz (8.8 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.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gptme_rag-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for gptme_rag-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c96f02620c48e28d2266637d54399a9df44c5385cfa4e2cbde02113f53df7c8
MD5 382f4b5dc3d45b6bbf8f351c9087a281
BLAKE2b-256 849638f456e1d8b2ccc196c0a99a76a3b461424873c9823cee7a735df394a29f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gptme_rag-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.5.0-1025-azure

File hashes

Hashes for gptme_rag-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a6b6e720ed4442ec545c05dc2dafba34cc5da4201630449083dd751de06c628
MD5 12672051f01da40ca14bce4f9fdbbac1
BLAKE2b-256 29062a34a5a750ff566a5f420117bab398b044da6e37b5a4bc85ec74829ca8c2

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