Struct llm_api_adapter::client::RequestBuilder
source · pub struct RequestBuilder<'a> { /* private fields */ }
Expand description
Represents a builder for constructing a request to the Anthropic API.
The RequestBuilder
allows setting various parameters for the request, such as the model,
messages, max tokens, temperature, and system prompt. The send
method sends the request
to the API and returns the response.
Implementations§
source§impl<'a> RequestBuilder<'a>
impl<'a> RequestBuilder<'a>
sourcepub fn new(client: &'a AnthropicClient) -> Self
pub fn new(client: &'a AnthropicClient) -> Self
Creates a new instance of RequestBuilder
with the provided AnthropicClient
.
sourcepub fn messages(self, messages: Vec<Message>) -> Self
pub fn messages(self, messages: Vec<Message>) -> Self
Sets the messages to include in the request.
sourcepub fn max_tokens(self, max_tokens: u32) -> Self
pub fn max_tokens(self, max_tokens: u32) -> Self
Sets the maximum number of tokens to generate in the response.
sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Sets the temperature value to control the randomness of the generated response.
sourcepub fn system_prompt(self, system_prompt: &str) -> Self
pub fn system_prompt(self, system_prompt: &str) -> Self
Sets the system prompt to provide context or instructions for the request.
Auto Trait Implementations§
impl<'a> Freeze for RequestBuilder<'a>
impl<'a> !RefUnwindSafe for RequestBuilder<'a>
impl<'a> Send for RequestBuilder<'a>
impl<'a> Sync for RequestBuilder<'a>
impl<'a> Unpin for RequestBuilder<'a>
impl<'a> !UnwindSafe for RequestBuilder<'a>
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