pub struct LiteLLMModel { /* private fields */ }Expand description
LiteLLM model provider implementation.
This provides a unified interface to multiple LLM providers through LiteLLM.
Implementations§
Source§impl LiteLLMModel
impl LiteLLMModel
Sourcepub fn new(config: LiteLLMConfig) -> Self
pub fn new(config: LiteLLMConfig) -> Self
Create a new LiteLLM model.
Sourcepub fn litellm_config(&self) -> &LiteLLMConfig
pub fn litellm_config(&self) -> &LiteLLMConfig
Get the LiteLLM configuration.
Sourcepub fn update_litellm_config(&mut self, config: LiteLLMConfig)
pub fn update_litellm_config(&mut self, config: LiteLLMConfig)
Update the LiteLLM configuration.
Trait Implementations§
Source§impl Model for LiteLLMModel
impl Model for LiteLLMModel
Source§fn config(&self) -> &ModelConfig
fn config(&self) -> &ModelConfig
Returns the model configuration.
Source§fn update_config(&mut self, config: ModelConfig)
fn update_config(&mut self, config: ModelConfig)
Updates the model configuration.
Source§fn stream<'a>(
&'a self,
_messages: &'a [Message],
_tool_specs: Option<&'a [ToolSpec]>,
_system_prompt: Option<&'a str>,
_tool_choice: Option<ToolChoice>,
_system_prompt_content: Option<&'a [SystemContentBlock]>,
) -> StreamEventStream<'a>
fn stream<'a>( &'a self, _messages: &'a [Message], _tool_specs: Option<&'a [ToolSpec]>, _system_prompt: Option<&'a str>, _tool_choice: Option<ToolChoice>, _system_prompt_content: Option<&'a [SystemContentBlock]>, ) -> StreamEventStream<'a>
Streams a response from the model.
Auto Trait Implementations§
impl Freeze for LiteLLMModel
impl RefUnwindSafe for LiteLLMModel
impl Send for LiteLLMModel
impl Sync for LiteLLMModel
impl Unpin for LiteLLMModel
impl UnwindSafe for LiteLLMModel
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreCreates a shared type from an unshared type.
Source§impl<T> ModelExt for Twhere
T: Model,
impl<T> ModelExt for Twhere
T: Model,
Source§fn structured_output<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
messages: &'life1 [Message],
system_prompt: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<T, StrandsError>> + Send + 'async_trait>>where
T: DeserializeOwned + JsonSchema + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn structured_output<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
messages: &'life1 [Message],
system_prompt: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<T, StrandsError>> + Send + 'async_trait>>where
T: DeserializeOwned + JsonSchema + Send + 'async_trait,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generates a structured output from the model.