trieve_client/models/
llm_options.rs

1/*
2 * Trieve API
3 *
4 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5 *
6 * The version of the OpenAPI document: 0.11.7
7 * Contact: developers@trieve.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// LlmOptions : LLM options to use for the completion. If not specified, this defaults to the dataset's LLM options.
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct LlmOptions {
16    /// Completion first decides whether the stream should contain the stream of the completion response or the chunks first. Default is false. Keep in mind that || is used to separate the chunks from the completion response. If || is in the completion then you may want to split on ||{ instead.
17    #[serde(rename = "completion_first", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
18    pub completion_first: Option<Option<bool>>,
19    /// Frequency penalty is a number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. Default is 0.7.
20    #[serde(rename = "frequency_penalty", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
21    pub frequency_penalty: Option<Option<f32>>,
22    /// The maximum number of tokens to generate in the chat completion. Default is None.
23    #[serde(rename = "max_tokens", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
24    pub max_tokens: Option<Option<i32>>,
25    /// Presence penalty is a number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. Default is 0.7.
26    #[serde(rename = "presence_penalty", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
27    pub presence_penalty: Option<Option<f32>>,
28    /// Stop tokens are up to 4 sequences where the API will stop generating further tokens. Default is None.
29    #[serde(rename = "stop_tokens", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
30    pub stop_tokens: Option<Option<Vec<String>>>,
31    /// Whether or not to stream the response. If this is set to true or not included, the response will be a stream. If this is set to false, the response will be a normal JSON response. Default is true.
32    #[serde(rename = "stream_response", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
33    pub stream_response: Option<Option<bool>>,
34    /// Optionally, override the system prompt in dataset server settings.
35    #[serde(rename = "system_prompt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub system_prompt: Option<Option<String>>,
37    /// 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. Default is 0.5.
38    #[serde(rename = "temperature", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub temperature: Option<Option<f32>>,
40}
41
42impl LlmOptions {
43    /// LLM options to use for the completion. If not specified, this defaults to the dataset's LLM options.
44    pub fn new() -> LlmOptions {
45        LlmOptions {
46            completion_first: None,
47            frequency_penalty: None,
48            max_tokens: None,
49            presence_penalty: None,
50            stop_tokens: None,
51            stream_response: None,
52            system_prompt: None,
53            temperature: None,
54        }
55    }
56}
57