Skip to main content

Python client for Paddler LLM load balancer

Project description

paddler-client

Python client for the Paddler LLM load balancer.

Install

pip install paddler-client

Requires Python 3.11+. Built on httpx, websockets, and pydantic v2.

Quick start

WebSocket inference (multiplexed, request-id-keyed)

import asyncio

from paddler_client import ClientInference
from paddler_client.continue_from_conversation_history_params import (
    ContinueFromConversationHistoryParams,
)
from paddler_client.conversation_message import ConversationMessage


async def main() -> None:
    params = ContinueFromConversationHistoryParams(
        add_generation_prompt=True,
        conversation_history=[
            ConversationMessage(content="Say hello.", role="user"),
        ],
        enable_thinking=False,
        max_tokens=128,
    )

    async with ClientInference(url="http://localhost:8061") as client:
        stream = await client.continue_from_conversation_history(params)

        async for message in stream:
            if message.is_token:
                print(message.token, end="", flush=True)
            elif message.is_terminal:
                break


asyncio.run(main())

HTTP NDJSON streaming

async with ClientInference(url="http://localhost:8061") as client:
    async for message in client.post_continue_from_conversation_history(params):
        if message.is_token:
            print(message.token, end="", flush=True)
        elif message.is_terminal:
            break

ClientInference also provides continue_from_raw_prompt and generate_embedding_batch.

Management

from paddler_client import ClientManagement


async with ClientManagement(url="http://localhost:8062") as client:
    snapshot = await client.get_agents()

    for agent in snapshot.agents:
        print(agent.id, agent.slots_total)

    state = await client.get_balancer_desired_state()
    await client.put_balancer_desired_state(state)

    metrics = await client.get_metrics()

ClientManagement also provides agents_stream, get_buffered_requests, buffered_requests_stream, get_chat_template_override, and get_model_metadata.

Coverage

  • Transport: WebSocket (multiplexed), HTTP NDJSON, HTTP JSON, Server-Sent Events
  • Models: every Paddler wire-format type (validated via pydantic)
  • Fully typed (py.typed), async-first API
  • Specialized error types per failure mode

License

Apache-2.0

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

paddler_client-4.0.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

paddler_client-4.0.0-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file paddler_client-4.0.0.tar.gz.

File metadata

  • Download URL: paddler_client-4.0.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for paddler_client-4.0.0.tar.gz
Algorithm Hash digest
SHA256 9aeb6001ce3adb4ea3a8dd94c29ac7cbb6ff22c93fac7870ee41daaf4f9e728d
MD5 25fe65916dd2114db254c433df88044c
BLAKE2b-256 f770c0ea8ee26fc87022a4e7d2db4c8e1c75501ce219269f3dbc14d719afc2f0

See more details on using hashes here.

File details

Details for the file paddler_client-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: paddler_client-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for paddler_client-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c7e721f624f96a17315e77a9ab7d4942d1d19dc5f13df3339f34f1f46ae91c
MD5 5b27171bf3ff482db69754ea285a065a
BLAKE2b-256 3e398bbc536b3ed53f165c76f5c6e31e4c123eae1f91413904d5bb64690da736

See more details on using hashes here.

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