PrivateRAG Python SDK with Rust-backed local search and PIR retrieval.
Project description
privaterag
Python client SDK facade for PrivateRAG.
The package provides lightweight public API types, public-cache initialization, native Rust retrieval primitives, and end-to-end HTTP PIR retrieval:
PrivateRAGClientClientConfigRetrievalOptionsRetrievalResultRetrievedChunkSearchHitPreparedRetrievalQuery- typed SDK exceptions
PrivateRAGClient.from_manifest(...) downloads and validates the public
client cache from a v0 retrieval server. It requests only manifest.json,
checksums.json, index/*, pir/scheme.json, and pir/client_hint.bin.
Install:
pip install privaterag
Prebuilt wheels include the Rust/PyO3 native extension as
privaterag._native, so normal installs do not need Rust when a wheel is
available for the target platform.
For local workspace development, native operations can be built with PyO3/maturin:
cd python/privaterag
maturin develop
After the native extension is installed, PrivateRAGClient.search_by_embedding(...), PrivateRAGClient.prepare_retrieval_query_by_embedding(...), and PrivateRAGClient.decode_retrieval_response(...) call the Rust public-cache client. PrivateRAGClient.retrieve(...) embeds locally, prepares a padded BatchedPirQuery, posts only that JSON envelope to /pir/query, and decodes the BatchedPirResponse locally.
from privaterag import PrivateRAGClient
client = PrivateRAGClient.from_manifest(
"http://127.0.0.1:8080/manifest.json",
embed_query=embed_query,
)
results = client.retrieve("What is the policy?", top_k=2)
context = results.to_context()
top_k must be positive. Configured or per-call retrieval_count must be
positive and greater than or equal to top_k; otherwise retrieval fails before
the SDK posts a PIR request. For the supported simplepir-rs-v0-1000-1k
profile, the supported v0 shape is exactly top_k=2 and
retrieval_count=4; other shapes fail closed until fresh evidence expands the
profile. See ../../docs/padding_policy.md.
See ../../docs/client_api.md for the client API and privacy boundary.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 privaterag-0.1.0.tar.gz.
File metadata
- Download URL: privaterag-0.1.0.tar.gz
- Upload date:
- Size: 103.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1f481811748151d659ada713690348df0c847c1f9deebfaf199c196449e9b2
|
|
| MD5 |
90a6421644d0202cd0b572eae823b218
|
|
| BLAKE2b-256 |
43b35f7a5bd5b6cd1d32500607fb6672e1ce2e02ef212b290e080ecf4dd0b3ea
|
Provenance
The following attestation bundles were made for privaterag-0.1.0.tar.gz:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0.tar.gz -
Subject digest:
3b1f481811748151d659ada713690348df0c847c1f9deebfaf199c196449e9b2 - Sigstore transparency entry: 1507620462
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privaterag-0.1.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: privaterag-0.1.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 395.5 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08582b921b737e6856dc6683f658cb76fa04589a11391ccaec33f489f47bbd92
|
|
| MD5 |
91e2658f5df89b21e9035356a60696f5
|
|
| BLAKE2b-256 |
069c56d4c867912337370d1101f308e22641ea48ba4da7576d6e9caaf6ae3a6c
|
Provenance
The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-win_amd64.whl:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0-cp310-abi3-win_amd64.whl -
Subject digest:
08582b921b737e6856dc6683f658cb76fa04589a11391ccaec33f489f47bbd92 - Sigstore transparency entry: 1507621347
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 558.8 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfc8213d3802db15a662a288c0dfc5ce3284e7d35c03bac3bb7e4203c5f6aa73
|
|
| MD5 |
ddf13d62d1cf77424cf6431f96848fc9
|
|
| BLAKE2b-256 |
df5b8e32abca219e2c6ee3fc06f56e594b220450834b2ed15ec562349d47e550
|
Provenance
The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
dfc8213d3802db15a662a288c0dfc5ce3284e7d35c03bac3bb7e4203c5f6aa73 - Sigstore transparency entry: 1507620977
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 543.2 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b9c0b28ca8e68b9835663092b89e3e2f30ebab3128dedbfd4dd5bd42a029249
|
|
| MD5 |
b21a71e8bc29a82795395973c7c3e715
|
|
| BLAKE2b-256 |
3de0f0755fa906e9497b12f15d8da9f537e583ad3a828b2341cde266a85e1752
|
Provenance
The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
1b9c0b28ca8e68b9835663092b89e3e2f30ebab3128dedbfd4dd5bd42a029249 - Sigstore transparency entry: 1507620838
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 498.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
097c36ef671557c84a02336cccf152355a403a4b4dd3bfd2493287169bff27cb
|
|
| MD5 |
f7b558c24981df3df24b1bab7e1cbe71
|
|
| BLAKE2b-256 |
a9bd754f22fe10dd19d6cb66a18db6ff9e589b74747f37d2d98ed153b6774130
|
Provenance
The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
097c36ef671557c84a02336cccf152355a403a4b4dd3bfd2493287169bff27cb - Sigstore transparency entry: 1507620651
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 503.6 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad08a1e63886db0fd9aa97e690b1bf4917989326cc4026c0fce1b09e078bcd85
|
|
| MD5 |
41569ebae5f35269c7624e43415c04b6
|
|
| BLAKE2b-256 |
2f334f56005df6bdc4a6b04dc9b7e53e88dc53200da20face8c738a66d8afbba
|
Provenance
The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on erdkocak/PrivateRAG
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
ad08a1e63886db0fd9aa97e690b1bf4917989326cc4026c0fce1b09e078bcd85 - Sigstore transparency entry: 1507621136
- Sigstore integration time:
-
Permalink:
erdkocak/PrivateRAG@f402075868b3dc437be292153f67b2be985a6e68 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/erdkocak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f402075868b3dc437be292153f67b2be985a6e68 -
Trigger Event:
workflow_dispatch
-
Statement type: