pub struct LlamaClient { /* private fields */ }Expand description
Llama.cpp server client (local or remote)
Compatible with llama.cpp’s OpenAI-compatible API server Typically runs on localhost:8080 or similar
Implementations§
Source§impl LlamaClient
impl LlamaClient
Sourcepub fn new(base_url: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>, model: impl Into<String>) -> Self
Create a new llama.cpp client
§Arguments
base_url- Base URL of llama.cpp server (e.g., “http://localhost:8080”)model- Model name (optional, llama.cpp usually ignores this)
Sourcepub fn with_http_client(
base_url: impl Into<String>,
model: impl Into<String>,
http_client: HttpClient,
) -> Self
pub fn with_http_client( base_url: impl Into<String>, model: impl Into<String>, http_client: HttpClient, ) -> Self
Create a new llama.cpp client with custom HTTP client Useful for configuring TLS, timeouts, etc.
Sourcepub fn localhost_with_port(port: u16) -> Self
pub fn localhost_with_port(port: u16) -> Self
Create a client pointing to localhost with custom port
Sourcepub fn insecure(base_url: impl Into<String>, model: impl Into<String>) -> Self
pub fn insecure(base_url: impl Into<String>, model: impl Into<String>) -> Self
Create a client with insecure HTTPS (accepts self-signed certificates) Useful for local development with HTTPS servers
Sourcepub fn localhost_insecure(port: u16) -> Self
pub fn localhost_insecure(port: u16) -> Self
Create localhost client with insecure HTTPS on custom port
Trait Implementations§
Source§impl ChatClient for LlamaClient
impl ChatClient for LlamaClient
Source§fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a chat completion request
Source§fn chat_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<TextStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_stream<'life0, 'async_trait>(
&'life0 self,
request: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<TextStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stream a chat completion request (yields text chunks as they arrive)
Auto Trait Implementations§
impl Freeze for LlamaClient
impl !RefUnwindSafe for LlamaClient
impl Send for LlamaClient
impl Sync for LlamaClient
impl Unpin for LlamaClient
impl !UnwindSafe for LlamaClient
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