Skip to main content

Module model_gateway_bedrock

Module model_gateway_bedrock 

Source
Expand description

The gateway’s parts that are Bedrock’s own (docs/specs/SPEC_BEDROCK_MODEL_ROUTE_2026_12_01.md): the answers the gateway gives itself, Bedrock’s refusals as one sentence each, and the way to a model that does not speak Messages (Amazon Ergo): its request is translated to Chat Completions, sent with the bearer key, and its answer translated back, so the harness, the usage meter and the caps see Messages throughout. model_gateway_handlers.rs calls in from the one place a request is forwarded.

Structs§

Failed 🔒
What Bedrock answered with when it did not serve the request.
Translated 🔒
The upstream’s bytes, translated from Chat Completions events to Messages events as they pass. At the end of the upstream it says what the translator has left: the close of the message, or the error that the answer was cut off.

Functions§

answer_here 🔒
The answer to one of answered_here: no key is read and nothing leaves the machine.
answered_here 🔒
The harness calls the gateway answers itself on this route: Bedrock’s Messages path has no count call and no models list.
failed 🔒
forward 🔒
A request to a model that speaks Chat Completions, for the harness that speaks Messages.
message_of 🔒
What a Chat Completions error says, for the harness: the message in its error object, or the first of its words.
named 🔒
The one sentence for a refusal bedrock::refusal names, in the shape the harness shows; a 429 keeps its retry hint, so the harness backs off. None for any other: its words are the caller’s to pass on.
named_error 🔒
Bedrock’s answer when it served the request; when it did not, the sentence for a refusal that is named, and else Bedrock’s own words in the status it gave.
served 🔒
The request with its model made one the route serves, and that model: the one the request names when the route serves it, else the agent’s own. The wire and the price both follow it.
streamed 🔒
The answer as a Messages stream, made as the upstream’s arrives.
whole 🔒
The answer as one Messages body, for a caller that did not ask for a stream.