defaults.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. from core.model_runtime.entities.model_entities import DefaultParameterName
  2. PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = {
  3. DefaultParameterName.TEMPERATURE: {
  4. "label": {
  5. "en_US": "Temperature",
  6. "zh_Hans": "温度",
  7. },
  8. "type": "float",
  9. "help": {
  10. "en_US": "Controls randomness. Lower temperature results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive. Higher temperature results in more random completions.",
  11. "zh_Hans": "温度控制随机性。较低的温度会导致较少的随机完成。随着温度接近零,模型将变得确定性和重复性。较高的温度会导致更多的随机完成。",
  12. },
  13. "required": False,
  14. "default": 0.0,
  15. "min": 0.0,
  16. "max": 1.0,
  17. "precision": 2,
  18. },
  19. DefaultParameterName.TOP_P: {
  20. "label": {
  21. "en_US": "Top P",
  22. "zh_Hans": "Top P",
  23. },
  24. "type": "float",
  25. "help": {
  26. "en_US": "Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered.",
  27. "zh_Hans": "通过核心采样控制多样性:0.5表示考虑了一半的所有可能性加权选项。",
  28. },
  29. "required": False,
  30. "default": 1.0,
  31. "min": 0.0,
  32. "max": 1.0,
  33. "precision": 2,
  34. },
  35. DefaultParameterName.TOP_K: {
  36. "label": {
  37. "en_US": "Top K",
  38. "zh_Hans": "Top K",
  39. },
  40. "type": "int",
  41. "help": {
  42. "en_US": "Limits the number of tokens to consider for each step by keeping only the k most likely tokens.",
  43. "zh_Hans": "通过只保留每一步中最可能的 k 个标记来限制要考虑的标记数量。",
  44. },
  45. "required": False,
  46. "default": 50,
  47. "min": 1,
  48. "max": 100,
  49. "precision": 0,
  50. },
  51. DefaultParameterName.PRESENCE_PENALTY: {
  52. "label": {
  53. "en_US": "Presence Penalty",
  54. "zh_Hans": "存在惩罚",
  55. },
  56. "type": "float",
  57. "help": {
  58. "en_US": "Applies a penalty to the log-probability of tokens already in the text.",
  59. "zh_Hans": "对文本中已有的标记的对数概率施加惩罚。",
  60. },
  61. "required": False,
  62. "default": 0.0,
  63. "min": 0.0,
  64. "max": 1.0,
  65. "precision": 2,
  66. },
  67. DefaultParameterName.FREQUENCY_PENALTY: {
  68. "label": {
  69. "en_US": "Frequency Penalty",
  70. "zh_Hans": "频率惩罚",
  71. },
  72. "type": "float",
  73. "help": {
  74. "en_US": "Applies a penalty to the log-probability of tokens that appear in the text.",
  75. "zh_Hans": "对文本中出现的标记的对数概率施加惩罚。",
  76. },
  77. "required": False,
  78. "default": 0.0,
  79. "min": 0.0,
  80. "max": 1.0,
  81. "precision": 2,
  82. },
  83. DefaultParameterName.MAX_TOKENS: {
  84. "label": {
  85. "en_US": "Max Tokens",
  86. "zh_Hans": "最大标记",
  87. },
  88. "type": "int",
  89. "help": {
  90. "en_US": "Specifies the upper limit on the length of generated results. If the generated results are truncated, you can increase this parameter.",
  91. "zh_Hans": "指定生成结果长度的上限。如果生成结果截断,可以调大该参数。",
  92. },
  93. "required": False,
  94. "default": 64,
  95. "min": 1,
  96. "max": 2048,
  97. "precision": 0,
  98. },
  99. DefaultParameterName.RESPONSE_FORMAT: {
  100. "label": {
  101. "en_US": "Response Format",
  102. "zh_Hans": "回复格式",
  103. },
  104. "type": "string",
  105. "help": {
  106. "en_US": "Set a response format, ensure the output from llm is a valid code block as possible, such as JSON, XML, etc.",
  107. "zh_Hans": "设置一个返回格式,确保llm的输出尽可能是有效的代码块,如JSON、XML等",
  108. },
  109. "required": False,
  110. "options": ["JSON", "XML"],
  111. },
  112. DefaultParameterName.JSON_SCHEMA: {
  113. "label": {
  114. "en_US": "JSON Schema",
  115. },
  116. "type": "text",
  117. "help": {
  118. "en_US": "Set a response json schema will ensure LLM to adhere it.",
  119. "zh_Hans": "设置返回的json schema,llm将按照它返回",
  120. },
  121. "required": False,
  122. },
  123. }