You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ChatRequestSettings.cs 2.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using Microsoft.SemanticKernel.AI;
  2. namespace LLamaSharp.SemanticKernel.ChatCompletion;
  3. public class ChatRequestSettings : AIRequestSettings
  4. {
  5. /// <summary>
  6. /// Temperature controls the randomness of the completion.
  7. /// The higher the temperature, the more random the completion.
  8. /// </summary>
  9. public double Temperature { get; set; } = 0;
  10. /// <summary>
  11. /// TopP controls the diversity of the completion.
  12. /// The higher the TopP, the more diverse the completion.
  13. /// </summary>
  14. public double TopP { get; set; } = 0;
  15. /// <summary>
  16. /// Number between -2.0 and 2.0. Positive values penalize new tokens
  17. /// based on whether they appear in the text so far, increasing the
  18. /// model's likelihood to talk about new topics.
  19. /// </summary>
  20. public double PresencePenalty { get; set; } = 0;
  21. /// <summary>
  22. /// Number between -2.0 and 2.0. Positive values penalize new tokens
  23. /// based on their existing frequency in the text so far, decreasing
  24. /// the model's likelihood to repeat the same line verbatim.
  25. /// </summary>
  26. public double FrequencyPenalty { get; set; } = 0;
  27. /// <summary>
  28. /// Sequences where the completion will stop generating further tokens.
  29. /// </summary>
  30. public IList<string> StopSequences { get; set; } = Array.Empty<string>();
  31. /// <summary>
  32. /// How many completions to generate for each prompt. Default is 1.
  33. /// Note: Because this parameter generates many completions, it can quickly consume your token quota.
  34. /// Use carefully and ensure that you have reasonable settings for max_tokens and stop.
  35. /// </summary>
  36. public int ResultsPerPrompt { get; set; } = 1;
  37. /// <summary>
  38. /// The maximum number of tokens to generate in the completion.
  39. /// </summary>
  40. public int? MaxTokens { get; set; }
  41. /// <summary>
  42. /// Modify the likelihood of specified tokens appearing in the completion.
  43. /// </summary>
  44. public IDictionary<int, int> TokenSelectionBiases { get; set; } = new Dictionary<int, int>();
  45. }