Skip to main content

Python SDK 0.3.1 — clearer API errors and async retries

Python SDK 0.3.1 makes AsyncValen retry like Valen.remote and turns non-JSON responses, dropped connections and server error bodies into ValenAPIError.

Fixes​

  • AsyncValen retries rate limits, overload and connection failures like Valen.remote, takes max_retries and headers, and raises ValenAPIError with the service's error detail.
  • A non-JSON response, such as a gateway's HTML 502, raises ValenAPIError with its status code, request ID and text.
  • A connection dropped mid-response (ReadError, RemoteProtocolError) is retried like a connection failure and then raises ValenAPIError instead of an httpx exception.
  • A self-hosted server's {"error": {"message": ...}} becomes the error message, and the hosted APIs' x-llm-proxy-request-id fills request_id.

Changes​

  • HTTP clients send User-Agent: valen-sdk-python/<version>.

Install​

Terminal
python -m pip install valen-sdk==0.3.1 # HTTP clients
python -m pip install "valen-sdk[onnx]==0.3.1" # local CPU inference