From 0d9c1e53a13157ce1b6c1fe213e6d2bcca639d60 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Fri, 29 Nov 2024 19:00:24 +0800 Subject: [PATCH] fix: add json_schema to PARAMETER_RULE_TEMPLATE --- .../entities/plugin_entities/model_declaration.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/types/entities/plugin_entities/model_declaration.go b/internal/types/entities/plugin_entities/model_declaration.go index d046970..7b6827e 100644 --- a/internal/types/entities/plugin_entities/model_declaration.go +++ b/internal/types/entities/plugin_entities/model_declaration.go @@ -102,6 +102,7 @@ const ( FREQUENCY_PENALTY DefaultParameterName = "frequency_penalty" MAX_TOKENS DefaultParameterName = "max_tokens" RESPONSE_FORMAT DefaultParameterName = "response_format" + JSON_SCHEMA DefaultParameterName = "json_schema" ) var PARAMETER_RULE_TEMPLATE = map[DefaultParameterName]ModelParameterRule{ @@ -222,6 +223,17 @@ var PARAMETER_RULE_TEMPLATE = map[DefaultParameterName]ModelParameterRule{ Required: false, Options: []string{"JSON", "XML"}, }, + JSON_SCHEMA: { + Label: &I18nObject{ + EnUS: "JSON Schema", + }, + Type: parser.ToPtr(PARAMETER_TYPE_STRING), + Help: &I18nObject{ + EnUS: "Set a response json schema will ensure LLM to adhere it.", + ZhHans: "设置返回的json schema,llm将按照它返回", + }, + Required: false, + }, } func (m *ModelParameterRule) TransformTemplate() error {