Skip to main content

RAG client

Project description

rag-plug

Python client for the RAGPlug backend API. It supports adding documents to memory, semantic search, schema retrieval, and deleting items by ID (sync and async).

Features

  • RagPlug client with typed response models.
  • API key authentication through X-API-Key.
  • Operations scoped to a target memory (memory_name).
  • Ready-to-run Python examples in examples/.
  • CLI helper scripts for quick add/search flows.

Requirements

  • Python 3.10+
  • Poetry (recommended)

Installation

poetry install

For local editable install with pip:

pip install -e .

Configuration

Create a .env file in the project root:

API_KEY=your_api_key
MEMORY_NAME=your_memory_name

.env is already listed in .gitignore and should not be committed.

Python Usage

from ragplug import RagPlug

client = RagPlug(api_key="YOUR_API_KEY", default_memory_name="main")

item = client.add(
    {
        "text": "Paris is the capital of France",
        "source": "docs",
    }
)

response = client.search("capital of France", field_name="text", top_k=3)
schema = client.schema()
client.delete(item.id)

Async usage:

import asyncio
from ragplug import RagPlug


async def main() -> None:
    client = RagPlug(api_key="YOUR_API_KEY", default_memory_name="main")
    item = await client.aadd({"text": "Async memory text"})
    response = await client.asearch("Async memory", field_name="text", top_k=3)
    await client.adelete(item.id)
    print(response.results)


asyncio.run(main())

Examples

The repository includes runnable examples:

  • examples/sync_usage.py
  • examples/async_usage.py

Run them with:

set -a; source .env; set +a

poetry run python examples/sync_usage.py
poetry run python examples/async_usage.py

CLI Scripts

  • scripts/add_memory.py
  • scripts/search.py

Example:

set -a; source .env; set +a

poetry run python scripts/add_memory.py \
  --api-key "$API_KEY" \
  --memory-name "$MEMORY_NAME" \
  --document '{"text":"Smoke test memory","source":"scripts"}'

poetry run python scripts/search.py \
  --api-key "$API_KEY" \
  --memory-name "$MEMORY_NAME" \
  --query "Smoke test" \
  --field-name "text" \
  --mode "naive" \
  --top-k 5

Development Commands

poetry check
poetry build
poetry run python -m compileall ragplug scripts examples

If you use Taskfile:

task all

Release

CI publishes to PyPI for tags matching v*. The tag must match the package version in pyproject.toml.

Example:

poetry version patch
git tag v$(poetry version -s)
git push origin --tags

Project Structure

  • ragplug/client.py: public RagPlug facade.
  • ragplug/types.py: response models and RagPlugError.
  • ragplug/_api.py, _transport.py, _error_handler.py, _validation.py, _response_parser.py: internal client layers.
  • examples/: sync/async usage examples.
  • scripts/: CLI utilities.

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

rag_plug-0.2.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

rag_plug-0.2.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file rag_plug-0.2.1.tar.gz.

File metadata

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

File hashes

Hashes for rag_plug-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0ac0fa56e9f0dbd77019cff06c508e43051d33224cbbeb6c51bcd3ac3dabcc90
MD5 32165abfd483979e8ee42ea739c9fcca
BLAKE2b-256 24c1f1caf762cc55bae1cf3ebe95593511370fc0eb1dae9aef79f25d5742e43c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_plug-0.2.1.tar.gz:

Publisher: release.yml on DormintLab/rag-plug

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

File details

Details for the file rag_plug-0.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for rag_plug-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 076b388dbed466a95d513cc93999f600d67a2ddd483013961b44e63377d76786
MD5 33faa64ff25d80196d7417b154dbf01b
BLAKE2b-256 3c5ae66e69b202520c00ea93685001442cc4d3c9a213e97730afddf92bd3d955

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_plug-0.2.1-py3-none-any.whl:

Publisher: release.yml on DormintLab/rag-plug

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