pub struct ChatCompletionRequest {
pub model: ModelField,
pub messages: Vec<ChatCompletionMessage>,
pub stream: bool,
pub temperature: Option<f32>,
pub max_tokens: Option<u32>,
pub strict_capabilities: Option<bool>,
pub tools: Option<Vec<ToolDefinition>>,
pub tool_choice: Option<ToolChoice>,
pub response_format: Option<ResponseFormatRequest>,
pub top_p: Option<f32>,
pub stop: Option<StopField>,
}Expand description
OpenAI-compatible chat completion request
Accepts either a single model string or an array of model strings for multiplex mode. Each model string may contain a provider prefix (e.g., “copilot:gpt-4o”) parsed by the provider resolver.
Fields§
§model: ModelFieldModel identifier(s) — single string or array for multiplex
messages: Vec<ChatCompletionMessage>Conversation messages
stream: boolWhether to stream the response
temperature: Option<f32>Temperature for response randomness (0.0 - 2.0)
max_tokens: Option<u32>Maximum tokens to generate
strict_capabilities: Option<bool>Enable strict capability checking (reject unsupported parameters)
tools: Option<Vec<ToolDefinition>>Tool definitions for function calling
tool_choice: Option<ToolChoice>Controls which tools the model may call
response_format: Option<ResponseFormatRequest>Controls the response format (text, json_object, or json_schema)
top_p: Option<f32>Nucleus sampling parameter (0.0 - 1.0)
stop: Option<StopField>Stop sequence(s) that halt generation — single string or array
Trait Implementations§
Source§impl Debug for ChatCompletionRequest
impl Debug for ChatCompletionRequest
Source§impl<'de> Deserialize<'de> for ChatCompletionRequest
impl<'de> Deserialize<'de> for ChatCompletionRequest
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 ChatCompletionRequest
impl RefUnwindSafe for ChatCompletionRequest
impl Send for ChatCompletionRequest
impl Sync for ChatCompletionRequest
impl Unpin for ChatCompletionRequest
impl UnsafeUnpin for ChatCompletionRequest
impl UnwindSafe for ChatCompletionRequest
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> 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