Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Runtime-keyed transform dispatcher.

The typed transforms in crate::transform::{claude,gemini,openai}::* are statically dispatched via TryFrom bounds. This module exposes the same conversions as a dynamic API keyed on (OperationFamily, ProtocolKind) pairs, which is what an LLM gateway needs at request time when the source and destination protocols are only known at runtime.

Moved here from gproxy-provider::transform_dispatch in the SDK layer refactor (spec: docs/superpowers/specs/2026-04-13-sdk-layer-refactor-design.md).

Structs§

StreamResponseTransformer

Functions§

convert_error_body_or_raw
Convert an upstream error body (non-2xx response body) from the upstream protocol’s error schema to the client’s expected error schema, falling back to the raw bytes on any failure.
create_stream_response_transformer
nonstream_to_stream
Convert a non-streaming response to stream events (same protocol). Output is NDJSON (one JSON line per event) written into out.
stream_to_nonstream
Convert stream events (NDJSON lines) to a non-streaming response (same protocol).
transform_request
Transform a request body from one (operation, protocol) to another.
transform_response
Transform a response body from upstream protocol back to client protocol.

Type Aliases§

StreamChunkNormalizer