fix(utils.py): allow dynamically setting boto3 init and switching between bedrock and openai

This commit is contained in:
Krrish Dholakia 2024-01-17 15:56:30 -08:00
parent 9b38ce8447
commit 7ed4d9b4d1
2 changed files with 14 additions and 0 deletions

View file

@ -185,6 +185,16 @@ def test_completion_bedrock_claude_sts_client_auth():
aws_role_name=aws_role_name, aws_role_name=aws_role_name,
aws_session_name="my-test-session", aws_session_name="my-test-session",
) )
response = completion(
model="gpt-3.5-turbo",
messages=messages,
aws_region_name="us-east-1",
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_role_name=aws_role_name,
aws_session_name="my-test-session",
)
# Add any assertions here to check the response # Add any assertions here to check the response
print(response) print(response)
except RateLimitError: except RateLimitError:

View file

@ -3197,6 +3197,10 @@ def get_optional_params(
passed_params = locals() passed_params = locals()
special_params = passed_params.pop("kwargs") special_params = passed_params.pop("kwargs")
for k, v in special_params.items(): for k, v in special_params.items():
if k.startswith("aws_") and (
custom_llm_provider != "bedrock" or custom_llm_provider != "sagemaker"
): # allow dynamically setting boto3 init logic
continue
passed_params[k] = v passed_params[k] = v
default_params = { default_params = {
"functions": None, "functions": None,