feat(mistralai): remove tenacity retries for embeddings (#33491)

This commit is contained in:
noeliecherrier
2025-10-21 18:35:10 +02:00
committed by GitHub
parent 2222470f69
commit 9f470d297f
2 changed files with 34 additions and 18 deletions

View File

@@ -35,7 +35,7 @@ async def test_mistralai_embedding_documents_async() -> None:
assert len(output[0]) == 1024
async def test_mistralai_embedding_documents_http_error_async() -> None:
async def test_mistralai_embedding_documents_tenacity_error_async() -> None:
"""Test MistralAI embeddings for documents."""
documents = ["foo bar", "test document"]
embedding = MistralAIEmbeddings(max_retries=0)
@@ -50,6 +50,21 @@ async def test_mistralai_embedding_documents_http_error_async() -> None:
await embedding.aembed_documents(documents)
async def test_mistralai_embedding_documents_http_error_async() -> None:
"""Test MistralAI embeddings for documents."""
documents = ["foo bar", "test document"]
embedding = MistralAIEmbeddings(max_retries=None)
mock_response = httpx.Response(
status_code=400,
request=httpx.Request("POST", url=embedding.async_client.base_url),
)
with (
patch.object(embedding.async_client, "post", return_value=mock_response),
pytest.raises(httpx.HTTPStatusError),
):
await embedding.aembed_documents(documents)
async def test_mistralai_embedding_query_async() -> None:
"""Test MistralAI embeddings for query."""
document = "foo bar"