pub struct CanonicalRequest {Show 20 fields
pub model: String,
pub system: Option<String>,
pub messages: Vec<CanonicalMessage>,
pub max_tokens: u32,
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<i32>,
pub stop_sequences: Vec<String>,
pub tools: Vec<CanonicalTool>,
pub tool_choice: Option<CanonicalToolChoice>,
pub stream: bool,
pub thinking: Option<ThinkingConfig>,
pub metadata: Option<Value>,
pub response_format: Option<ResponseFormat>,
pub reasoning_effort: Option<ReasoningEffort>,
pub search: Option<SearchConfig>,
pub code_execution: bool,
pub presence_penalty: Option<f32>,
pub frequency_penalty: Option<f32>,
pub forwarded_surface: ForwardedSurface,
}Fields§
§model: String§system: Option<String>§messages: Vec<CanonicalMessage>§max_tokens: u32§temperature: Option<f32>§top_p: Option<f32>§top_k: Option<i32>§stop_sequences: Vec<String>§tools: Vec<CanonicalTool>§tool_choice: Option<CanonicalToolChoice>§stream: bool§thinking: Option<ThinkingConfig>§metadata: Option<Value>§response_format: Option<ResponseFormat>§reasoning_effort: Option<ReasoningEffort>§search: Option<SearchConfig>§code_execution: bool§presence_penalty: Option<f32>§frequency_penalty: Option<f32>§forwarded_surface: ForwardedSurfaceEvery string in the bytes the gateway is about to forward upstream.
The canonical form is lossy, so content the gateway relays can be invisible to a scanner reading only that form. The gateway fills this from the prepared outbound body before any scan runs, which is what makes the scan surface a superset of the forwarded surface. Callers that never send through the gateway leave it empty.
Implementations§
Source§impl CanonicalRequest
impl CanonicalRequest
Sourcepub fn flatten_text(&self) -> String
pub fn flatten_text(&self) -> String
The broadest inspection surface a scanner can ask for, and the one a blocking scanner should use: it covers content the canonical model cannot represent but the provider will still receive.
pub fn derived_gateway_conversation_id(&self) -> Option<GatewayConversationId>
pub fn flatten_message_text(&self, role: Role) -> Option<String>
Sourcepub fn latest_message_text(&self, role: Role) -> Option<String>
pub fn latest_message_text(&self, role: Role) -> Option<String>
Flattens the newest message of role, ignoring every earlier one.
Distinct from Self::flatten_message_text, which concatenates every
message of the role: a safety scanner that judges the latter re-reads
what the caller already sent on previous turns.
Sourcepub fn message_units(&self) -> Vec<String>
pub fn message_units(&self) -> Vec<String>
Detectors that slide a window over their input need this rather than
Self::flatten_text, whose concatenation lets two unrelated messages
splice into a match neither one contains. Each surface leaf is its own
unit for the same reason.
Trait Implementations§
Source§impl Clone for CanonicalRequest
impl Clone for CanonicalRequest
Source§fn clone(&self) -> CanonicalRequest
fn clone(&self) -> CanonicalRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CanonicalRequest
impl Debug for CanonicalRequest
Source§impl Default for CanonicalRequest
impl Default for CanonicalRequest
Source§fn default() -> CanonicalRequest
fn default() -> CanonicalRequest
Auto Trait Implementations§
impl Freeze for CanonicalRequest
impl RefUnwindSafe for CanonicalRequest
impl Send for CanonicalRequest
impl Sync for CanonicalRequest
impl Unpin for CanonicalRequest
impl UnsafeUnpin for CanonicalRequest
impl UnwindSafe for CanonicalRequest
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more