mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 15:59:00 +08:00
feat(api/core/model_runtime/entities/defaults.py): Add TOP_K in default parameters. (#8167)
This commit is contained in:
parent
0695543f63
commit
4313d92e6b
@ -33,6 +33,22 @@ PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = {
|
|||||||
'max': 1.0,
|
'max': 1.0,
|
||||||
'precision': 2,
|
'precision': 2,
|
||||||
},
|
},
|
||||||
|
DefaultParameterName.TOP_K: {
|
||||||
|
'label': {
|
||||||
|
'en_US': 'Top K',
|
||||||
|
'zh_Hans': 'Top K',
|
||||||
|
},
|
||||||
|
'type': 'int',
|
||||||
|
'help': {
|
||||||
|
'en_US': 'Limits the number of tokens to consider for each step by keeping only the k most likely tokens.',
|
||||||
|
'zh_Hans': '通过只保留每一步中最可能的 k 个标记来限制要考虑的标记数量。',
|
||||||
|
},
|
||||||
|
'required': False,
|
||||||
|
'default': 50,
|
||||||
|
'min': 1,
|
||||||
|
'max': 100,
|
||||||
|
'precision': 0,
|
||||||
|
},
|
||||||
DefaultParameterName.PRESENCE_PENALTY: {
|
DefaultParameterName.PRESENCE_PENALTY: {
|
||||||
'label': {
|
'label': {
|
||||||
'en_US': 'Presence Penalty',
|
'en_US': 'Presence Penalty',
|
||||||
|
@ -85,12 +85,13 @@ class ModelFeature(Enum):
|
|||||||
STREAM_TOOL_CALL = "stream-tool-call"
|
STREAM_TOOL_CALL = "stream-tool-call"
|
||||||
|
|
||||||
|
|
||||||
class DefaultParameterName(Enum):
|
class DefaultParameterName(str, Enum):
|
||||||
"""
|
"""
|
||||||
Enum class for parameter template variable.
|
Enum class for parameter template variable.
|
||||||
"""
|
"""
|
||||||
TEMPERATURE = "temperature"
|
TEMPERATURE = "temperature"
|
||||||
TOP_P = "top_p"
|
TOP_P = "top_p"
|
||||||
|
TOP_K = "top_k"
|
||||||
PRESENCE_PENALTY = "presence_penalty"
|
PRESENCE_PENALTY = "presence_penalty"
|
||||||
FREQUENCY_PENALTY = "frequency_penalty"
|
FREQUENCY_PENALTY = "frequency_penalty"
|
||||||
MAX_TOKENS = "max_tokens"
|
MAX_TOKENS = "max_tokens"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user