Skip to main content

ChatModelExt

Trait ChatModelExt 

Source
pub trait ChatModelExt<C, T>: Sized
where C: Codec, T: Transport,
{ // Required method fn with_structured_output<O>(self) -> StructuredOutputAdapter<O, C, T> where O: JsonSchema + DeserializeOwned + Send + 'static; }
Expand description

Extension methods on ChatModel that produce typed Runnable adapters.

model.with_structured_output::<Order>() returns a Runnable<Vec<Message>, Order> ready for .pipe() composition — the with_structured_output ergonomic, typed.

Required Methods§

Source

fn with_structured_output<O>(self) -> StructuredOutputAdapter<O, C, T>
where O: JsonSchema + DeserializeOwned + Send + 'static,

Adapt this ChatModel into a Runnable<Vec<Message>, O> that routes every invocation through complete_typed::<O>. The original model is consumed; operators sharing the model behind an Arc reach for StructuredOutputAdapter::from_arc directly.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C, T> ChatModelExt<C, T> for ChatModel<C, T>
where C: Codec, T: Transport,