From 82b923eb1a7eb0d3e97563158df0843f410b3601 Mon Sep 17 00:00:00 2001 From: engchina Date: Tue, 4 Feb 2025 08:43:20 +0800 Subject: [PATCH 1/4] solve issue 13164, support oracle now models --- .../oci/llm/cohere.command-r-16k.yaml | 52 ------------------- .../oci/llm/cohere.command-r-plus.yaml | 52 ------------------- .../oci/llm/meta.llama-3-70b-instruct.yaml | 51 ------------------ 3 files changed, 155 deletions(-) delete mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml delete mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml delete mode 100644 api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml deleted file mode 100644 index eb60cbcd90f5cd..00000000000000 --- a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml +++ /dev/null @@ -1,52 +0,0 @@ -model: cohere.command-r-16k -label: - en_US: cohere.command-r-16k v1.2 -model_type: llm -features: - - multi-tool-call - - agent-thought - - stream-tool-call -model_properties: - mode: chat - context_size: 128000 -parameter_rules: - - name: temperature - use_template: temperature - default: 1 - max: 1.0 - - name: topP - use_template: top_p - default: 0.75 - min: 0 - max: 1 - - name: topK - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 - en_US: Only sample from the top K options for each subsequent token. - required: false - default: 0 - min: 0 - max: 500 - - name: presencePenalty - use_template: presence_penalty - min: 0 - max: 1 - default: 0 - - name: frequencyPenalty - use_template: frequency_penalty - min: 0 - max: 1 - default: 0 - - name: maxTokens - use_template: max_tokens - default: 600 - max: 4000 -pricing: - input: '0.004' - output: '0.004' - unit: '0.0001' - currency: USD diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml deleted file mode 100644 index df31b0d0df355d..00000000000000 --- a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml +++ /dev/null @@ -1,52 +0,0 @@ -model: cohere.command-r-plus -label: - en_US: cohere.command-r-plus v1.2 -model_type: llm -features: - - multi-tool-call - - agent-thought - - stream-tool-call -model_properties: - mode: chat - context_size: 128000 -parameter_rules: - - name: temperature - use_template: temperature - default: 1 - max: 1.0 - - name: topP - use_template: top_p - default: 0.75 - min: 0 - max: 1 - - name: topK - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 - en_US: Only sample from the top K options for each subsequent token. - required: false - default: 0 - min: 0 - max: 500 - - name: presencePenalty - use_template: presence_penalty - min: 0 - max: 1 - default: 0 - - name: frequencyPenalty - use_template: frequency_penalty - min: 0 - max: 1 - default: 0 - - name: maxTokens - use_template: max_tokens - default: 600 - max: 4000 -pricing: - input: '0.0219' - output: '0.0219' - unit: '0.0001' - currency: USD diff --git a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml deleted file mode 100644 index dd5be107c07570..00000000000000 --- a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml +++ /dev/null @@ -1,51 +0,0 @@ -model: meta.llama-3-70b-instruct -label: - zh_Hans: meta.llama-3-70b-instruct - en_US: meta.llama-3-70b-instruct -model_type: llm -features: - - agent-thought -model_properties: - mode: chat - context_size: 131072 -parameter_rules: - - name: temperature - use_template: temperature - default: 1 - max: 2.0 - - name: topP - use_template: top_p - default: 0.75 - min: 0 - max: 1 - - name: topK - label: - zh_Hans: 取样数量 - en_US: Top k - type: int - help: - zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 - en_US: Only sample from the top K options for each subsequent token. - required: false - default: 0 - min: 0 - max: 500 - - name: presencePenalty - use_template: presence_penalty - min: -2 - max: 2 - default: 0 - - name: frequencyPenalty - use_template: frequency_penalty - min: -2 - max: 2 - default: 0 - - name: maxTokens - use_template: max_tokens - default: 600 - max: 8000 -pricing: - input: '0.015' - output: '0.015' - unit: '0.0001' - currency: USD From 286992bd652d134284630d20006c4fe95a8caa41 Mon Sep 17 00:00:00 2001 From: engchina Date: Tue, 4 Feb 2025 08:44:10 +0800 Subject: [PATCH 2/4] solve issue 13164, support oracle now models --- .../oci/llm/cohere.command-r-08-2024.yaml | 52 +++++++++++++++++++ .../llm/cohere.command-r-plus-08-2024.yaml | 52 +++++++++++++++++++ .../model_providers/oci/llm/llm.py | 8 +-- .../oci/llm/meta.llama-3.1-70b-instruct.yaml | 51 ++++++++++++++++++ .../model_runtime/model_providers/oci/oci.py | 4 +- 5 files changed, 161 insertions(+), 6 deletions(-) create mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-08-2024.yaml create mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus-08-2024.yaml create mode 100644 api/core/model_runtime/model_providers/oci/llm/meta.llama-3.1-70b-instruct.yaml diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-08-2024.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-08-2024.yaml new file mode 100644 index 00000000000000..adfd7543b25498 --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-08-2024.yaml @@ -0,0 +1,52 @@ +model: cohere.command-r-08-2024 +label: + en_US: cohere.command-r-08-2024 v1.7 +model_type: llm +features: + - multi-tool-call + - agent-thought + - stream-tool-call +model_properties: + mode: chat + context_size: 128000 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 1.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: 0 + max: 1 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: 0 + max: 1 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 4000 +pricing: + input: '0.0009' + output: '0.0009' + unit: '0.0001' + currency: USD diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus-08-2024.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus-08-2024.yaml new file mode 100644 index 00000000000000..9db0a08496bbb8 --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus-08-2024.yaml @@ -0,0 +1,52 @@ +model: cohere.command-r-plus-08-2024 +label: + en_US: cohere.command-r-plus-08-2024 v1.6 +model_type: llm +features: + - multi-tool-call + - agent-thought + - stream-tool-call +model_properties: + mode: chat + context_size: 128000 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 1.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: 0 + max: 1 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: 0 + max: 1 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 4000 +pricing: + input: '0.0156' + output: '0.0156' + unit: '0.0001' + currency: USD diff --git a/api/core/model_runtime/model_providers/oci/llm/llm.py b/api/core/model_runtime/model_providers/oci/llm/llm.py index 9f676573fc2ece..ad40530222f429 100644 --- a/api/core/model_runtime/model_providers/oci/llm/llm.py +++ b/api/core/model_runtime/model_providers/oci/llm/llm.py @@ -33,7 +33,7 @@ request_template = { "compartmentId": "", - "servingMode": {"modelId": "cohere.command-r-plus", "servingType": "ON_DEMAND"}, + "servingMode": {"modelId": "cohere.command-r-plus-08-2024", "servingType": "ON_DEMAND"}, "chatRequest": { "apiFormat": "COHERE", # "preambleOverride": "You are a helpful assistant.", @@ -60,19 +60,19 @@ class OCILargeLanguageModel(LargeLanguageModel): # https://docs.oracle.com/en-us/iaas/Content/generative-ai/pretrained-models.htm _supported_models = { - "meta.llama-3-70b-instruct": { + "meta.llama-3.1-70b-instruct": { "system": True, "multimodal": False, "tool_call": False, "stream_tool_call": False, }, - "cohere.command-r-16k": { + "cohere.command-r-08-2024": { "system": True, "multimodal": False, "tool_call": True, "stream_tool_call": False, }, - "cohere.command-r-plus": { + "cohere.command-r-plus-08-2024": { "system": True, "multimodal": False, "tool_call": True, diff --git a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3.1-70b-instruct.yaml b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3.1-70b-instruct.yaml new file mode 100644 index 00000000000000..2cf5666f89972e --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3.1-70b-instruct.yaml @@ -0,0 +1,51 @@ +model: meta.llama-3.1-70b-instruct +label: + zh_Hans: meta.llama-3.1-70b-instruct + en_US: meta.llama-3.1-70b-instruct +model_type: llm +features: + - agent-thought +model_properties: + mode: chat + context_size: 131072 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 2.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: -2 + max: 2 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: -2 + max: 2 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 4000 +pricing: + input: '0.0075' + output: '0.0075' + unit: '0.0001' + currency: USD diff --git a/api/core/model_runtime/model_providers/oci/oci.py b/api/core/model_runtime/model_providers/oci/oci.py index e182d2d0439d77..a3321cb9fdd993 100644 --- a/api/core/model_runtime/model_providers/oci/oci.py +++ b/api/core/model_runtime/model_providers/oci/oci.py @@ -19,8 +19,8 @@ def validate_provider_credentials(self, credentials: dict) -> None: try: model_instance = self.get_model_instance(ModelType.LLM) - # Use `cohere.command-r-plus` model for validate, - model_instance.validate_credentials(model="cohere.command-r-plus", credentials=credentials) + # Use `cohere.command-r-plus-08-2024` model for validate, + model_instance.validate_credentials(model="cohere.command-r-plus-08-2024", credentials=credentials) except CredentialsValidateFailedError as ex: raise ex except Exception as ex: From b7a889804287458adcbdbc941e1244d2718723ab Mon Sep 17 00:00:00 2001 From: engchina Date: Tue, 4 Feb 2025 10:08:28 +0800 Subject: [PATCH 3/4] solve issue 13164, support oracle now models --- .../oci/llm/cohere.command-r-16k.yaml | 53 +++++++++++++++++++ .../oci/llm/cohere.command-r-plus.yaml | 53 +++++++++++++++++++ .../oci/llm/meta.llama-3-70b-instruct.yaml | 52 ++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml create mode 100644 api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml create mode 100644 api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml new file mode 100644 index 00000000000000..7eb843b9f43435 --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml @@ -0,0 +1,53 @@ +model: cohere.command-r-16k +label: + en_US: cohere.command-r-16k v1.2 +model_type: llm +features: + - multi-tool-call + - agent-thought + - stream-tool-call +model_properties: + mode: chat + context_size: 128000 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 1.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: 0 + max: 1 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: 0 + max: 1 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 4000 +pricing: + input: '0.004' + output: '0.004' + unit: '0.0001' + currency: USD +deprecated: true \ No newline at end of file diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml new file mode 100644 index 00000000000000..960b1d68077804 --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml @@ -0,0 +1,53 @@ +model: cohere.command-r-plus +label: + en_US: cohere.command-r-plus v1.2 +model_type: llm +features: + - multi-tool-call + - agent-thought + - stream-tool-call +model_properties: + mode: chat + context_size: 128000 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 1.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: 0 + max: 1 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: 0 + max: 1 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 4000 +pricing: + input: '0.0219' + output: '0.0219' + unit: '0.0001' + currency: USD +deprecated: true \ No newline at end of file diff --git a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml new file mode 100644 index 00000000000000..8ccfa672c2736f --- /dev/null +++ b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml @@ -0,0 +1,52 @@ +model: meta.llama-3-70b-instruct +label: + zh_Hans: meta.llama-3-70b-instruct + en_US: meta.llama-3-70b-instruct +model_type: llm +features: + - agent-thought +model_properties: + mode: chat + context_size: 131072 +parameter_rules: + - name: temperature + use_template: temperature + default: 1 + max: 2.0 + - name: topP + use_template: top_p + default: 0.75 + min: 0 + max: 1 + - name: topK + label: + zh_Hans: 取样数量 + en_US: Top k + type: int + help: + zh_Hans: 仅从每个后续标记的前 K 个选项中采样。 + en_US: Only sample from the top K options for each subsequent token. + required: false + default: 0 + min: 0 + max: 500 + - name: presencePenalty + use_template: presence_penalty + min: -2 + max: 2 + default: 0 + - name: frequencyPenalty + use_template: frequency_penalty + min: -2 + max: 2 + default: 0 + - name: maxTokens + use_template: max_tokens + default: 600 + max: 8000 +pricing: + input: '0.015' + output: '0.015' + unit: '0.0001' + currency: USD +deprecated: true \ No newline at end of file From 3ee1e6ca3a0ebfce48fd1e8e24dc69a15a6cd20d Mon Sep 17 00:00:00 2001 From: engchina Date: Wed, 5 Feb 2025 22:57:00 +0800 Subject: [PATCH 4/4] solve issue 13164, support oracle now models --- .../model_providers/oci/llm/cohere.command-r-16k.yaml | 2 +- .../model_providers/oci/llm/cohere.command-r-plus.yaml | 2 +- .../model_providers/oci/llm/meta.llama-3-70b-instruct.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml index 7eb843b9f43435..152c09ce6c9ba5 100644 --- a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-16k.yaml @@ -50,4 +50,4 @@ pricing: output: '0.004' unit: '0.0001' currency: USD -deprecated: true \ No newline at end of file +deprecated: true diff --git a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml index 960b1d68077804..e819fe05d468d2 100644 --- a/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml +++ b/api/core/model_runtime/model_providers/oci/llm/cohere.command-r-plus.yaml @@ -50,4 +50,4 @@ pricing: output: '0.0219' unit: '0.0001' currency: USD -deprecated: true \ No newline at end of file +deprecated: true diff --git a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml index 8ccfa672c2736f..0917fe19a29a4f 100644 --- a/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml +++ b/api/core/model_runtime/model_providers/oci/llm/meta.llama-3-70b-instruct.yaml @@ -49,4 +49,4 @@ pricing: output: '0.015' unit: '0.0001' currency: USD -deprecated: true \ No newline at end of file +deprecated: true