forked from phoenix/litellm-mirror
test(bedrock-testing): commenting out due to api key invalidation by amazon
This commit is contained in:
parent
c34e9d73ff
commit
82d6b1c55f
1 changed files with 129 additions and 129 deletions
|
@ -816,156 +816,156 @@ def test_completion_sagemaker():
|
||||||
|
|
||||||
# test_completion_sagemaker()
|
# test_completion_sagemaker()
|
||||||
|
|
||||||
def test_completion_bedrock_titan():
|
# def test_completion_bedrock_titan():
|
||||||
try:
|
# try:
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="bedrock/amazon.titan-tg1-large",
|
# model="bedrock/amazon.titan-tg1-large",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
temperature=0.2,
|
# temperature=0.2,
|
||||||
max_tokens=200,
|
# max_tokens=200,
|
||||||
top_p=0.8,
|
# top_p=0.8,
|
||||||
logger_fn=logger_fn
|
# logger_fn=logger_fn
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_titan()
|
# test_completion_bedrock_titan()
|
||||||
|
|
||||||
def test_completion_bedrock_claude():
|
# def test_completion_bedrock_claude():
|
||||||
print("calling claude")
|
# print("calling claude")
|
||||||
try:
|
# try:
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="anthropic.claude-instant-v1",
|
# model="anthropic.claude-instant-v1",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
max_tokens=10,
|
# max_tokens=10,
|
||||||
temperature=0.1,
|
# temperature=0.1,
|
||||||
logger_fn=logger_fn
|
# logger_fn=logger_fn
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_claude()
|
# test_completion_bedrock_claude()
|
||||||
|
|
||||||
|
|
||||||
def test_completion_bedrock_claude_completion_auth():
|
# def test_completion_bedrock_claude_completion_auth():
|
||||||
print("calling bedrock claude completion params auth")
|
# print("calling bedrock claude completion params auth")
|
||||||
import os
|
# import os
|
||||||
|
|
||||||
aws_access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
|
# aws_access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
|
||||||
aws_secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
|
# aws_secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
|
||||||
aws_region_name = os.environ["AWS_REGION_NAME"]
|
# aws_region_name = os.environ["AWS_REGION_NAME"]
|
||||||
|
|
||||||
os.environ["AWS_ACCESS_KEY_ID"] = ""
|
# os.environ["AWS_ACCESS_KEY_ID"] = ""
|
||||||
os.environ["AWS_SECRET_ACCESS_KEY"] = ""
|
# os.environ["AWS_SECRET_ACCESS_KEY"] = ""
|
||||||
os.environ["AWS_REGION_NAME"] = ""
|
# os.environ["AWS_REGION_NAME"] = ""
|
||||||
|
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="bedrock/anthropic.claude-instant-v1",
|
# model="bedrock/anthropic.claude-instant-v1",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
max_tokens=10,
|
# max_tokens=10,
|
||||||
temperature=0.1,
|
# temperature=0.1,
|
||||||
logger_fn=logger_fn,
|
# logger_fn=logger_fn,
|
||||||
aws_access_key_id=aws_access_key_id,
|
# aws_access_key_id=aws_access_key_id,
|
||||||
aws_secret_access_key=aws_secret_access_key,
|
# aws_secret_access_key=aws_secret_access_key,
|
||||||
aws_region_name=aws_region_name,
|
# aws_region_name=aws_region_name,
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
|
|
||||||
os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id
|
# os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id
|
||||||
os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key
|
# os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key
|
||||||
os.environ["AWS_REGION_NAME"] = aws_region_name
|
# os.environ["AWS_REGION_NAME"] = aws_region_name
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_claude_completion_auth()
|
# test_completion_bedrock_claude_completion_auth()
|
||||||
|
|
||||||
def test_completion_bedrock_claude_external_client_auth():
|
# def test_completion_bedrock_claude_external_client_auth():
|
||||||
print("calling bedrock claude external client auth")
|
# print("calling bedrock claude external client auth")
|
||||||
import os
|
# import os
|
||||||
|
|
||||||
aws_access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
|
# aws_access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
|
||||||
aws_secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
|
# aws_secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
|
||||||
aws_region_name = os.environ["AWS_REGION_NAME"]
|
# aws_region_name = os.environ["AWS_REGION_NAME"]
|
||||||
|
|
||||||
os.environ["AWS_ACCESS_KEY_ID"] = ""
|
# os.environ["AWS_ACCESS_KEY_ID"] = ""
|
||||||
os.environ["AWS_SECRET_ACCESS_KEY"] = ""
|
# os.environ["AWS_SECRET_ACCESS_KEY"] = ""
|
||||||
os.environ["AWS_REGION_NAME"] = ""
|
# os.environ["AWS_REGION_NAME"] = ""
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
import boto3
|
# import boto3
|
||||||
bedrock = boto3.client(
|
# bedrock = boto3.client(
|
||||||
service_name="bedrock-runtime",
|
# service_name="bedrock-runtime",
|
||||||
region_name=aws_region_name,
|
# region_name=aws_region_name,
|
||||||
aws_access_key_id=aws_access_key_id,
|
# aws_access_key_id=aws_access_key_id,
|
||||||
aws_secret_access_key=aws_secret_access_key,
|
# aws_secret_access_key=aws_secret_access_key,
|
||||||
endpoint_url=f"https://bedrock-runtime.{aws_region_name}.amazonaws.com"
|
# endpoint_url=f"https://bedrock-runtime.{aws_region_name}.amazonaws.com"
|
||||||
)
|
# )
|
||||||
|
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="bedrock/anthropic.claude-instant-v1",
|
# model="bedrock/anthropic.claude-instant-v1",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
max_tokens=10,
|
# max_tokens=10,
|
||||||
temperature=0.1,
|
# temperature=0.1,
|
||||||
logger_fn=logger_fn,
|
# logger_fn=logger_fn,
|
||||||
aws_bedrock_client=bedrock,
|
# aws_bedrock_client=bedrock,
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
|
|
||||||
os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id
|
# os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id
|
||||||
os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key
|
# os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key
|
||||||
os.environ["AWS_REGION_NAME"] = aws_region_name
|
# os.environ["AWS_REGION_NAME"] = aws_region_name
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_claude_external_client_auth()
|
# test_completion_bedrock_claude_external_client_auth()
|
||||||
|
|
||||||
def test_completion_bedrock_claude_stream():
|
# def test_completion_bedrock_claude_stream():
|
||||||
print("calling claude")
|
# print("calling claude")
|
||||||
litellm.set_verbose = False
|
# litellm.set_verbose = False
|
||||||
try:
|
# try:
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="bedrock/anthropic.claude-instant-v1",
|
# model="bedrock/anthropic.claude-instant-v1",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
stream=True
|
# stream=True
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
for chunk in response:
|
# for chunk in response:
|
||||||
print(chunk)
|
# print(chunk)
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
# test_completion_bedrock_claude_stream()
|
# test_completion_bedrock_claude_stream()
|
||||||
|
|
||||||
def test_completion_bedrock_ai21():
|
# def test_completion_bedrock_ai21():
|
||||||
try:
|
# try:
|
||||||
litellm.set_verbose = False
|
# litellm.set_verbose = False
|
||||||
response = completion(
|
# response = completion(
|
||||||
model="bedrock/ai21.j2-mid",
|
# model="bedrock/ai21.j2-mid",
|
||||||
messages=messages,
|
# messages=messages,
|
||||||
temperature=0.2,
|
# temperature=0.2,
|
||||||
top_p=0.2,
|
# top_p=0.2,
|
||||||
max_tokens=20
|
# max_tokens=20
|
||||||
)
|
# )
|
||||||
# Add any assertions here to check the response
|
# # Add any assertions here to check the response
|
||||||
print(response)
|
# print(response)
|
||||||
except RateLimitError:
|
# except RateLimitError:
|
||||||
pass
|
# pass
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
pytest.fail(f"Error occurred: {e}")
|
# pytest.fail(f"Error occurred: {e}")
|
||||||
|
|
||||||
|
|
||||||
######## Test VLLM ########
|
######## Test VLLM ########
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue