Skip to content

Commit 2f38c36

Browse files
test(test_azure_openai.py): ensure azure openai max retries always respected
1 parent be4c56a commit 2f38c36

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/llm_translation/test_azure_openai.py

+34
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,37 @@ async def test_azure_instruct(
529529
]
530530
== max_retries
531531
)
532+
533+
534+
@pytest.mark.parametrize("max_retries", [0, 4])
535+
@pytest.mark.parametrize("stream", [True, False])
536+
@pytest.mark.parametrize("sync_mode", [True, False])
537+
@patch("litellm.llms.azure.azure.select_azure_base_url_or_endpoint")
538+
@pytest.mark.asyncio
539+
async def test_azure_embedding_max_retries_0(
540+
mock_select_azure_base_url_or_endpoint, max_retries, stream, sync_mode
541+
):
542+
from litellm import aembedding, embedding
543+
544+
args = {
545+
"model": "azure/azure-embedding-model",
546+
"input": "Hello world",
547+
"max_retries": max_retries,
548+
"stream": stream,
549+
}
550+
551+
try:
552+
if sync_mode:
553+
embedding(**args)
554+
else:
555+
await aembedding(**args)
556+
except Exception as e:
557+
print(e)
558+
559+
mock_select_azure_base_url_or_endpoint.assert_called_once()
560+
assert (
561+
mock_select_azure_base_url_or_endpoint.call_args.kwargs["azure_client_params"][
562+
"max_retries"
563+
]
564+
== max_retries
565+
)

0 commit comments

Comments
 (0)