mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-24 18:24:20 +00:00
(test)timeout errors
This commit is contained in:
parent
3059f30672
commit
40e88eec4b
1 changed files with 20 additions and 0 deletions
|
@ -2,6 +2,7 @@ import sys, os
|
|||
import traceback
|
||||
import pytest
|
||||
from dotenv import load_dotenv
|
||||
import openai
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
@ -56,6 +57,25 @@ def test_openai_azure_embedding_simple():
|
|||
|
||||
test_openai_azure_embedding_simple()
|
||||
|
||||
|
||||
def test_openai_azure_embedding_timeouts():
|
||||
try:
|
||||
response = embedding(
|
||||
model="azure/azure-embedding-model",
|
||||
input=["good morning from litellm"],
|
||||
timeout=0.00001
|
||||
)
|
||||
print(response)
|
||||
response_keys = dict(response).keys()
|
||||
assert set(["usage", "model", "object", "data"]) == set(response_keys) #assert litellm response has expected keys from OpenAI embedding response
|
||||
except openai.APITimeoutError:
|
||||
print("Good job got timeout error!")
|
||||
pass
|
||||
except Exception as e:
|
||||
pytest.fail(f"Expected timeout error, did not get the correct error. Instead got {e}")
|
||||
|
||||
# test_openai_azure_embedding_timeouts()
|
||||
|
||||
def test_openai_azure_embedding():
|
||||
try:
|
||||
api_key = os.environ['AZURE_API_KEY']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue