Files
langchain/libs/partners/mistralai/tests/integration_tests/test_standard.py
Mason Daugherty 4d2efcd756 test(mistralai): stabilize integration tests with rate limiting and retries (#37588)
Mistral integration tests have been flaky against the live API. This
adds a shared, xdist-aware rate limiter and a global retry policy so
transient 429s no longer fail the suite.
2026-05-20 19:49:25 -05:00

33 lines
1.0 KiB
Python

"""Standard LangChain interface tests."""
import pytest
from langchain_core.language_models import BaseChatModel
from langchain_tests.integration_tests import ( # type: ignore[import-not-found]
ChatModelIntegrationTests, # type: ignore[import-not-found]
)
from langchain_mistralai import ChatMistralAI
from tests.integration_tests._rate_limiter import rate_limiter
class TestMistralStandard(ChatModelIntegrationTests):
@property
def chat_model_class(self) -> type[BaseChatModel]:
return ChatMistralAI
@property
def chat_model_params(self) -> dict:
return {
"model": "mistral-large-latest",
"temperature": 0,
"rate_limiter": rate_limiter,
}
@property
def supports_json_mode(self) -> bool:
return True
@pytest.mark.xfail(reason=("MistralAI inconsistently fails to return valid fields"))
def test_structured_output_pydantic_2_v1(self, model: BaseChatModel) -> None:
super().test_structured_output_pydantic_2_v1(model)