pllm.client Python API
Public objects, practical usage, and research context for pllm.client.
Client facades expose synchronous and asynchronous private-inference clients plus bounded response streams without requiring callers to import runtime internals. Presence documents API availability, not complete model, security, or deployment coverage; check implementation status before relying on a path.
Research context
This API is project infrastructure rather than an implementation of one specific paper. Relevant method pages link their primary sources separately.
Python SDK example
The example performs a bounded offline task and checks an observable result. It does not download a checkpoint or contact a provider.
import pllm.client as client
closed = []
stream = client.ResponseStream(iter(["first", "second"]), lambda: closed.append(True))
assert list(stream) == ["first", "second"]
stream.close()
assert closed == [True]API: pllm.client
Objects and signatures
AsyncOpenAI
Asynchronous OpenAI-compatible client that targets the trusted local PLLM gateway.
- Canonical object:
pllm.runtime.client.AsyncOpenAI - Kind:
class - Signature/type:
(**kwargs: 'Any') -> 'None' - Public exports:
pllm.AsyncOpenAI,pllm.client.AsyncOpenAI,pllm.runtime.AsyncOpenAI - Public members:
close(self) -> 'None';prepared_rows_for_response(self, input: 'str', max_output_tokens: 'int', *, model: 'str \| None' = None, instructions: 'str \| None' = None) -> 'int';preprocess(self, model: 'str \| None' = None, *, count: 'int \| None' = None, stages: 'list[str] \| None' = None) -> 'dict[str, Any]';property privacy_audit: 'PrivacyAudit'
OpenAI
Synchronous OpenAI-compatible client that targets the trusted local PLLM gateway.
- Canonical object:
pllm.runtime.client.OpenAI - Kind:
class - Signature/type:
(*, api_key: 'str \| None' = None, base_url: 'str \| None' = None, default_model: 'str \| None' = None, model: 'str \| None' = None, session_transport: 'str \| None' = None, correlation_mode: 'str \| None' = None, preparation_base_url: 'str \| None' = None, preparation_api_key: 'str \| None' = None, correlation_prefetch: 'int \| None' = None, prepared_inventory_rows: 'int \| None' = None, background_inventory_refill: 'bool' = True, token_cache_size: 'int \| None' = None, bundle_cache_mode: 'str \| None' = None, bundle_cache_dir: 'str \| Path \| None' = None, tenseal_path: 'str \| None' = None, timeout: 'float \| None' = None, http_client: 'httpx.Client \| None' = None, preparation_http_client: 'httpx.Client \| None' = None, experiment: 'Experiment \| ExperimentProfile \| None' = None) -> 'None' - Public exports:
pllm.OpenAI,pllm.client.OpenAI,pllm.runtime.OpenAI - Public members:
close(self) -> 'None';prepared_inventory_status(self, model: 'str \| None' = None) -> 'dict[str, Any]';prepared_rows_for_response(self, input: 'str', max_output_tokens: 'int', *, model: 'str \| None' = None, instructions: 'str \| None' = None) -> 'int';preprocess(self, model: 'str \| None' = None, *, count: 'int \| None' = None, stages: 'list[str] \| None' = None) -> 'dict[str, Any]';property privacy_audit: 'PrivacyAudit'
ResponseStream
Abstract base class for generic types.
- Canonical object:
pllm.runtime.client.ResponseStream - Kind:
class - Signature/type:
(iterator: 'Iterator[T]', close: 'Callable[[], None] \| None' = None) -> 'None' - Public exports:
pllm.ResponseStream,pllm.client.ResponseStream - Public members:
close(self) -> 'None'