Feat/json mode (#2563)

This commit is contained in:
Yeuoly
2024-02-26 23:34:40 +08:00
committed by GitHub
parent 0620fa3094
commit 3e63abd335
31 changed files with 762 additions and 31 deletions

View File

@@ -81,5 +81,18 @@ PARAMETER_RULE_TEMPLATE: dict[DefaultParameterName, dict] = {
'min': 1,
'max': 2048,
'precision': 0,
},
DefaultParameterName.RESPONSE_FORMAT: {
'label': {
'en_US': 'Response Format',
'zh_Hans': '回复格式',
},
'type': 'string',
'help': {
'en_US': 'Set a response format, ensure the output from llm is a valid code block as possible, such as JSON, XML, etc.',
'zh_Hans': '设置一个返回格式确保llm的输出尽可能是有效的代码块如JSON、XML等',
},
'required': False,
'options': ['JSON', 'XML'],
}
}

View File

@@ -91,6 +91,7 @@ class DefaultParameterName(Enum):
PRESENCE_PENALTY = "presence_penalty"
FREQUENCY_PENALTY = "frequency_penalty"
MAX_TOKENS = "max_tokens"
RESPONSE_FORMAT = "response_format"
@classmethod
def value_of(cls, value: Any) -> 'DefaultParameterName':