Skip to main content

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:

  • PrivateRAGClient
  • ClientConfig
  • RetrievalOptions
  • RetrievalResult
  • RetrievedChunk
  • SearchHit
  • PreparedRetrievalQuery
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

privaterag-0.1.0.tar.gz (103.0 kB view details)

Uploaded Source

Built Distributions

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

privaterag-0.1.0-cp310-abi3-win_amd64.whl (395.5 kB view details)

Uploaded CPython 3.10+Windows x86-64

privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (558.8 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (543.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (498.9 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (503.6 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

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

Hashes for privaterag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3b1f481811748151d659ada713690348df0c847c1f9deebfaf199c196449e9b2
MD5 90a6421644d0202cd0b572eae823b218
BLAKE2b-256 43b35f7a5bd5b6cd1d32500607fb6672e1ce2e02ef212b290e080ecf4dd0b3ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for privaterag-0.1.0.tar.gz:

Publisher: release.yml on erdkocak/PrivateRAG

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

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

Hashes for privaterag-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 08582b921b737e6856dc6683f658cb76fa04589a11391ccaec33f489f47bbd92
MD5 91e2658f5df89b21e9035356a60696f5
BLAKE2b-256 069c56d4c867912337370d1101f308e22641ea48ba4da7576d6e9caaf6ae3a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for privaterag-0.1.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on erdkocak/PrivateRAG

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

File details

Details for the file privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for privaterag-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dfc8213d3802db15a662a288c0dfc5ce3284e7d35c03bac3bb7e4203c5f6aa73
MD5 ddf13d62d1cf77424cf6431f96848fc9
BLAKE2b-256 df5b8e32abca219e2c6ee3fc06f56e594b220450834b2ed15ec562349d47e550

See more details on using hashes here.

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

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

File details

Details for the file privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for privaterag-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1b9c0b28ca8e68b9835663092b89e3e2f30ebab3128dedbfd4dd5bd42a029249
MD5 b21a71e8bc29a82795395973c7c3e715
BLAKE2b-256 3de0f0755fa906e9497b12f15d8da9f537e583ad3a828b2341cde266a85e1752

See more details on using hashes here.

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

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

File details

Details for the file privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for privaterag-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 097c36ef671557c84a02336cccf152355a403a4b4dd3bfd2493287169bff27cb
MD5 f7b558c24981df3df24b1bab7e1cbe71
BLAKE2b-256 a9bd754f22fe10dd19d6cb66a18db6ff9e589b74747f37d2d98ed153b6774130

See more details on using hashes here.

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

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

File details

Details for the file privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for privaterag-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ad08a1e63886db0fd9aa97e690b1bf4917989326cc4026c0fce1b09e078bcd85
MD5 41569ebae5f35269c7624e43415c04b6
BLAKE2b-256 2f334f56005df6bdc4a6b04dc9b7e53e88dc53200da20face8c738a66d8afbba

See more details on using hashes here.

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

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