pub struct ChatRequest {
pub messages: Vec<Message>,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<String>,
pub response_format: Option<ResponseFormat>,
pub cancel_token: Option<CancellationToken>,
}Expand description
Chat request parameters
Fields§
§messages: Vec<Message>Ordered chat history sent to the model.
temperature: Option<f32>Optional sampling temperature.
max_tokens: Option<u32>Optional response token limit.
tools: Option<Vec<ToolDefinition>>Optional tool definitions exposed to the model.
tool_choice: Option<String>Optional provider-specific tool choice mode.
response_format: Option<ResponseFormat>Optional structured output format hint.
cancel_token: Option<CancellationToken>Optional cancellation token for aborting in-flight requests. When set and cancelled, streaming responses will stop at the next SSE boundary.
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub fn new(messages: Vec<Message>) -> ChatRequest
pub fn new(messages: Vec<Message>) -> ChatRequest
Create a request from a message list.
Sourcepub fn with_tools(self, tools: Vec<ToolDefinition>) -> ChatRequest
pub fn with_tools(self, tools: Vec<ToolDefinition>) -> ChatRequest
Attach tool definitions to the request.
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 (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 ChatRequest
impl Debug for ChatRequest
Source§impl Default for ChatRequest
impl Default for ChatRequest
Source§fn default() -> ChatRequest
fn default() -> ChatRequest
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ChatRequest
impl RefUnwindSafe for ChatRequest
impl Send for ChatRequest
impl Sync for ChatRequest
impl Unpin for ChatRequest
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request