mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 10:14:26 +00:00
(test) azure test passing key as completion param
This commit is contained in:
parent
dc17f63d0b
commit
f7a5b31b96
1 changed files with 24 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue