defaults.py 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.PRESENCE_PENALTY: {
  36. 'label': {
  37. 'en_US': 'Presence Penalty',
  38. 'zh_Hans': '存在惩罚',
  39. },
  40. 'type': 'float',
  41. 'help': {
  42. 'en_US': 'Applies a penalty to the log-probability of tokens already in the text.',
  43. 'zh_Hans': '对文本中已有的标记的对数概率施加惩罚。',
  44. },
  45. 'required': False,
  46. 'default': 0.0,
  47. 'min': 0.0,
  48. 'max': 1.0,
  49. 'precision': 2,
  50. },
  51. DefaultParameterName.FREQUENCY_PENALTY: {
  52. 'label': {
  53. 'en_US': 'Frequency Penalty',
  54. 'zh_Hans': '频率惩罚',
  55. },
  56. 'type': 'float',
  57. 'help': {
  58. 'en_US': 'Applies a penalty to the log-probability of tokens that appear 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.MAX_TOKENS: {
  68. 'label': {
  69. 'en_US': 'Max Tokens',
  70. 'zh_Hans': '最大标记',
  71. },
  72. 'type': 'int',
  73. 'help': {
  74. 'en_US': 'The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion.',
  75. 'zh_Hans': '要生成的标记的最大数量。请求可以使用最多2048个标记,这些标记在提示和完成之间共享。',
  76. },
  77. 'required': False,
  78. 'default': 64,
  79. 'min': 1,
  80. 'max': 2048,
  81. 'precision': 0,
  82. },
  83. DefaultParameterName.RESPONSE_FORMAT: {
  84. 'label': {
  85. 'en_US': 'Response Format',
  86. 'zh_Hans': '回复格式',
  87. },
  88. 'type': 'string',
  89. 'help': {
  90. 'en_US': 'Set a response format, ensure the output from llm is a valid code block as possible, such as JSON, XML, etc.',
  91. 'zh_Hans': '设置一个返回格式,确保llm的输出尽可能是有效的代码块,如JSON、XML等',
  92. },
  93. 'required': False,
  94. 'options': ['JSON', 'XML'],
  95. }
  96. }