pub struct EncodedRequest {
pub method: Method,
pub path: String,
pub headers: HeaderMap,
pub body: Bytes,
pub streaming: bool,
pub warnings: Vec<ModelWarning>,
}Expand description
Bytes the transport will send to the provider plus the metadata the codec learned during encoding.
path is the URL path the transport appends to its base URL (e.g.
/v1/messages for Anthropic). headers carries codec-required fields
like content-type and anthropic-version; transports add credentials
at send time.
Fields§
§method: MethodHTTP method. POST for every Phase-1 codec; pre-set as a forward hint.
path: StringURL path appended to the transport’s base URL.
headers: HeaderMapVendor-required HTTP headers (NOT credentials — transport adds those).
body: BytesJSON body bytes.
streaming: booltrue if this request was produced by encode_streaming and the
transport should stream the response body (e.g. open an SSE
connection). Transports treat unset / false as a regular
request/response.
warnings: Vec<ModelWarning>Non-fatal warnings the codec produced during encoding. Carried into
ModelResponse::warnings after the call returns.
Implementations§
Source§impl EncodedRequest
impl EncodedRequest
Sourcepub fn post_json(path: impl Into<String>, body: Bytes) -> Self
pub fn post_json(path: impl Into<String>, body: Bytes) -> Self
Build a POST request with the given path and JSON body.
Sourcepub const fn into_streaming(self) -> Self
pub const fn into_streaming(self) -> Self
Mark this request as streaming-shaped. Codecs call this from
encode_streaming after appending any vendor-specific headers
(e.g. Accept: text/event-stream).
Trait Implementations§
Source§impl Clone for EncodedRequest
impl Clone for EncodedRequest
Source§fn clone(&self) -> EncodedRequest
fn clone(&self) -> EncodedRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more