pub struct ProxyContext {
pub start_time: Instant,
pub model: Option<String>,
pub stream_state: Option<StreamState>,
pub route: RouteInfo,
pub flags: ConversionFlags,
pub buffers: ConversionBuffers,
pub diagnostics: UpstreamDiagnostics,
pub follow_up: FollowUpContext,
}Expand description
Proxy context attached to each request session.
Fields§
§start_time: InstantRequest start time for duration tracking.
model: Option<String>Model name parsed from request.
stream_state: Option<StreamState>Stream state for SSE conversion (also used as a carrier for
ResponseRequestContext in non-streaming conversions; this dual use is
scheduled to be decoupled in a follow-up commit).
route: RouteInfo§flags: ConversionFlags§buffers: ConversionBuffers§diagnostics: UpstreamDiagnostics§follow_up: FollowUpContextImplementations§
Source§impl ProxyContext
impl ProxyContext
Sourcepub fn init_from_response_request(&mut self, req: &ResponseRequest)
pub fn init_from_response_request(&mut self, req: &ResponseRequest)
Populate model + streaming flags from a parsed ResponseRequest.
Conversion path: callers already deserialize the body as ResponseRequest
to perform the conversion, so we accept the parsed struct directly to
avoid re-parsing the JSON.
Sourcepub fn init_from_passthrough_json(&mut self, json: &Value)
pub fn init_from_passthrough_json(&mut self, json: &Value)
Pass-through path: extract just model + stream from a serde_json::Value.
Used when the body is not a Responses API request (e.g., direct Chat Completions pass-through), so a full typed parse would be wrong.
Sourcepub fn set_response_request_context(&mut self, context: ResponseRequestContext)
pub fn set_response_request_context(&mut self, context: ResponseRequestContext)
Set the response request context from a parsed ResponseRequest. This should be called during request_body_filter processing.