Skip to main content

RAG client

Project description

rag-plug

Python client for the RAGPlug backend API. It supports adding memory items, semantic search, 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(
    "Paris is the capital of France",
    metadata={"source": "docs"},
)

response = client.search("capital of France", top_k=3)
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("Async memory text")
    response = await client.asearch("Async memory", 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" \
  --text "Smoke test memory" \
  --metadata '{"source":"scripts"}'

poetry run python scripts/search.py \
  --api-key "$API_KEY" \
  --memory-name "$MEMORY_NAME" \
  --query "Smoke test" \
  --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.1.1.tar.gz (4.4 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.1.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rag_plug-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 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.1.1.tar.gz
Algorithm Hash digest
SHA256 7edc24f326d5036555bd479ec31ed07230ed8b06723e425f308b827b0d436f0a
MD5 f5ce590a8fb15e5942499dbfafa02baa
BLAKE2b-256 a91bae4711b899b98344a278418d02e1ed82b0f8c094980d7c1c0ad398454770

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_plug-0.1.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.1.1-py3-none-any.whl.

File metadata

  • Download URL: rag_plug-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 902a871769cf2933fda3b38ddadd3576ba9e44e09045ce0ad3d99601685bb821
MD5 9545b007d3c9830f4ba4aa2a03b0214b
BLAKE2b-256 c34eb19f29f56dd02b95263eae6c1d110455235246a5856f120d23ccd1ad4c93

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_plug-0.1.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