pydo.inference package

Subpackages

Module contents

Inference-focused entry point: from pydo.inference import Client.

This namespace gives serverless-inference and agent-inference callers a purpose-built Client that mirrors the conventions used by other LLM SDKs (Client(token=...) / Client(api_key=...)) while staying fully integrated with pydo — the same authentication, transport pipeline, retry, logging and response wrappers are reused under the hood.

The list of top-level namespaces exposed on this client (chat, models, embeddings, images, responses, batches, audio, speech, files, agent …) is derived from the OpenAPI spec at code-generation time, so any inference endpoint added to the spec in the future surfaces here automatically — no manual edits to this module are required.

Example:

import os
from pydo.inference import Client

client = Client(token=os.environ["DIGITALOCEAN_TOKEN"])

resp = client.chat.completions.create(
    model="llama3.3-70b-instruct",
    messages=[{"role": "user", "content": "Hello!"}],
)
class pydo.inference.Client(token: Optional[str] = None, *, api_key: Optional[str] = None, timeout: int = 120, inference_endpoint: str = 'https://inference.do-ai.run', agent_endpoint: str = '', **kwargs)

Bases: Client

Inference-focused DigitalOcean Python client.

A drop-in entry point under pydo.inference for callers whose workload is serverless inference (chat completions, embeddings, image / audio generation, batch inference, agent inference, …).

Inherits the full pydo.Client machinery — authentication, transport pipeline, multi-base-URL routing and SSE streaming — so every inference surface that works on pydo.Client also works here. The top-level attribute surface, however, is narrowed to the inference and agent-inference namespaces so editor autocomplete (and dir(client)) stay focused on inference primitives.

class pydo.inference.TokenCredentials(token: str)

Bases: object

Credential object used for token authentication

get_token(*args, **kwargs) AccessToken