Skip to main content

An open-source, high-transparency modular RAG framework for AI/ML applications

Project description

GlassBox

An open-source, high-transparency modular RAG (Retrieval-Augmented Generation) framework for AI/ML applications.

Features

  • Modular architecture with pluggable components
  • Support for multiple vector stores (Qdrant, Chroma)
  • Multiple embedding providers (OpenAI, Ollama, ONNX)
  • Database support (PostgreSQL, SQLite)
  • Comprehensive tracing and monitoring
  • FastAPI-based REST API
  • Web dashboard for trace visualization
  • Async/await support with asyncio
  • Pydantic v2 for robust configuration management

Installation

Install from PyPI:

pip install glassbox-rag

Quick Start

from glassbox_rag.core.engine import GlassBoxEngine
from glassbox_rag.config import GlassBoxConfig

# Initialize the engine
config = GlassBoxConfig()
engine = GlassBoxEngine(config)

# Ingest documents
documents = [
    {"content": "Document 1", "metadata": {"source": "source1"}},
    {"content": "Document 2", "metadata": {"source": "source2"}},
]
engine.ingest(documents)

# Retrieve relevant documents
results = engine.retrieve("query text", top_k=5)

Configuration

Configure via YAML file (config/default.yaml):

server:
  host: "0.0.0.0"
  port: 8000

vector_store:
  type: "qdrant"
  config:
    url: "http://localhost:6333"

encoder:
  type: "openai"
  config:
    api_key: "${OPENAI_API_KEY}"
    model: "text-embedding-3-small"

database:
  type: "postgresql"
  config:
    url: "postgresql://user:password@localhost/glassbox"

API Endpoints

  • GET /health - Health check
  • POST /retrieve - Retrieve documents
  • POST /ingest - Ingest new documents
  • POST /update - Update existing documents
  • GET /traces/{id} - Get execution trace
  • GET /traces/{id}/visualize - Visualize trace

Running the Server

Start the FastAPI server with Uvicorn:

python -m glassbox_rag

The server will be available at http://localhost:8000

Web Dashboard

Access the web dashboard at http://localhost:8000/ to:

  • View recent execution traces
  • Visualize trace hierarchy and timing
  • Monitor system metrics
  • Track token usage and costs

Testing

Run the test suite:

pytest tests/ -v

Plugin Architecture

Extend GlassBox with custom plugins:

  1. Create a plugin class inheriting from the appropriate base class
  2. Implement required abstract methods
  3. Register in the configuration

Example custom embedder:

from glassbox_rag.plugins.base import EmbedderBase

class CustomEmbedder(EmbedderBase):
    def encode(self, texts):
        # Your embedding implementation
        return embeddings

Architecture

GlassBox consists of several core components:

  • Engine: Orchestrates all operations
  • Encoder: Handles document and query encoding
  • Retriever: Implements retrieval strategies
  • Writeback: Manages document updates with protection
  • Metrics: Tracks token usage and costs
  • Trace: Records execution traces for debugging

License

Licensed under the Apache License 2.0. See LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit pull requests.

Support

For issues, questions, or suggestions, please open an issue on GitHub.

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

glassbox_rag-0.1.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

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

glassbox_rag-0.1.0-py3-none-any.whl (40.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glassbox_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for glassbox_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 49933bf1f1b821e8984a45cce22457bfb82b32debb9fadfb2f2dd67d452d779e
MD5 4033f083b9ff83255b9035ed08e7beaf
BLAKE2b-256 0583b7562b6ff07d278ea47656712f43b6054f462f888265e2ee3f42f1252fa8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glassbox_rag-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for glassbox_rag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 151583df8245b423ea54f21c55e13634870807a1bc8a9124e585978f1d309c5b
MD5 6d6612fad6cda1341ceb542654ccbf4c
BLAKE2b-256 8cadf3e2c7a762e2d2dcc368be883f51c1d2f9330e4d0ec4fe1c33ce2034d48b

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