pub struct NormalizeOptions {
pub protocol: Protocol,
pub developer_to_system: bool,
pub custom_to_user: bool,
pub orphan_tool_result: OrphanToolResultPolicy,
pub missing_tool_result: MissingToolResultPolicy,
pub merge_adjacent_same_role: bool,
pub system_placement: SystemPlacement,
pub preserve_foreign_reasoning: bool,
}Expand description
Rules used by the normalization layer.
Fields§
§protocol: ProtocolThe provider protocol that will receive the normalized request.
developer_to_system: boolDeveloper is not understood by every provider, so downgrade it to
System by default.
custom_to_user: boolUnknown/custom roles are downgraded to User by default.
orphan_tool_result: OrphanToolResultPolicyPolicy for tool results that reference no pending assistant tool
call. See OrphanToolResultPolicy for the available choices.
missing_tool_result: MissingToolResultPolicyPolicy for assistant tool calls that never received a tool result.
See MissingToolResultPolicy for the available choices.
merge_adjacent_same_role: boolAnthropic and Gemini require user/model turns to alternate. OpenAI does not require this, so its adapter keeps the original message boundaries.
system_placement: SystemPlacementHow system/developer messages are placed; see SystemPlacement.
preserve_foreign_reasoning: boolKeep reasoning state produced by a different provider protocol.
This is disabled by default because signatures and encrypted reasoning tokens are provider-specific and cannot be safely translated.
Implementations§
Source§impl NormalizeOptions
impl NormalizeOptions
Sourcepub fn for_protocol(protocol: Protocol) -> Self
pub fn for_protocol(protocol: Protocol) -> Self
Build options with sensible defaults for protocol.
Role downgrades, orphan-result dropping, and missing-result synthesis are enabled; strict same-role merging is enabled only for protocols that require alternating turns (Anthropic and Gemini).
Trait Implementations§
Source§impl Clone for NormalizeOptions
impl Clone for NormalizeOptions
Source§impl Debug for NormalizeOptions
impl Debug for NormalizeOptions
impl Eq for NormalizeOptions
Source§impl PartialEq for NormalizeOptions
impl PartialEq for NormalizeOptions
impl StructuralPartialEq for NormalizeOptions
Auto Trait Implementations§
impl Freeze for NormalizeOptions
impl RefUnwindSafe for NormalizeOptions
impl Send for NormalizeOptions
impl Sync for NormalizeOptions
impl Unpin for NormalizeOptions
impl UnsafeUnpin for NormalizeOptions
impl UnwindSafe for NormalizeOptions
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.