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
RagPlugclient 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.pyexamples/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.pyscripts/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: publicRagPlugfacade.ragplug/types.py: response models andRagPlugError.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7edc24f326d5036555bd479ec31ed07230ed8b06723e425f308b827b0d436f0a
|
|
| MD5 |
f5ce590a8fb15e5942499dbfafa02baa
|
|
| BLAKE2b-256 |
a91bae4711b899b98344a278418d02e1ed82b0f8c094980d7c1c0ad398454770
|
Provenance
The following attestation bundles were made for rag_plug-0.1.1.tar.gz:
Publisher:
release.yml on DormintLab/rag-plug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rag_plug-0.1.1.tar.gz -
Subject digest:
7edc24f326d5036555bd479ec31ed07230ed8b06723e425f308b827b0d436f0a - Sigstore transparency entry: 1016959988
- Sigstore integration time:
-
Permalink:
DormintLab/rag-plug@eedaf101f8ecbc787a7129bdcf2dad798467454a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DormintLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eedaf101f8ecbc787a7129bdcf2dad798467454a -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
902a871769cf2933fda3b38ddadd3576ba9e44e09045ce0ad3d99601685bb821
|
|
| MD5 |
9545b007d3c9830f4ba4aa2a03b0214b
|
|
| BLAKE2b-256 |
c34eb19f29f56dd02b95263eae6c1d110455235246a5856f120d23ccd1ad4c93
|
Provenance
The following attestation bundles were made for rag_plug-0.1.1-py3-none-any.whl:
Publisher:
release.yml on DormintLab/rag-plug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rag_plug-0.1.1-py3-none-any.whl -
Subject digest:
902a871769cf2933fda3b38ddadd3576ba9e44e09045ce0ad3d99601685bb821 - Sigstore transparency entry: 1016960023
- Sigstore integration time:
-
Permalink:
DormintLab/rag-plug@eedaf101f8ecbc787a7129bdcf2dad798467454a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DormintLab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@eedaf101f8ecbc787a7129bdcf2dad798467454a -
Trigger Event:
push
-
Statement type: