(test) azure test passing key as completion param

This commit is contained in:
ishaan-jaff 2023-11-23 16:50:29 -08:00
parent dc17f63d0b
commit f7a5b31b96

View file

@ -573,6 +573,30 @@ def test_completion_hf_model_no_provider():
# pytest.fail(f"Error occurred: {e}")
# test_completion_openai_azure_with_functions()
def test_completion_azure_key_completion_arg():
# this tests if we can pass api_key to completion, when it's not in the env
# DO NOT REMOVE THIS TEST. No MATTER WHAT Happens.
# If you want to remove it, speak to Ishaan!
# Ishaan will be very disappointed if this test is removed -> this is a standard way to pass api_key + the router + proxy use this
old_key = os.environ["AZURE_API_KEY"]
os.environ.pop("AZURE_API_KEY", None)
try:
print("azure gpt-3.5 test\n\n")
litellm.set_verbose=True
## Test azure call
response = completion(
model="azure/chatgpt-v-2",
messages=messages,
api_key=old_key,
max_tokens=10,
)
print(f"response: {response}")
print(response)
os.environ["AZURE_API_KEY"] = old_key
except Exception as e:
os.environ["AZURE_API_KEY"] = old_key
pytest.fail(f"Error occurred: {e}")
test_completion_azure_key_completion_arg()
def test_completion_azure():
try: