feat: Allow users to specify AWS Bedrock validation models (#2857)

This commit is contained in:
Su Yang 2024-03-18 00:44:09 +08:00 committed by GitHub
parent f770232b63
commit 6fd1795d25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

@ -17,10 +17,9 @@ class BedrockProvider(ModelProvider):
""" """
try: try:
model_instance = self.get_model_instance(ModelType.LLM) model_instance = self.get_model_instance(ModelType.LLM)
bedrock_validate_model_name = credentials.get('model_for_validation', 'amazon.titan-text-lite-v1')
# Use `gemini-pro` model for validate,
model_instance.validate_credentials( model_instance.validate_credentials(
model='amazon.titan-text-lite-v1', model=bedrock_validate_model_name,
credentials=credentials credentials=credentials
) )
except CredentialsValidateFailedError as ex: except CredentialsValidateFailedError as ex:

View File

@ -69,3 +69,12 @@ provider_credential_schema:
label: label:
en_US: AWS GovCloud (US-West) en_US: AWS GovCloud (US-West)
zh_Hans: AWS GovCloud (US-West) zh_Hans: AWS GovCloud (US-West)
- variable: model_for_validation
required: false
label:
en_US: Available Model Name
zh_Hans: 可用模型名称
type: text-input
placeholder:
en_US: A model you have access to (e.g. amazon.titan-text-lite-v1) for validation.
zh_Hans: 为了进行验证,请输入一个您可用的模型名称 (例如amazon.titan-text-lite-v1)