Fix to issue #3295 related to Anthropic bedrock (#3298)

* Fix to consider session token in request

* Formatted

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
This commit is contained in:
Manojkumar Kotakonda 2024-08-09 00:14:17 -03:00 committed by GitHub
parent 1971f85ded
commit fb788c37d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -457,10 +457,13 @@ class OpenAIWrapper:
def _configure_openai_config_for_bedrock(self, config: Dict[str, Any], openai_config: Dict[str, Any]) -> None:
"""Update openai_config with AWS credentials from config."""
required_keys = ["aws_access_key", "aws_secret_key", "aws_region"]
optional_keys = ["aws_session_token"]
for key in required_keys:
if key in config:
openai_config[key] = config[key]
for key in optional_keys:
if key in config:
openai_config[key] = config[key]
def _register_default_client(self, config: Dict[str, Any], openai_config: Dict[str, Any]) -> None:
"""Create a client with the given config to override openai_config,