Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: update aws bedrock (#3326)

crazywoola7c520b52c16c
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-express-v1.yaml b/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-express-v1.yaml
index 64f992b9133..543c16d5cd5 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-express-v1.yaml
+++ b/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-express-v1.yaml
@@ -2,8 +2,6 @@ model: amazon.titan-text-express-v1
label:
en_US: Titan Text G1 - Express
model_type: llm
-features:
- - agent-thought
model_properties:
mode: chat
context_size: 8192
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-lite-v1.yaml b/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-lite-v1.yaml
index 69b298b5711..2c6151c2390 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-lite-v1.yaml
+++ b/api/core/model_runtime/model_providers/bedrock/llm/amazon.titan-text-lite-v1.yaml
@@ -2,8 +2,6 @@ model: amazon.titan-text-lite-v1
label:
en_US: Titan Text G1 - Lite
model_type: llm
-features:
- - agent-thought
model_properties:
mode: chat
context_size: 4096
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/anthropic.claude-v1.yaml b/api/core/model_runtime/model_providers/bedrock/llm/anthropic.claude-v1.yaml
index cb2271d4017..6a714b1055b 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/anthropic.claude-v1.yaml
+++ b/api/core/model_runtime/model_providers/bedrock/llm/anthropic.claude-v1.yaml
@@ -50,3 +50,4 @@ pricing:
output: '0.024'
unit: '0.001'
currency: USD
+deprecated: true
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-light-text-v14.yaml b/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-light-text-v14.yaml
index 1fad9100585..74500095511 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-light-text-v14.yaml
+++ b/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-light-text-v14.yaml
@@ -22,7 +22,7 @@ parameter_rules:
min: 0
max: 500
default: 0
- - name: max_tokens_to_sample
+ - name: max_tokens
use_template: max_tokens
required: true
default: 4096
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-text-v14.yaml b/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-text-v14.yaml
index ed775afd7a4..6aea5be170c 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-text-v14.yaml
+++ b/api/core/model_runtime/model_providers/bedrock/llm/cohere.command-text-v14.yaml
@@ -8,9 +8,9 @@ model_properties:
parameter_rules:
- name: temperature
use_template: temperature
- - name: top_p
+ - name: p
use_template: top_p
- - name: top_k
+ - name: k
label:
zh_Hans: 取样数量
en_US: Top k
@@ -19,7 +19,7 @@ parameter_rules:
zh_Hans: 仅从每个后续标记的前 K 个选项中采样。
en_US: Only sample from the top K options for each subsequent token.
required: false
- - name: max_tokens_to_sample
+ - name: max_tokens
use_template: max_tokens
required: true
default: 4096
diff --git a/api/core/model_runtime/model_providers/bedrock/llm/llm.py b/api/core/model_runtime/model_providers/bedrock/llm/llm.py
index 3dbbcb9b4ff..0b0959eaa08 100644
--- a/api/core/model_runtime/model_providers/bedrock/llm/llm.py
+++ b/api/core/model_runtime/model_providers/bedrock/llm/llm.py
@@ -503,7 +503,7 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
if model_prefix == "amazon":
payload["textGenerationConfig"] = { **model_parameters }
- payload["textGenerationConfig"]["stopSequences"] = ["User:"] + (stop if stop else [])
+ payload["textGenerationConfig"]["stopSequences"] = ["User:"]
payload["inputText"] = self._convert_messages_to_prompt(prompt_messages, model_prefix)
@@ -513,10 +513,6 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
payload["maxTokens"] = model_parameters.get("maxTokens")
payload["prompt"] = self._convert_messages_to_prompt(prompt_messages, model_prefix)
- # jurassic models only support a single stop sequence
- if stop:
- payload["stopSequences"] = stop[0]
-
if model_parameters.get("presencePenalty"):
payload["presencePenalty"] = {model_parameters.get("presencePenalty")}
if model_parameters.get("frequencyPenalty"):