http

Compatibility helpers for the httpx and httpx2 HTTP client families.

Service SDKs are migrating from httpx to httpx2, and each installs only the family it uses: openai < 3 brings httpx, openai >= 3 brings httpx2. Pipecat supports both, so the objects it hands to an SDK client — and the exceptions it catches from one — can’t name a single family at import time.

pipecat.utils.http.AsyncHTTPClient

Type of a caller-supplied async HTTP client. The class belongs to whichever family the caller’s SDK uses, so there is no single type to name here.

pipecat.utils.http.TIMEOUT_EXCEPTIONS: tuple[type[Exception], ...] = (<class 'httpx.TimeoutException'>, <class 'httpx2.TimeoutException'>)

Timeout exception types to catch around SDK calls. SDKs wrap request-level timeouts in their own error type, but a timeout while iterating a response stream surfaces as the underlying transport exception, which belongs to whichever family the SDK is built on.

pipecat.utils.http.connection_limits(**kwargs: Any) → Any[source]

Build a connection-limits object accepted by either client family.

Parameters:

**kwargs – Limits fields (max_connections, max_keepalive_connections, keepalive_expiry).

Returns:

A Limits instance from the installed HTTP client family.