Add unit test for bedrock httpx oidc auth.

This commit is contained in:
David Manouchehri 2024-05-16 19:21:40 +00:00
parent 0ed01f430d
commit 08ee4519b6
No known key found for this signature in database

View file

@ -238,6 +238,33 @@ def test_completion_bedrock_claude_sts_oidc_auth():
except Exception as e:
pytest.fail(f"Error occurred: {e}")
def test_completion_bedrock_httpx_command_r_sts_oidc_auth():
print("\ncalling bedrock httpx command r with oidc auth")
import os
aws_web_identity_token = "oidc/circleci_v2/"
aws_region_name = os.environ["AWS_REGION_NAME"]
aws_role_name = os.environ["AWS_TEMP_ROLE_NAME"]
try:
litellm.set_verbose = True
response = completion(
model="bedrock/cohere.command-r-v1:0",
messages=messages,
max_tokens=10,
temperature=0.1,
aws_region_name=aws_region_name,
aws_web_identity_token=aws_web_identity_token,
aws_role_name=aws_role_name,
aws_session_name="my-test-session",
)
# Add any assertions here to check the response
print(response)
except RateLimitError:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
def test_bedrock_claude_3():
try: