Struct llm_api_adapter::client::AnthropicClient
source · pub struct AnthropicClient { /* private fields */ }
Expand description
Wrapper around the Anthropic LLM API client
Implementations§
source§impl AnthropicClient
impl AnthropicClient
sourcepub fn new(api_key: String) -> Self
pub fn new(api_key: String) -> Self
Creates a new instance of AnthropicClient
with the provided API key.
sourcepub async fn send_message(
&self,
model: &str,
messages: Vec<Message>,
max_tokens: u32,
temperature: f32
) -> Result<ResponseMessage, AnthropicError>
pub async fn send_message( &self, model: &str, messages: Vec<Message>, max_tokens: u32, temperature: f32 ) -> Result<ResponseMessage, AnthropicError>
Sends a single message to the Anthropic API and retrieves the response.
§Arguments
model
- The name of the model to use for generating the response.messages
- The list of messages to send to the API.max_tokens
- The maximum number of tokens to generate in the response.temperature
- The temperature value to control the randomness of the generated response.
§Returns
A ResponseMessage
instance containing the API response.
sourcepub fn chat(
&self,
model: &str,
max_tokens: u32,
temperature: f32
) -> ChatSession<'_>
pub fn chat( &self, model: &str, max_tokens: u32, temperature: f32 ) -> ChatSession<'_>
Creates a new ChatSession
with the specified model, max tokens, and temperature.
§Arguments
model
- The name of the model to use for the chat session.max_tokens
- The maximum number of tokens to generate in each response.temperature
- The temperature value to control the randomness of the generated responses.
§Returns
A new ChatSession
instance.
Auto Trait Implementations§
impl Freeze for AnthropicClient
impl !RefUnwindSafe for AnthropicClient
impl Send for AnthropicClient
impl Sync for AnthropicClient
impl Unpin for AnthropicClient
impl !UnwindSafe for AnthropicClient
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