Skip to main content

Git-like version control for RAG vector databases

Project description

Clamp - Version Control for RAG

Git-like versioning for vector databases.

Install

pip install clamp-rag

Quick Start

from qdrant_client import QdrantClient, models

from clamp import ClampClient

# Local Qdrant instance
qdrant = QdrantClient(":memory:")

# Create a test collection (you might need to set up the schema properly)
qdrant.create_collection(
    collection_name="test_docs",
    vectors_config=models.VectorParams(
        size=384, distance=models.Distance.COSINE
    ),  # adjust as needed
)

# Initialize Clamp
clamp_client = ClampClient(qdrant)

# Ingest v1
docs_v1 = [{"text": "First version", "vector": [0.1] * 384}]  # dummy vector
commit1 = clamp_client.ingest(
    collection="test_docs", group="docs", documents=docs_v1, message="Initial version"
)
print(f"Commit 1: {commit1}")

# Ingest v2
docs_v2 = [{"text": "Second version", "vector": [0.2] * 384}]
commit2 = clamp_client.ingest(
    collection="test_docs", group="docs", documents=docs_v2, message="Updated docs"
)
print(f"Commit 2: {commit2}")

# Check status
status = clamp_client.status(collection="test_docs", group="docs")
print(f"Current status: {status}")

# Rollback to v1
clamp_client.rollback(collection="test_docs", group="docs", commit_hash=commit1)
print("Rolled back to commit 1")

# Verify rollback worked
status_after = clamp_client.status(collection="test_docs", group="docs")
print(f"Status after rollback: {status_after}")

# Check history
history = clamp_client.history(group="docs")
print(f"History: {[h.hash[:8] for h in history]}")

How It Works

  • Versions are tracked via metadata in your vector DB
  • Rollbacks flip active/inactive flags (no data movement)
  • Local SQLite stores commit history

Requirements

  • Qdrant (local or cloud)
  • Python 3.10+

Status

Early alpha. Qdrant only. Expect bugs.

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

clamp_rag-1.0.4.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

clamp_rag-1.0.4-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file clamp_rag-1.0.4.tar.gz.

File metadata

  • Download URL: clamp_rag-1.0.4.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for clamp_rag-1.0.4.tar.gz
Algorithm Hash digest
SHA256 3b86553fed70e72b9da3ddba26223369abb9c7f636e639cd7a8e874a8183431b
MD5 a9f8ba278e6758496d817bef97d3bd0c
BLAKE2b-256 f774024971043d0aa949fd7dce6b262ec8428b8594b315dfea8f69ec432dd6a5

See more details on using hashes here.

File details

Details for the file clamp_rag-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: clamp_rag-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for clamp_rag-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b4f20a8a3fcd19e0e6fcacb401e47701b16da4f65aada82f4291dccfa2a82787
MD5 6ad1d4687174f2e4305dd279cbb4189a
BLAKE2b-256 de00d93ff0f9fd9c32ba3ae568be0572408cc84163353f9859376119d874e35d

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