pub struct OpenRouterReasoningCodec;Expand description
Default codec: reads OpenRouter’s reasoning_details[] schema on
response, writes the same on the assistant message for replay.
Covers every provider OpenRouter routes to (Anthropic, Google,
OpenAI, xAI, Azure, etc.) because OpenRouter normalizes them all
to this shape.
Implementations§
Trait Implementations§
Source§impl Clone for OpenRouterReasoningCodec
impl Clone for OpenRouterReasoningCodec
Source§fn clone(&self) -> OpenRouterReasoningCodec
fn clone(&self) -> OpenRouterReasoningCodec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenRouterReasoningCodec
impl Debug for OpenRouterReasoningCodec
Source§impl Default for OpenRouterReasoningCodec
impl Default for OpenRouterReasoningCodec
Source§fn default() -> OpenRouterReasoningCodec
fn default() -> OpenRouterReasoningCodec
Returns the “default value” for a type. Read more
Source§impl ReasoningCodec for OpenRouterReasoningCodec
impl ReasoningCodec for OpenRouterReasoningCodec
Source§fn parse_response(&self, raw: &[Value]) -> Vec<ReasoningItem>
fn parse_response(&self, raw: &[Value]) -> Vec<ReasoningItem>
Lift OpenRouter-shaped
reasoning_details[] (or the native
equivalent) into typed items. Values whose type discriminator
matches no known variant are dropped from the typed view; the
raw Value array is still kept on the assistant message so
round-trip fidelity is preserved on replay.Source§fn write_assistant(&self, msg: &mut Value, items: &[ReasoningItem])
fn write_assistant(&self, msg: &mut Value, items: &[ReasoningItem])
Project typed items back into the assistant message body that
will be sent on the next request. The default emits an
reasoning_details array on the assistant message. Providers
with positional contracts (Vertex direct: signature must be
re-attached to the functionCall Part) override.Auto Trait Implementations§
impl Freeze for OpenRouterReasoningCodec
impl RefUnwindSafe for OpenRouterReasoningCodec
impl Send for OpenRouterReasoningCodec
impl Sync for OpenRouterReasoningCodec
impl Unpin for OpenRouterReasoningCodec
impl UnsafeUnpin for OpenRouterReasoningCodec
impl UnwindSafe for OpenRouterReasoningCodec
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
Mutably borrows from an owned value. Read more