pub struct ChatRequest {Show 15 fields
pub model: String,
pub messages: Vec<Message>,
pub audio: Option<Audio>,
pub frequency_penalty: Option<f32>,
pub max_completion_tokens: Option<u32>,
pub presence_penalty: Option<f32>,
pub response_format: Option<ResponseFormat>,
pub stop: Option<Stop>,
pub stream: Option<bool>,
pub thinking: Option<Thinking>,
pub temperature: Option<f32>,
pub tool_choice: Option<ToolChoice>,
pub tools: Option<Vec<Tool>>,
pub top_p: Option<f32>,
pub web_search_enabled: Option<bool>,
}Expand description
Chat completion request.
Fields§
§model: StringThe model to use for generation
messages: Vec<Message>List of messages in the conversation
audio: Option<Audio>Audio output parameters (for TTS)
frequency_penalty: Option<f32>Frequency penalty (-2.0 to 2.0)
max_completion_tokens: Option<u32>Maximum completion tokens
presence_penalty: Option<f32>Presence penalty (-2.0 to 2.0)
response_format: Option<ResponseFormat>Response format
stop: Option<Stop>Stop sequences
stream: Option<bool>Enable streaming response
thinking: Option<Thinking>Thinking mode configuration
temperature: Option<f32>Sampling temperature (0 to 1.5)
tool_choice: Option<ToolChoice>Tool choice
tools: Option<Vec<Tool>>List of tools
top_p: Option<f32>Top-p sampling (0.01 to 1.0)
web_search_enabled: Option<bool>Enable web search capability.
Note: You must first enable the “联网服务插件” (Web Search Plugin)
in the MiMo console before using this feature. If the plugin is not
enabled, setting this to true will result in a 400 error.
Implementations§
Source§impl ChatRequest
impl ChatRequest
Sourcepub fn new(model: impl Into<String>) -> Self
pub fn new(model: impl Into<String>) -> Self
Create a new chat request with the specified model.
Sourcepub fn v25_tts_voicedesign() -> Self
pub fn v25_tts_voicedesign() -> Self
Create a chat request with the MiMo V2.5 TTS VoiceDesign model.
Sourcepub fn v25_tts_voiceclone() -> Self
pub fn v25_tts_voiceclone() -> Self
Create a chat request with the MiMo V2.5 TTS VoiceClone model.
Sourcepub fn messages(self, messages: Vec<Message>) -> Self
pub fn messages(self, messages: Vec<Message>) -> Self
Add multiple messages to the conversation.
If a system message was previously set via [system()] and the new
messages do not already contain a system message, the existing system
message is preserved and placed at the beginning.
Sourcepub fn system(self, content: impl Into<String>) -> Self
pub fn system(self, content: impl Into<String>) -> Self
Add a system message.
The system message is always placed at the beginning of the message list (index 0), regardless of whether this method is called before or after other messages are added.
Sourcepub fn frequency_penalty(self, penalty: f32) -> Self
pub fn frequency_penalty(self, penalty: f32) -> Self
Set the frequency penalty.
Sourcepub fn max_completion_tokens(self, tokens: u32) -> Self
pub fn max_completion_tokens(self, tokens: u32) -> Self
Set the maximum completion tokens.
Sourcepub fn presence_penalty(self, penalty: f32) -> Self
pub fn presence_penalty(self, penalty: f32) -> Self
Set the presence penalty.
Sourcepub fn response_format(self, format: ResponseFormat) -> Self
pub fn response_format(self, format: ResponseFormat) -> Self
Set the response format.
Sourcepub fn enable_thinking(self) -> Self
pub fn enable_thinking(self) -> Self
Enable thinking mode.
Sourcepub fn disable_thinking(self) -> Self
pub fn disable_thinking(self) -> Self
Disable thinking mode.
Sourcepub fn temperature(self, temperature: f32) -> Self
pub fn temperature(self, temperature: f32) -> Self
Set the temperature.
Sourcepub fn tool_choice(self, choice: ToolChoice) -> Self
pub fn tool_choice(self, choice: ToolChoice) -> Self
Set the tool choice.
Sourcepub fn web_search_enabled(self, enabled: bool) -> Self
pub fn web_search_enabled(self, enabled: bool) -> Self
Enable or disable web search.
Note: You must first enable the “联网服务插件” (Web Search Plugin)
in the MiMo console before using this feature. If the plugin is not
enabled, setting this to true will result in a 400 error.
Trait Implementations§
Source§impl Clone for ChatRequest
impl Clone for ChatRequest
Source§fn clone(&self) -> ChatRequest
fn clone(&self) -> ChatRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more