From 68ac433218baa194f00e4ccde320f61710d09f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=86=E8=90=8C=E9=97=B7=E6=B2=B9=E7=93=B6?= <253605712@qq.com> Date: Fri, 28 Jun 2024 17:39:11 +0800 Subject: [PATCH] feat: add support Spark4.0 (#5688) --- .../model_providers/spark/llm/_client.py | 4 +++ .../model_providers/spark/llm/_position.yaml | 1 + .../model_providers/spark/llm/spark-1.5.yaml | 2 +- .../model_providers/spark/llm/spark-2.yaml | 2 +- .../model_providers/spark/llm/spark-3.5.yaml | 2 +- .../model_providers/spark/llm/spark-3.yaml | 2 +- .../model_providers/spark/llm/spark-4.yaml | 33 +++++++++++++++++++ 7 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 api/core/model_runtime/model_providers/spark/llm/spark-4.yaml diff --git a/api/core/model_runtime/model_providers/spark/llm/_client.py b/api/core/model_runtime/model_providers/spark/llm/_client.py index 4c8790141d..10da265701 100644 --- a/api/core/model_runtime/model_providers/spark/llm/_client.py +++ b/api/core/model_runtime/model_providers/spark/llm/_client.py @@ -38,6 +38,10 @@ class SparkLLMClient: 'spark-3.5': { 'version': 'v3.5', 'chat_domain': 'generalv3.5' + }, + 'spark-4': { + 'version': 'v4.0', + 'chat_domain': '4.0Ultra' } } diff --git a/api/core/model_runtime/model_providers/spark/llm/_position.yaml b/api/core/model_runtime/model_providers/spark/llm/_position.yaml index 64c2db77ce..e49ee97db7 100644 --- a/api/core/model_runtime/model_providers/spark/llm/_position.yaml +++ b/api/core/model_runtime/model_providers/spark/llm/_position.yaml @@ -1,3 +1,4 @@ +- spark-4 - spark-3.5 - spark-3 - spark-1.5 diff --git a/api/core/model_runtime/model_providers/spark/llm/spark-1.5.yaml b/api/core/model_runtime/model_providers/spark/llm/spark-1.5.yaml index effbe45e27..41b8765fe6 100644 --- a/api/core/model_runtime/model_providers/spark/llm/spark-1.5.yaml +++ b/api/core/model_runtime/model_providers/spark/llm/spark-1.5.yaml @@ -28,6 +28,6 @@ parameter_rules: min: 1 max: 6 help: - zh_Hans: 从 k 个候选中随机选择⼀个(⾮等概率)。 + zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 en_US: Randomly select one from k candidates (non-equal probability). required: false diff --git a/api/core/model_runtime/model_providers/spark/llm/spark-2.yaml b/api/core/model_runtime/model_providers/spark/llm/spark-2.yaml index 2afd1fc538..2db6805a2e 100644 --- a/api/core/model_runtime/model_providers/spark/llm/spark-2.yaml +++ b/api/core/model_runtime/model_providers/spark/llm/spark-2.yaml @@ -29,6 +29,6 @@ parameter_rules: min: 1 max: 6 help: - zh_Hans: 从 k 个候选中随机选择⼀个(⾮等概率)。 + zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 en_US: Randomly select one from k candidates (non-equal probability). required: false diff --git a/api/core/model_runtime/model_providers/spark/llm/spark-3.5.yaml b/api/core/model_runtime/model_providers/spark/llm/spark-3.5.yaml index 650eff5d98..6d24932ea8 100644 --- a/api/core/model_runtime/model_providers/spark/llm/spark-3.5.yaml +++ b/api/core/model_runtime/model_providers/spark/llm/spark-3.5.yaml @@ -28,6 +28,6 @@ parameter_rules: min: 1 max: 6 help: - zh_Hans: 从 k 个候选中随机选择⼀个(⾮等概率)。 + zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 en_US: Randomly select one from k candidates (non-equal probability). required: false diff --git a/api/core/model_runtime/model_providers/spark/llm/spark-3.yaml b/api/core/model_runtime/model_providers/spark/llm/spark-3.yaml index dc0f66f670..2ef9e10f45 100644 --- a/api/core/model_runtime/model_providers/spark/llm/spark-3.yaml +++ b/api/core/model_runtime/model_providers/spark/llm/spark-3.yaml @@ -28,6 +28,6 @@ parameter_rules: min: 1 max: 6 help: - zh_Hans: 从 k 个候选中随机选择⼀个(⾮等概率)。 + zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 en_US: Randomly select one from k candidates (non-equal probability). required: false diff --git a/api/core/model_runtime/model_providers/spark/llm/spark-4.yaml b/api/core/model_runtime/model_providers/spark/llm/spark-4.yaml new file mode 100644 index 0000000000..4b0bf27029 --- /dev/null +++ b/api/core/model_runtime/model_providers/spark/llm/spark-4.yaml @@ -0,0 +1,33 @@ +model: spark-4 +label: + en_US: Spark V4.0 +model_type: llm +model_properties: + mode: chat +parameter_rules: + - name: temperature + use_template: temperature + default: 0.5 + help: + zh_Hans: 核采样阈值。用于决定结果随机性,取值越高随机性越强即相同的问题得到的不同答案的可能性越高。 + en_US: Kernel sampling threshold. Used to determine the randomness of the results. The higher the value, the stronger the randomness, that is, the higher the possibility of getting different answers to the same question. + - name: max_tokens + use_template: max_tokens + default: 4096 + min: 1 + max: 8192 + help: + zh_Hans: 模型回答的tokens的最大长度。 + en_US: 模型回答的tokens的最大长度。 + - name: top_k + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + default: 4 + min: 1 + max: 6 + help: + zh_Hans: 从 k 个候选中随机选择一个(非等概率)。 + en_US: Randomly select one from k candidates (non-equal probability). + required: false