Skip to main content

Python client for the Herd daemon

Project description

Herd Python Client

This is the official Python client for the Herd daemon. It provides both synchronous and asynchronous interfaces for acquiring and managing worker sessions.

Installation

pip install herd-client

Quick Start (Async)

import asyncio
import httpx
from herd import AsyncClient

async def main():
    client = AsyncClient("unix:///tmp/herd.sock")
    
    async with client.acquire(worker_type="python-inference") as session:
        print(f"Acquired worker: {session.id}")
        
        async with httpx.AsyncClient() as http:
            resp = await http.post(
                f"{session.proxy_url}/generate",
                headers={"X-Session-ID": session.id},
                json={"prompt": "Hello world"}
            )
            print(resp.json())

if __name__ == "__main__":
    asyncio.run(main())

Quick Start (Sync)

import requests
from herd import Client

client = Client("unix:///tmp/herd.sock")

with client.acquire(worker_type="python-inference") as session:
    print(f"Acquired worker: {session.id}")
    
    resp = requests.post(
        f"{session.proxy_url}/generate",
        headers={"X-Session-ID": session.id},
        json={"prompt": "Hello world"}
    )
    print(resp.json())

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

herd_client-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

herd_client-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file herd_client-0.1.0.tar.gz.

File metadata

  • Download URL: herd_client-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for herd_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de0d91b0534168e6a72d189a0d1db4174bad7936f9a673b8dd74cc03b8b702a2
MD5 70101a27315179020539ba15e2b1c5a2
BLAKE2b-256 2bf548ee640456007f94a75abd6d16fcfe3b85735f7df75bee110771419959ed

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on herd-core/herd-python-client

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

File details

Details for the file herd_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: herd_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for herd_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b0de62999985547380b824606c096a5f084454fb7e4487d5d4302b057d1dc8e
MD5 4268f5d362abc68e4f0940122f8840fe
BLAKE2b-256 91272248dd6ac0d14e3e72b7371e959c49ab7453a2f9f996545212432b70b790

See more details on using hashes here.

Provenance

The following attestation bundles were made for herd_client-0.1.0-py3-none-any.whl:

Publisher: publish.yml on herd-core/herd-python-client

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