pub struct LlmClient { /* private fields */ }Expand description
The main LLM client.
Implementations§
Source§impl LlmClient
impl LlmClient
Sourcepub async fn chat(
&self,
messages: &[Message],
options: ChatOptions<'_>,
) -> Result<MessagesResponse, LlmError>
pub async fn chat( &self, messages: &[Message], options: ChatOptions<'_>, ) -> Result<MessagesResponse, LlmError>
Send a chat completion request using Anthropic message format.
Automatically converts to OpenAI format if the provider is OpenAI-compatible. Always returns the response in Anthropic format (canonical).
Sourcepub async fn complete(
&self,
user: &str,
options: ChatOptions<'_>,
) -> Result<MessagesResponse, LlmError>
pub async fn complete( &self, user: &str, options: ChatOptions<'_>, ) -> Result<MessagesResponse, LlmError>
Simple text-in, full-response-out call.
Sends a single user message and returns the full response.
Use .text() on the result to extract just the text content.
Sourcepub async fn chat_openai_raw(
&self,
request: &ChatRequest,
) -> Result<ChatResponse, LlmError>
pub async fn chat_openai_raw( &self, request: &ChatRequest, ) -> Result<ChatResponse, LlmError>
Send a raw OpenAI-format chat request.
Bypasses Anthropic format conversion — sends and receives OpenAI types directly.
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