pub struct LiteLLM { /* private fields */ }
Expand description
Simple wrapper around any LLM that follows the OpenAI‑compatible API.
Implementations§
Source§impl LiteLLM
impl LiteLLM
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the base URL (e.g., http://192.168.3.40:8000/v1)
Sourcepub fn without_auth(self) -> Self
pub fn without_auth(self) -> Self
Disable authentication for local/open endpoints.
Sourcepub fn with_auth_token(self, token: Option<impl Into<String>>) -> Self
pub fn with_auth_token(self, token: Option<impl Into<String>>) -> Self
Set a custom auth token (Bearer). Use None to disable.
Trait Implementations§
Source§impl Model for LiteLLM
impl Model for LiteLLM
Source§fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn generate<'life0, 'life1, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends a chat completion request to the configured endpoint.
Source§fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
system_instructions: Option<&'life1 str>,
input: &'life2 str,
_model_settings: Option<HashMap<String, String>>,
messages: Option<&'life3 [Value]>,
tools: Option<&'life4 [Value]>,
tool_choice: Option<Value>,
_output_schema: Option<&'life5 str>,
_handoffs: Option<&'life6 [String]>,
_tracing_enabled: bool,
_previous_response_id: Option<&'life7 str>,
_prompt_config: Option<&'life8 str>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
fn get_response<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'life6, 'life7, 'life8, 'async_trait>(
&'life0 self,
system_instructions: Option<&'life1 str>,
input: &'life2 str,
_model_settings: Option<HashMap<String, String>>,
messages: Option<&'life3 [Value]>,
tools: Option<&'life4 [Value]>,
tool_choice: Option<Value>,
_output_schema: Option<&'life5 str>,
_handoffs: Option<&'life6 [String]>,
_tracing_enabled: bool,
_previous_response_id: Option<&'life7 str>,
_prompt_config: Option<&'life8 str>,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
'life6: 'async_trait,
'life7: 'async_trait,
'life8: 'async_trait,
Rich response method (scaffold) to align with Python’s get_response signature.
Default implementation wraps
generate
with a simple string prompt.Auto Trait Implementations§
impl Freeze for LiteLLM
impl !RefUnwindSafe for LiteLLM
impl Send for LiteLLM
impl Sync for LiteLLM
impl Unpin for LiteLLM
impl !UnwindSafe for LiteLLM
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