|
| 1 | +using Helpers; |
| 2 | +using Newtonsoft.Json; |
| 3 | + |
| 4 | +namespace Models.Request |
| 5 | +{ |
| 6 | + /// <summary> |
| 7 | + /// Represents configuration parameters for controlling the model's text generation behavior. |
| 8 | + /// Contains settings that affect the creativity, diversity, and length of generated content. |
| 9 | + /// </summary> |
| 10 | + public class GenerationConfig |
| 11 | + { |
| 12 | + /// <summary> |
| 13 | + /// The sampling temperature. |
| 14 | + /// Controls the randomness of the output. Higher values (e.g., 0.8) make the output more random, |
| 15 | + /// while lower values (e.g., 0.2) make it more focused and deterministic. |
| 16 | + /// Default value is 1.0. |
| 17 | + /// </summary> |
| 18 | + [JsonProperty("temperature")] |
| 19 | + public float Temperature { get; set; } = 1; |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// The top-k sampling parameter. |
| 23 | + /// Limits the cumulative probability of tokens considered for generation to the k most likely ones. |
| 24 | + /// Higher values allow more diverse word choices. |
| 25 | + /// Default value is 40. |
| 26 | + /// </summary> |
| 27 | + [JsonProperty("topK")] |
| 28 | + public sbyte TopK { get; set; } = 40; |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// The nucleus sampling parameter. |
| 32 | + /// Limits the cumulative probability of tokens considered for generation. |
| 33 | + /// Higher values (e.g., 0.95) allow more diverse word choices. |
| 34 | + /// Default value is 0.95. |
| 35 | + /// </summary> |
| 36 | + [JsonProperty("topP")] |
| 37 | + public float TopP { get; set; } = 0.95F; |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// The maximum number of tokens in the generated output. |
| 41 | + /// Limits the length of the model's response. |
| 42 | + /// Default value is 8192. |
| 43 | + /// </summary> |
| 44 | + [JsonProperty("maxOutputTokens")] |
| 45 | + public int MaxOutputTokens { get; set; } = 8192; |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// The MIME type of the expected response. |
| 49 | + /// Determines the format of the generated content (e.g., text/plain, text/markdown). |
| 50 | + /// Default value is text/plain. |
| 51 | + /// </summary> |
| 52 | + [JsonProperty("responseMimeType")] |
| 53 | + public string ResponseMimeType { get; set; } = EnumHelper.GetDescription(Enums.ResponseMimeType.PlainText); |
| 54 | + } |
| 55 | +} |
0 commit comments