Pixir.Provider.TransportPolicy (pixir v0.1.0)

Copy Markdown View Source

Runtime Provider transport policy.

:auto prefers a per-key WebSocket connection and falls back to HTTP/SSE for transport failures. The fallback reuses the same HTTP request body, so safe prompt_cache_key metadata survives across transports. previous_response_id lives only inside the WebSocket connection process and is discarded on fallback.

Summary

Types

policy()

@type policy() :: :auto | :websocket | :http_sse

Functions

stream(http_request, acc, fun, opts \\ [])

@spec stream(map(), acc, (term(), acc -> acc), keyword()) ::
  {:ok, acc} | {:error, term()} | {:error, term(), acc}
when acc: term()