Struct ChatRequestBuilder

Source
pub struct ChatRequestBuilder { /* private fields */ }
Expand description

Builder for ChatRequest

Implementations§

Source§

impl ChatRequestBuilder

Source

pub fn new() -> ChatRequestBuilder

Source

pub fn message(self, message: Message) -> ChatRequestBuilder

Source

pub fn messages(self, messages: Vec<Message>) -> ChatRequestBuilder

Source

pub fn temperature(self, temperature: f32) -> ChatRequestBuilder

Source

pub fn max_tokens(self, max_tokens: u32) -> ChatRequestBuilder

Source

pub fn top_p(self, top_p: f32) -> ChatRequestBuilder

Source

pub fn stop_sequences(self, stop_sequences: Vec<String>) -> ChatRequestBuilder

Source

pub fn request_id(self, request_id: String) -> ChatRequestBuilder

Source

pub fn user_id(self, user_id: String) -> ChatRequestBuilder

Source

pub fn extension(self, key: String, value: Value) -> ChatRequestBuilder

Source

pub fn user_message(self, content: impl Into<String>) -> ChatRequestBuilder

Add a user message with text content

Source

pub fn assistant_message(self, content: impl Into<String>) -> ChatRequestBuilder

Add an assistant message with text content

Source

pub fn system_message(self, content: impl Into<String>) -> ChatRequestBuilder

Add a system message with text content

Source

pub fn tool_response( self, content: impl Into<String>, tool_call_id: impl Into<String>, ) -> ChatRequestBuilder

Add a tool response message

Source

pub fn assistant_with_tools( self, content: impl Into<String>, tool_calls: Vec<ToolCall>, ) -> ChatRequestBuilder

Add an assistant message with tool calls

Source

pub fn user_multimodal(self, content: Vec<ContentPart>) -> ChatRequestBuilder

Add a user message with multimodal content

Source

pub fn assistant_multimodal( self, content: Vec<ContentPart>, ) -> ChatRequestBuilder

Add an assistant message with multimodal content

Source

pub fn build(self) -> ChatRequest

Trait Implementations§

Source§

impl Default for ChatRequestBuilder

Source§

fn default() -> ChatRequestBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,