defaults.py 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. from typing import Dict
  2. from core.model_runtime.entities.model_entities import DefaultParameterName
  3. PARAMETER_RULE_TEMPLATE: Dict[DefaultParameterName, dict] = {
  4. DefaultParameterName.TEMPERATURE: {
  5. 'label': {
  6. 'en_US': 'Temperature',
  7. 'zh_Hans': '温度',
  8. },
  9. 'type': 'float',
  10. 'help': {
  11. '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.',
  12. 'zh_Hans': '温度控制随机性。较低的温度会导致较少的随机完成。随着温度接近零,模型将变得确定性和重复性。较高的温度会导致更多的随机完成。',
  13. },
  14. 'required': False,
  15. 'default': 0.0,
  16. 'min': 0.0,
  17. 'max': 1.0,
  18. 'precision': 2,
  19. },
  20. DefaultParameterName.TOP_P: {
  21. 'label': {
  22. 'en_US': 'Top P',
  23. 'zh_Hans': 'Top P',
  24. },
  25. 'type': 'float',
  26. 'help': {
  27. 'en_US': 'Controls diversity via nucleus sampling: 0.5 means half of all likelihood-weighted options are considered.',
  28. 'zh_Hans': '通过核心采样控制多样性:0.5表示考虑了一半的所有可能性加权选项。',
  29. },
  30. 'required': False,
  31. 'default': 1.0,
  32. 'min': 0.0,
  33. 'max': 1.0,
  34. 'precision': 2,
  35. },
  36. DefaultParameterName.PRESENCE_PENALTY: {
  37. 'label': {
  38. 'en_US': 'Presence Penalty',
  39. 'zh_Hans': '存在惩罚',
  40. },
  41. 'type': 'float',
  42. 'help': {
  43. 'en_US': 'Applies a penalty to the log-probability of tokens already in the text.',
  44. 'zh_Hans': '对文本中已有的标记的对数概率施加惩罚。',
  45. },
  46. 'required': False,
  47. 'default': 0.0,
  48. 'min': 0.0,
  49. 'max': 1.0,
  50. 'precision': 2,
  51. },
  52. DefaultParameterName.FREQUENCY_PENALTY: {
  53. 'label': {
  54. 'en_US': 'Frequency Penalty',
  55. 'zh_Hans': '频率惩罚',
  56. },
  57. 'type': 'float',
  58. 'help': {
  59. 'en_US': 'Applies a penalty to the log-probability of tokens that appear in the text.',
  60. 'zh_Hans': '对文本中出现的标记的对数概率施加惩罚。',
  61. },
  62. 'required': False,
  63. 'default': 0.0,
  64. 'min': 0.0,
  65. 'max': 1.0,
  66. 'precision': 2,
  67. },
  68. DefaultParameterName.MAX_TOKENS: {
  69. 'label': {
  70. 'en_US': 'Max Tokens',
  71. 'zh_Hans': '最大标记',
  72. },
  73. 'type': 'int',
  74. 'help': {
  75. 'en_US': 'The maximum number of tokens to generate. Requests can use up to 2048 tokens shared between prompt and completion.',
  76. 'zh_Hans': '要生成的标记的最大数量。请求可以使用最多2048个标记,这些标记在提示和完成之间共享。',
  77. },
  78. 'required': False,
  79. 'default': 64,
  80. 'min': 1,
  81. 'max': 2048,
  82. 'precision': 0,
  83. }
  84. }