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