Struct ProviderDispatchRef
pub struct ProviderDispatchRef<'a> { /* private fields */ }Implementations§
Source§impl<'a> ProviderDispatchRef<'a>
impl<'a> ProviderDispatchRef<'a>
Sourcepub async fn chat(
&self,
request: ChatRequest<'_>,
model: &str,
temperature: Option<f64>,
) -> Result<ChatResponse, Error>
pub async fn chat( &self, request: ChatRequest<'_>, model: &str, temperature: Option<f64>, ) -> Result<ChatResponse, Error>
Open attribution_span!(self.inner) + scope!(model: model)
around the inner provider’s chat call.
Sourcepub async fn chat_accounted(
&self,
request: ChatRequest<'_>,
model: &str,
temperature: Option<f64>,
) -> Result<AccountedChatResponse, Error>
pub async fn chat_accounted( &self, request: ChatRequest<'_>, model: &str, temperature: Option<f64>, ) -> Result<AccountedChatResponse, Error>
Like Self::chat, while retaining rejected Reliable-attempt usage in
a separate accounting sidecar.
pub fn stream_chat( &self, request: ChatRequest<'_>, model: &str, temperature: Option<f64>, options: StreamOptions, ) -> Pin<Box<dyn Stream<Item = Result<StreamEvent, StreamError>> + Send>>
pub fn stream_chat_with_system( &self, system_prompt: Option<&str>, message: &str, model: &str, temperature: Option<f64>, options: StreamOptions, ) -> Pin<Box<dyn Stream<Item = Result<StreamChunk, StreamError>> + Send>>
pub fn stream_chat_with_history( &self, messages: &[ChatMessage], model: &str, temperature: Option<f64>, options: StreamOptions, ) -> Pin<Box<dyn Stream<Item = Result<StreamChunk, StreamError>> + Send>>
Sourcepub async fn simple_chat(
&self,
message: &str,
model: &str,
temperature: Option<f64>,
) -> Result<String, Error>
pub async fn simple_chat( &self, message: &str, model: &str, temperature: Option<f64>, ) -> Result<String, Error>
Wrap the inner provider’s simple_chat. Dispatched through
self.inner so a concrete simple_chat override on the inner
provider is honored (rather than the trait default that
delegates to chat_with_system).
Sourcepub async fn chat_with_system(
&self,
system_prompt: Option<&str>,
message: &str,
model: &str,
temperature: Option<f64>,
) -> Result<String, Error>
pub async fn chat_with_system( &self, system_prompt: Option<&str>, message: &str, model: &str, temperature: Option<f64>, ) -> Result<String, Error>
Wrap the inner provider’s chat_with_system.
Sourcepub async fn chat_with_history(
&self,
messages: &[ChatMessage],
model: &str,
temperature: Option<f64>,
) -> Result<String, Error>
pub async fn chat_with_history( &self, messages: &[ChatMessage], model: &str, temperature: Option<f64>, ) -> Result<String, Error>
Wrap the inner provider’s chat_with_history.
Sourcepub async fn chat_with_tools(
&self,
messages: &[ChatMessage],
tools: &[Value],
model: &str,
temperature: Option<f64>,
) -> Result<ChatResponse, Error>
pub async fn chat_with_tools( &self, messages: &[ChatMessage], tools: &[Value], model: &str, temperature: Option<f64>, ) -> Result<ChatResponse, Error>
Wrap the inner provider’s chat_with_tools.
Sourcepub async fn chat_with_tools_accounted(
&self,
messages: &[ChatMessage],
tools: &[Value],
model: &str,
temperature: Option<f64>,
) -> Result<AccountedChatResponse, Error>
pub async fn chat_with_tools_accounted( &self, messages: &[ChatMessage], tools: &[Value], model: &str, temperature: Option<f64>, ) -> Result<AccountedChatResponse, Error>
Like Self::chat_with_tools, while retaining rejected
Reliable-attempt usage in a separate accounting sidecar.
Sourcepub async fn list_models(&self) -> Result<Vec<String>, Error>
pub async fn list_models(&self) -> Result<Vec<String>, Error>
Wrap the inner provider’s list_models. No model parameter,
so attribution only.
Sourcepub async fn list_models_with_pricing(&self) -> Result<Vec<ModelInfo>, Error>
pub async fn list_models_with_pricing(&self) -> Result<Vec<ModelInfo>, Error>
Wrap the inner provider’s list_models_with_pricing.
Sourcepub async fn warmup(&self) -> Result<(), Error>
pub async fn warmup(&self) -> Result<(), Error>
Wrap the inner provider’s warmup. No model parameter, so
attribution only.
pub fn inner(&self) -> &'a dyn ModelProvider
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ProviderDispatchRef<'a>
impl<'a> !UnwindSafe for ProviderDispatchRef<'a>
impl<'a> Freeze for ProviderDispatchRef<'a>
impl<'a> Send for ProviderDispatchRef<'a>
impl<'a> Sync for ProviderDispatchRef<'a>
impl<'a> Unpin for ProviderDispatchRef<'a>
impl<'a> UnsafeUnpin for ProviderDispatchRef<'a>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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