pub struct GenerateionConfig {
pub temperature: Option<f32>,
pub top_p: Option<f32>,
pub top_k: Option<u32>,
pub candidate_count: Option<u32>,
pub max_output_tokens: Option<u32>,
pub stop_sequences: Option<Vec<String>>,
}Fields§
§temperature: Option<f32>The temperature is used for sampling during the response generation, which occurs when topP and topK are applied. Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a more deterministic and less open-ended or creative response, while higher temperatures can lead to more diverse or creative results. A temperature of 0 is deterministic: the highest probability response is always selected. Range: 0.0 - 1.0 Default for gemini-1.0-pro: 0.9 Default for gemini-1.0-pro-vision: 0.4
top_p: Option<f32>Top-P changes how the model selects tokens for output. Tokens are selected from the most (see top-K) to least probable until the sum of their probabilities equals the top-P value. For example, if tokens A, B, and C have a probability of 0.3, 0.2, and 0.1 and the top-P value is 0.5, then the model will select either A or B as the next token by using temperature and excludes C as a candidate. Specify a lower value for less random responses and a higher value for more random responses. Range: 0.0 - 1.0 Default: 1.0
top_k: Option<u32>Top-K changes how the model selects tokens for output. A top-K of 1 means the next selected token is the most probable among all tokens in the model’s vocabulary (also called greedy decoding), while a top-K of 3 means that the next token is selected from among the three most probable tokens by using temperature. For each token selection step, the top-K tokens with the highest probabilities are sampled. Then tokens are further filtered based on top-P with the final token selected using temperature sampling. Specify a lower value for less random responses and a higher value for more random responses. Range: 1-40 Default for gemini-1.0-pro-vision: 32 Default for gemini-1.0-pro: none
candidate_count: Option<u32>The number of response variations to return. This value must be 1.
max_output_tokens: Option<u32>Maximum number of tokens that can be generated in the response. A token is approximately four characters. 100 tokens correspond to roughly 60-80 words. Specify a lower value for shorter responses and a higher value for potentially longer responses. Range for gemini-1.0-pro: 1-8192 (default: 8192) Range for gemini-1.0-pro-vision: 1-2048 (default: 2048)
stop_sequences: Option<Vec<String>>Specifies a list of strings that tells the model to stop generating text if one of the strings is encountered in the response. If a string appears multiple times in the response, then the response truncates where it’s first encountered. The strings are case-sensitive. For example, if the following is the returned response when stopSequences isn’t specified: public static string reverse(string myString) Then the returned response with stopSequences set to [“Str”,“reverse”] is: public static string Maximum 5 items in the list.
Trait Implementations§
Source§impl Clone for GenerateionConfig
impl Clone for GenerateionConfig
Source§fn clone(&self) -> GenerateionConfig
fn clone(&self) -> GenerateionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more