#[non_exhaustive]pub struct ChatCompletionsRequest {
pub model: String,
pub messages: Vec<ChatMessage>,
pub max_tokens: Option<u32>,
pub temperature: Option<f32>,
pub stream: Option<bool>,
pub n: Option<u32>,
pub tools: Option<Value>,
pub user: Option<String>,
}Expand description
Body of POST /v1/chat/completions.
Mirrors the public OpenAI REST contract documented at https://platform.openai.com/docs/api-reference/chat/create.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringModel identifier. See CompletionsRequest::model.
messages: Vec<ChatMessage>Conversation history. Required by OpenAI; the scaffold rejects at the 501 step so an empty vector still parses.
max_tokens: Option<u32>Maximum tokens to generate per response.
temperature: Option<f32>Sampling temperature in [0.0, 2.0].
stream: Option<bool>Stream the response as SSE if true.
n: Option<u32>Number of completions to generate per prompt.
tools: Option<Value>Optional tools array (OpenAI tool-calling). v0.4 wires.
user: Option<String>Caller-supplied opaque user identifier.
Trait Implementations§
Source§impl Clone for ChatCompletionsRequest
impl Clone for ChatCompletionsRequest
Source§fn clone(&self) -> ChatCompletionsRequest
fn clone(&self) -> ChatCompletionsRequest
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 ChatCompletionsRequest
impl Debug for ChatCompletionsRequest
Source§impl Default for ChatCompletionsRequest
impl Default for ChatCompletionsRequest
Source§fn default() -> ChatCompletionsRequest
fn default() -> ChatCompletionsRequest
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ChatCompletionsRequest
impl<'de> Deserialize<'de> for ChatCompletionsRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChatCompletionsRequest
impl RefUnwindSafe for ChatCompletionsRequest
impl Send for ChatCompletionsRequest
impl Sync for ChatCompletionsRequest
impl Unpin for ChatCompletionsRequest
impl UnsafeUnpin for ChatCompletionsRequest
impl UnwindSafe for ChatCompletionsRequest
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more