pub struct ChatRequestBuilder { /* private fields */ }Expand description
Ergonomic builder for ChatRequest.
Implementations§
Source§impl ChatRequestBuilder
impl ChatRequestBuilder
Sourcepub fn user(self, content: impl Into<MessageContent>) -> ChatRequestBuilder
pub fn user(self, content: impl Into<MessageContent>) -> ChatRequestBuilder
Append a user message.
Sourcepub fn assistant(self, content: impl Into<MessageContent>) -> ChatRequestBuilder
pub fn assistant(self, content: impl Into<MessageContent>) -> ChatRequestBuilder
Append an assistant message.
Sourcepub fn message(self, message: Message) -> ChatRequestBuilder
pub fn message(self, message: Message) -> ChatRequestBuilder
Append an arbitrary message.
Sourcepub fn system(self, content: impl Into<String>) -> ChatRequestBuilder
pub fn system(self, content: impl Into<String>) -> ChatRequestBuilder
Set the system prompt.
Sourcepub fn model(self, model: impl Into<String>) -> ChatRequestBuilder
pub fn model(self, model: impl Into<String>) -> ChatRequestBuilder
Override the model.
Sourcepub fn max_tokens(self, max_tokens: u32) -> ChatRequestBuilder
pub fn max_tokens(self, max_tokens: u32) -> ChatRequestBuilder
Set the max output tokens.
Sourcepub fn temperature(self, temperature: f32) -> ChatRequestBuilder
pub fn temperature(self, temperature: f32) -> ChatRequestBuilder
Set the sampling temperature.
Sourcepub fn stop(self, stop: Vec<String>) -> ChatRequestBuilder
pub fn stop(self, stop: Vec<String>) -> ChatRequestBuilder
Set stop sequences.
Sourcepub fn tools(self, tools: Vec<Tool>) -> ChatRequestBuilder
pub fn tools(self, tools: Vec<Tool>) -> ChatRequestBuilder
Set the tools.
Sourcepub fn tool(self, tool: Tool) -> ChatRequestBuilder
pub fn tool(self, tool: Tool) -> ChatRequestBuilder
Add a single tool.
Sourcepub fn tool_choice(self, choice: ToolChoice) -> ChatRequestBuilder
pub fn tool_choice(self, choice: ToolChoice) -> ChatRequestBuilder
Set the tool choice.
Sourcepub fn build(self) -> ChatRequest
pub fn build(self) -> ChatRequest
Finish building.
Trait Implementations§
Source§impl Clone for ChatRequestBuilder
impl Clone for ChatRequestBuilder
Source§fn clone(&self) -> ChatRequestBuilder
fn clone(&self) -> ChatRequestBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChatRequestBuilder
impl Debug for ChatRequestBuilder
Source§impl Default for ChatRequestBuilder
impl Default for ChatRequestBuilder
Source§fn default() -> ChatRequestBuilder
fn default() -> ChatRequestBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ChatRequestBuilder
impl RefUnwindSafe for ChatRequestBuilder
impl Send for ChatRequestBuilder
impl Sync for ChatRequestBuilder
impl Unpin for ChatRequestBuilder
impl UnsafeUnpin for ChatRequestBuilder
impl UnwindSafe for ChatRequestBuilder
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