mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
feat: allow to use IAM Role for Bedrock (#5188)
This commit is contained in:
parent
f87f11e92c
commit
0633aae7dc
|
@ -21,16 +21,16 @@ configurate_methods:
|
|||
provider_credential_schema:
|
||||
credential_form_schemas:
|
||||
- variable: aws_access_key_id
|
||||
required: true
|
||||
required: false
|
||||
label:
|
||||
en_US: Access Key
|
||||
en_US: Access Key (If not provided, credentials are obtained from your running environment. e.g. IAM role)
|
||||
zh_Hans: Access Key
|
||||
type: secret-input
|
||||
placeholder:
|
||||
en_US: Enter your Access Key
|
||||
zh_Hans: 在此输入您的 Access Key
|
||||
- variable: aws_secret_access_key
|
||||
required: true
|
||||
required: false
|
||||
label:
|
||||
en_US: Secret Access Key
|
||||
zh_Hans: Secret Access Key
|
||||
|
|
|
@ -95,8 +95,8 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
|
|||
# - https://docs.anthropic.com/claude/reference/claude-on-amazon-bedrock
|
||||
# - https://github.com/anthropics/anthropic-sdk-python
|
||||
client = AnthropicBedrock(
|
||||
aws_access_key=credentials["aws_access_key_id"],
|
||||
aws_secret_key=credentials["aws_secret_access_key"],
|
||||
aws_access_key=credentials.get("aws_access_key_id", None),
|
||||
aws_secret_key=credentials.get("aws_secret_access_key", None),
|
||||
aws_region=credentials["aws_region"],
|
||||
)
|
||||
|
||||
|
@ -568,8 +568,8 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
|
|||
runtime_client = boto3.client(
|
||||
service_name='bedrock-runtime',
|
||||
config=client_config,
|
||||
aws_access_key_id=credentials["aws_access_key_id"],
|
||||
aws_secret_access_key=credentials["aws_secret_access_key"]
|
||||
aws_access_key_id=credentials.get("aws_access_key_id", None),
|
||||
aws_secret_access_key=credentials.get("aws_secret_access_key", None)
|
||||
)
|
||||
|
||||
model_prefix = model.split('.')[0]
|
||||
|
@ -826,4 +826,4 @@ class BedrockLargeLanguageModel(LargeLanguageModel):
|
|||
elif error_code == "ModelStreamErrorException":
|
||||
return InvokeConnectionError(error_msg)
|
||||
|
||||
return InvokeError(error_msg)
|
||||
return InvokeError(error_msg)
|
||||
|
|
|
@ -205,7 +205,7 @@ const ModelModal: FC<ModelModalProps> = ({
|
|||
const encodeSecretValues = useCallback((v: FormValue) => {
|
||||
const result = { ...v }
|
||||
extendedSecretFormSchemas.forEach(({ variable }) => {
|
||||
if (result[variable] === formSchemasValue?.[variable])
|
||||
if (result[variable] === formSchemasValue?.[variable] && result[variable] !== undefined)
|
||||
result[variable] = '[__HIDDEN__]'
|
||||
})
|
||||
return result
|
||||
|
|
Loading…
Reference in New Issue
Block a user