Skip to main content

mistral_openapi_client/models/
agents_completion_request.rs

1/*
2 * Mistral AI API
3 *
4 * Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AgentsCompletionRequest {
16    #[serde(rename = "max_tokens", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub max_tokens: Option<Option<i32>>,
18    /// Whether to stream back partial progress. If set, tokens will be sent as data-only server-side events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
19    #[serde(rename = "stream", skip_serializing_if = "Option::is_none")]
20    pub stream: Option<bool>,
21    #[serde(rename = "stop", skip_serializing_if = "Option::is_none")]
22    pub stop: Option<Box<models::Stop>>,
23    #[serde(rename = "random_seed", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub random_seed: Option<Option<i32>>,
25    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub metadata: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
27    /// The prompt(s) to generate completions for, encoded as a list of dict with role and content.
28    #[serde(rename = "messages")]
29    pub messages: Vec<models::MessagesInner>,
30    #[serde(rename = "response_format", skip_serializing_if = "Option::is_none")]
31    pub response_format: Option<Box<models::ResponseFormat>>,
32    #[serde(rename = "tools", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub tools: Option<Option<Vec<models::Tool>>>,
34    #[serde(rename = "tool_choice", skip_serializing_if = "Option::is_none")]
35    pub tool_choice: Option<Box<models::ToolChoice1>>,
36    /// The `presence_penalty` determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative.
37    #[serde(rename = "presence_penalty", skip_serializing_if = "Option::is_none")]
38    pub presence_penalty: Option<f64>,
39    /// The `frequency_penalty` penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition.
40    #[serde(rename = "frequency_penalty", skip_serializing_if = "Option::is_none")]
41    pub frequency_penalty: Option<f64>,
42    #[serde(rename = "n", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub n: Option<Option<i32>>,
44    /// Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results.
45    #[serde(rename = "prediction", skip_serializing_if = "Option::is_none")]
46    pub prediction: Option<Box<models::Prediction>>,
47    #[serde(rename = "parallel_tool_calls", skip_serializing_if = "Option::is_none")]
48    pub parallel_tool_calls: Option<bool>,
49    #[serde(rename = "prompt_mode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
50    pub prompt_mode: Option<Option<models::MistralPromptMode>>,
51    /// The ID of the agent to use for this completion.
52    #[serde(rename = "agent_id")]
53    pub agent_id: String,
54}
55
56impl AgentsCompletionRequest {
57    pub fn new(messages: Vec<models::MessagesInner>, agent_id: String) -> AgentsCompletionRequest {
58        AgentsCompletionRequest {
59            max_tokens: None,
60            stream: None,
61            stop: None,
62            random_seed: None,
63            metadata: None,
64            messages,
65            response_format: None,
66            tools: None,
67            tool_choice: None,
68            presence_penalty: None,
69            frequency_penalty: None,
70            n: None,
71            prediction: None,
72            parallel_tool_calls: None,
73            prompt_mode: None,
74            agent_id,
75        }
76    }
77}
78