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>
pub async fn chat( &self, request: ChatRequest<'_>, model: &str, temperature: Option<f64>, ) -> Result<ChatResponse>
Open attribution_span!(self.inner) + scope!(model: model)
around the inner provider’s chat call.
pub fn stream_chat( &self, request: ChatRequest<'_>, model: &str, temperature: Option<f64>, options: StreamOptions, ) -> BoxStream<'static, StreamResult<StreamEvent>>
Sourcepub async fn simple_chat(
&self,
message: &str,
model: &str,
temperature: Option<f64>,
) -> Result<String>
pub async fn simple_chat( &self, message: &str, model: &str, temperature: Option<f64>, ) -> Result<String>
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>
pub async fn chat_with_system( &self, system_prompt: Option<&str>, message: &str, model: &str, temperature: Option<f64>, ) -> Result<String>
Wrap the inner provider’s chat_with_system.
Sourcepub async fn chat_with_history(
&self,
messages: &[ChatMessage],
model: &str,
temperature: Option<f64>,
) -> Result<String>
pub async fn chat_with_history( &self, messages: &[ChatMessage], model: &str, temperature: Option<f64>, ) -> Result<String>
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>
pub async fn chat_with_tools( &self, messages: &[ChatMessage], tools: &[Value], model: &str, temperature: Option<f64>, ) -> Result<ChatResponse>
Wrap the inner provider’s chat_with_tools.
Sourcepub async fn list_models(&self) -> Result<Vec<String>>
pub async fn list_models(&self) -> Result<Vec<String>>
Wrap the inner provider’s list_models. No model parameter,
so attribution only.
Sourcepub async fn list_models_with_pricing(&self) -> Result<Vec<ModelInfo>>
pub async fn list_models_with_pricing(&self) -> Result<Vec<ModelInfo>>
Wrap the inner provider’s list_models_with_pricing.
Sourcepub async fn warmup(&self) -> Result<()>
pub async fn warmup(&self) -> Result<()>
Wrap the inner provider’s warmup. No model parameter, so
attribution only.
pub fn inner(&self) -> &'a dyn ModelProvider
Auto Trait Implementations§
impl<'a> Freeze for ProviderDispatchRef<'a>
impl<'a> !RefUnwindSafe 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>
impl<'a> !UnwindSafe for ProviderDispatchRef<'a>
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
§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>
Converts
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>
Converts
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