pub struct UniversalLLMClient { /* private fields */ }Implementations§
Source§impl UniversalLLMClient
impl UniversalLLMClient
pub fn new( provider_model: &str, api_key: Option<String>, ) -> Result<UniversalLLMClient, String>
Sourcepub fn new_with_config(
llm_config: LLMConfig,
) -> Result<UniversalLLMClient, String>
pub fn new_with_config( llm_config: LLMConfig, ) -> Result<UniversalLLMClient, String>
Create a new UniversalLLMClient with comprehensive LLMConfig
§Examples
use runtime::llm::LLMConfig;
use runtime::llm::UniversalLLMClient;
let config = LLMConfig::new("openai::gpt-4")
.with_api_key("your-api-key")
.with_temperature(0.7)
.with_max_tokens(2048);
let client = UniversalLLMClient::new_with_config(config).unwrap();Trait Implementations§
Source§impl Clone for UniversalLLMClient
impl Clone for UniversalLLMClient
Source§fn clone(&self) -> UniversalLLMClient
fn clone(&self) -> UniversalLLMClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl LLMClient for UniversalLLMClient
impl LLMClient for UniversalLLMClient
Source§fn complete<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<T, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: LLMResponseTrait<C> + Default + Send + 'async_trait,
C: for<'de> Deserialize<'de> + Default + Send + Serialize + 'async_trait,
UniversalLLMClient: 'async_trait,
fn complete<'life0, 'life1, 'life2, 'async_trait, T, C>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<T, String>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: LLMResponseTrait<C> + Default + Send + 'async_trait,
C: for<'de> Deserialize<'de> + Default + Send + Serialize + 'async_trait,
UniversalLLMClient: 'async_trait,
Send messages to LLM and get a response
Auto Trait Implementations§
impl Freeze for UniversalLLMClient
impl !RefUnwindSafe for UniversalLLMClient
impl Send for UniversalLLMClient
impl Sync for UniversalLLMClient
impl Unpin for UniversalLLMClient
impl !UnwindSafe for UniversalLLMClient
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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