Skip to main content

ExtractingProvider

Struct ExtractingProvider 

Source
pub struct ExtractingProvider<P> { /* private fields */ }
Expand description

A ChatProvider wrapper that adds orchestrated structured extraction via ExtractExt using a bundled Extractor.

Wrapping a provider with ExtractingProvider changes the behavior of ExtractExt::extract: instead of extracting directly from the request, it builds a clean extraction request (stripping tools, response format, etc.) and performs extraction in a dedicated pass over the request’s existing messages.

This wrapper does not execute tools or run a separate pre-extraction conversation step. Use it when the original request still carries non-extraction settings that should be ignored for the extraction call.

For simple one-shot extraction without this dedicated pass, use ExtractExt::extract directly on the unwrapped provider.

Implementations§

Source§

impl<P> ExtractingProvider<P>

Source

pub fn new(inner: P) -> Self

Wraps a provider with orchestrated extraction.

Source

pub fn into_inner(self) -> P

Consumes the wrapper, returning the wrapped provider.

Trait Implementations§

Source§

impl<P> ChatProvider for ExtractingProvider<P>
where P: ChatProvider,

Source§

type Stream = <P as ChatProvider>::Stream

Concrete stream type returned by chat_stream
Source§

async fn chat(&self, request: &ChatRequest) -> Result<ChatResponse>

Send a chat completion request and return the full response. Read more
Source§

async fn chat_stream(&self, request: &ChatRequest) -> Result<Self::Stream>

Send a chat completion request and return a stream of chunks. Read more
Source§

fn chat_capability( &self, model: &str, capability: ChatCapability, ) -> CapabilitySupport

Returns support information for a provider/model capability query.
Source§

impl<P> Debug for ExtractingProvider<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> ExtractExt for ExtractingProvider<P>
where P: ChatProvider + Sync,

Source§

fn extract<'a, T>( &'a self, request: &'a ChatRequest, ) -> impl Future<Output = Result<Extracted<T>>> + Send + 'a
where T: JsonSchema + DeserializeOwned + Send + 'a,

Extract structured data from a chat request. Read more
Source§

impl<P> ProviderIdentity for ExtractingProvider<P>

Source§

fn provider_name(&self) -> &'static str

Returns the provider identity name.

Auto Trait Implementations§

§

impl<P> Freeze for ExtractingProvider<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for ExtractingProvider<P>
where P: RefUnwindSafe,

§

impl<P> Send for ExtractingProvider<P>
where P: Send,

§

impl<P> Sync for ExtractingProvider<P>
where P: Sync,

§

impl<P> Unpin for ExtractingProvider<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for ExtractingProvider<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for ExtractingProvider<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ChatProviderExt for T
where T: ChatProvider,

Source§

fn ask( &self, model: &str, message: impl Into<String>, ) -> impl Future<Output = Result<String>> + Send

Quick one-shot text question. Read more
Source§

fn ask_with_system( &self, model: &str, system: impl Into<String>, message: impl Into<String>, ) -> impl Future<Output = Result<String>> + Send

Quick one-shot text question with a system message. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more