Zero-dependency Python client for the Praixis Engine API
Project description
Praixis Engine — Python Client
A lightweight Python client for the Praixis Engine API, in both sync and async flavors.
PraixisClient— synchronous, zero dependencies, built entirely on the standard library (urllib,json,uuid), so an upstream package release can never break it.AsyncPraixisClient— async/await, built onhttpx(the only optional dependency). Imported lazily, so the sync client stays dependency-free.- Same surface in both: resource-grouped
client.chatandclient.rag— chat- file summary, and RAG ingest/ask/embed/compare.
The companion Node.js client lives in its own repository.
Installation
pip install praixis # sync client only, zero dependencies
pip install "praixis[async]" # also installs httpx for the async client
Or vendor the praixis/ package directly into your project — the sync client
has no deps.
Requires Python 3.10+.
Authentication
Every endpoint uses an app-level API key sent as the X-API-Key header.
from praixis import PraixisClient
client = PraixisClient("http://localhost:8080", "your-api-key")
Admin/system routes (
/api/system/*, HTTP Basic auth) are intentionally not part of this SDK. They already have a browser UI, and baking admin credentials into application code would be a security anti-pattern. TheX-API-Keythis SDK uses is an app-level credential, not an admin one.
Chat
# Start a conversation
reply = client.chat.send("Hello, world!")
print(reply["session_id"], reply["response"])
# Continue it
client.chat.send("And again?", session_id=reply["session_id"])
# JSON-mode response, custom system prompt
client.chat.send("List 3 colors", response_format="json", system_prompt="Be terse")
# Sessions
client.chat.list_sessions() # -> [session_id, ...]
client.chat.get_history(session_id) # -> {"session_id", "history": [...]}
client.chat.clear_history(session_id)
# Summarize an uploaded file (path, or (filename, content[, content_type]))
client.chat.summarize_file("report.pdf")
client.chat.summarize_file(("notes.txt", "raw text here"))
Note on streaming: the server streams chat and RAG answers as
text/event-stream, not JSON. This client buffers the full response and parses the leading marker lines ([SESSION_ID:...], and for RAG[SEARCH_QUERY:...]/[SOURCES:...]) out of the body for you, sochat.sendreturns{"session_id", "response", "response_format"}andrag.askreturns{"answer", "sources", "session_id", "search_query"}. Buffering is the right default for scripts and backends; token-by-token iteration is not yet exposed.
RAG
# Ingest one or many documents into a collection
client.rag.upload("manual.pdf", collection_name="docs")
client.rag.upload([("a.txt", "..."), ("b.txt", "...")], collection_name="docs")
# Ask a question grounded in a collection
ans = client.rag.ask("What does the manual say about setup?", collection_name="docs")
print(ans)
# Embeddings, listing, deletion, compare, summarize
client.rag.embed("some text")
client.rag.list_collections()
client.rag.list_files("docs")
client.rag.delete_file("docs", "a.txt")
client.rag.delete_collection("docs")
client.rag.compare("docs", "a.txt", "b.txt")
client.rag.summarize_document("docs", "manual.pdf")
Error handling
from praixis import (
APIError, AuthenticationError, NotFoundError,
RateLimitError, APIConnectionError,
)
try:
client.chat.send("hi")
except AuthenticationError:
... # 401 / 403
except NotFoundError:
... # 404
except RateLimitError:
... # 429 (per-route limits)
except APIError as e:
print(e.status_code, e.detail)
except APIConnectionError:
... # never reached the server
All exceptions inherit from praixis.PraixisError.
Testing
Both suites run against a standard-library mock HTTP server — no network needed.
# Sync client — zero dependencies
uv run --no-project python tests/test_client.py
# Async client — needs httpx
uv run --with httpx python tests/test_async_client.py
The async suite also asserts that the sync and async resources expose an identical set of methods, so the two clients can't silently drift apart.
Privacy note
This client transmits whatever you pass to it (prompts, documents, session IDs) to the configured Praixis Engine server. Those payloads may contain personal data — handle them according to your own privacy obligations. The client stores nothing locally and adds no telemetry.
License
MIT — see LICENSE.
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 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 praixis-0.1.0.tar.gz.
File metadata
- Download URL: praixis-0.1.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3968e31158c46c2e79850d08e80c4981757fac10d7654992b13dbf841f386cfd
|
|
| MD5 |
45539c594ea629e15a996dc6e97087c5
|
|
| BLAKE2b-256 |
2546cf0847b8d31e58adabc77a849baf18732a215c403ce634baa0e9b350da1b
|
File details
Details for the file praixis-0.1.0-py3-none-any.whl.
File metadata
- Download URL: praixis-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dbeadab7883171888d1d8fb7670ae4a9bad1c6679b56c84365c8d633fe3c899
|
|
| MD5 |
d4eb347082a94bcb9ed1ecdcacb96d26
|
|
| BLAKE2b-256 |
d74db11b1187741f7d9a7d09f6681c43eab9aca2cca341bdf71ad6ff995f67f0
|