pub struct ConfigBasedLLMFactory { /* private fields */ }Expand description
Configuration-based LLM client factory using the provider registry
Implementations§
Source§impl ConfigBasedLLMFactory
impl ConfigBasedLLMFactory
Sourcepub fn new(
registry: Arc<ProviderRegistry>,
default_model: &str,
) -> ConfigBasedLLMFactory
pub fn new( registry: Arc<ProviderRegistry>, default_model: &str, ) -> ConfigBasedLLMFactory
Create a new factory from a provider registry
Sourcepub fn from_config(
providers: HashMap<String, ProviderConfig>,
models: HashMap<String, ModelConfig>,
nvidia: Option<&NvidiaConfig>,
) -> Result<ConfigBasedLLMFactory, AppError>
pub fn from_config( providers: HashMap<String, ProviderConfig>, models: HashMap<String, ModelConfig>, nvidia: Option<&NvidiaConfig>, ) -> Result<ConfigBasedLLMFactory, AppError>
Create a factory from TOML configuration
Sourcepub fn registry(&self) -> &Arc<ProviderRegistry> ⓘ
pub fn registry(&self) -> &Arc<ProviderRegistry> ⓘ
Get the provider registry
Sourcepub async fn create_for_model(
&self,
model_name: &str,
) -> Result<Box<dyn LLMClient>, AppError>
pub async fn create_for_model( &self, model_name: &str, ) -> Result<Box<dyn LLMClient>, AppError>
Create an LLM client for a specific model
Sourcepub async fn create_default(&self) -> Result<Box<dyn LLMClient>, AppError>
pub async fn create_default(&self) -> Result<Box<dyn LLMClient>, AppError>
Create an LLM client using the default model
Sourcepub fn default_model(&self) -> &str
pub fn default_model(&self) -> &str
Get the default model name
Sourcepub fn set_default_model(&mut self, model_name: &str)
pub fn set_default_model(&mut self, model_name: &str)
Set the default model name
Trait Implementations§
Source§impl Service for ConfigBasedLLMFactory
impl Service for ConfigBasedLLMFactory
Auto Trait Implementations§
impl !RefUnwindSafe for ConfigBasedLLMFactory
impl !UnwindSafe for ConfigBasedLLMFactory
impl Freeze for ConfigBasedLLMFactory
impl Send for ConfigBasedLLMFactory
impl Sync for ConfigBasedLLMFactory
impl Unpin for ConfigBasedLLMFactory
impl UnsafeUnpin for ConfigBasedLLMFactory
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 more