optionally specify available bedrock model used in validation

This commit is contained in:
chenhe 2024-03-16 07:44:49 -07:00
parent 1294ce4041
commit 0f94e4cd01
3 changed files with 6 additions and 33 deletions

30
.vscode/launch.json vendored
View File

@ -1,30 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
// set root directory to api/ folder
"cwd": "${workspaceFolder}/api",
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py",
"FLASK_DEBUG": "1",
"GEVENT_SUPPORT": "True"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"--host=0.0.0.0",
"--port=5001"
],
"jinja": true,
"justMyCode": true
}
]
}

View File

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

View File

@ -74,7 +74,8 @@ provider_credential_schema:
label:
en_US: Available Model Name
zh_Hans: 可用模型名称
type: text-input
type: secret-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)