openai/models/
create_edit_request.rs

1/*
2 * OpenAI API
3 *
4 * APIs for sampling from and fine-tuning language models
5 *
6 * The version of the OpenAPI document: 1.2.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct CreateEditRequest {
16    /// ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint.
17    #[serde(rename = "model")]
18    pub model: String,
19    /// The input text to use as a starting point for the edit.
20    #[serde(rename = "input", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub input: Option<Option<String>>,
22    /// The instruction that tells the model how to edit the prompt.
23    #[serde(rename = "instruction")]
24    pub instruction: String,
25    /// How many edits to generate for the input and instruction.
26    #[serde(rename = "n", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub n: Option<Option<i32>>,
28    /// What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.  We generally recommend altering this or `top_p` but not both. 
29    #[serde(rename = "temperature", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub temperature: Option<Option<f32>>,
31    /// An alternative to sampling with temperature, called 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. 
32    #[serde(rename = "top_p", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub top_p: Option<Option<f32>>,
34}
35
36impl CreateEditRequest {
37    pub fn new(model: String, instruction: String) -> CreateEditRequest {
38        CreateEditRequest {
39            model,
40            input: None,
41            instruction,
42            n: None,
43            temperature: None,
44            top_p: None,
45        }
46    }
47}
48
49