pub struct LlmClient {
pub base_url: String,
pub model: String,
/* private fields */
}Expand description
OpenAI-compatible streaming LLM client.
Fields§
§base_url: String§model: StringImplementations§
Source§impl LlmClient
impl LlmClient
pub fn new( url: &str, model: &str, api_key: &str, connect_timeout_secs: u64, ) -> Self
Sourcepub async fn chat_stream(
&self,
messages: &[Message],
) -> Result<impl Stream<Item = Result<String>>>
pub async fn chat_stream( &self, messages: &[Message], ) -> Result<impl Stream<Item = Result<String>>>
POST to /v1/chat/completions with stream:true, yield content delta strings.
Sourcepub async fn auto_detect() -> Option<String>
pub async fn auto_detect() -> Option<String>
Probe :11434 (Ollama) then :8080 (llama.cpp). Returns first base URL that responds.
Auto Trait Implementations§
impl Freeze for LlmClient
impl !RefUnwindSafe for LlmClient
impl Send for LlmClient
impl Sync for LlmClient
impl Unpin for LlmClient
impl UnsafeUnpin for LlmClient
impl !UnwindSafe for LlmClient
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