pub struct ChatRequest {
pub model: String,
pub messages: Vec<Message>,
pub stream: bool,
pub options: Option<Options>,
pub tools: Option<Vec<Tool>>,
pub format: Option<String>,
}Expand description
Request to generate a chat completion.
Fields§
§model: StringModel name.
messages: Vec<Message>Messages in the conversation.
stream: boolWhether to stream the response.
options: Option<Options>Generation options.
tools: Option<Vec<Tool>>Available tools.
format: Option<String>Format (e.g., “json”).
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub fn new(model: impl Into<String>, messages: Vec<Message>) -> Self
pub fn new(model: impl Into<String>, messages: Vec<Message>) -> Self
Create a new chat request.
Sourcepub fn with_options(self, options: Options) -> Self
pub fn with_options(self, options: Options) -> Self
Set generation options.
Sourcepub fn with_tools(self, tools: Vec<Tool>) -> Self
pub fn with_tools(self, tools: Vec<Tool>) -> Self
Set available tools.
Sourcepub fn with_format(self, format: impl Into<String>) -> Self
pub fn with_format(self, format: impl Into<String>) -> Self
Set output format.
Sourcepub fn with_stream(self, stream: bool) -> Self
pub fn with_stream(self, stream: bool) -> Self
Enable streaming.
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
Returns a duplicate of the value. Read more
1.0.0 · 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 ChatRequest
impl Debug for ChatRequest
Auto Trait Implementations§
impl Freeze for ChatRequest
impl RefUnwindSafe for ChatRequest
impl Send for ChatRequest
impl Sync for ChatRequest
impl Unpin for ChatRequest
impl UnwindSafe for ChatRequest
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