Skip to main content

mistral_openapi_client/models/
fim_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 FimCompletionRequest {
16    /// ID of the model with FIM to use.
17    #[serde(rename = "model")]
18    pub model: String,
19    #[serde(rename = "temperature", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub temperature: Option<Option<f64>>,
21    /// Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
22    #[serde(rename = "top_p", skip_serializing_if = "Option::is_none")]
23    pub top_p: Option<f64>,
24    #[serde(rename = "max_tokens", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub max_tokens: Option<Option<i32>>,
26    /// 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.
27    #[serde(rename = "stream", skip_serializing_if = "Option::is_none")]
28    pub stream: Option<bool>,
29    #[serde(rename = "stop", skip_serializing_if = "Option::is_none")]
30    pub stop: Option<Box<models::Stop>>,
31    #[serde(rename = "random_seed", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
32    pub random_seed: Option<Option<i32>>,
33    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub metadata: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
35    /// The text/code to complete.
36    #[serde(rename = "prompt")]
37    pub prompt: String,
38    #[serde(rename = "suffix", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub suffix: Option<Option<String>>,
40    #[serde(rename = "min_tokens", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
41    pub min_tokens: Option<Option<i32>>,
42}
43
44impl FimCompletionRequest {
45    pub fn new(model: String, prompt: String) -> FimCompletionRequest {
46        FimCompletionRequest {
47            model,
48            temperature: None,
49            top_p: None,
50            max_tokens: None,
51            stream: None,
52            stop: None,
53            random_seed: None,
54            metadata: None,
55            prompt,
56            suffix: None,
57            min_tokens: None,
58        }
59    }
60}
61