Skip to content

Commit c2f2e3f

Browse files
committed
Add test for unsupported prediction types in MistralModel and fix minor doc typo
1 parent 71e3b82 commit c2f2e3f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pydantic_ai_slim/pydantic_ai/models/mistral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class MistralModelSettings(ModelSettings, total=False):
122122
"""Prediction content for the model to use as a prefix. See Predictive outputs.
123123
124124
This feature is currently only supported for certain Mistral models. See the model cards at Models.
125-
As of now, codestral-latest and mistral-large-2411 support [predicted outputs](https://docs.mistral.ai/capabilities/predicted_outputs).
125+
As of now, codestral-latest and mistral-large-2411 support [predicted outputs](https://docs.mistral.ai/capabilities/predicted_outputs).
126126
"""
127127

128128

tests/models/test_mistral.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,13 @@ def test_map_setting_prediction_valid(request: pytest.FixtureRequest, input_valu
17191719
assert isinstance(result, MistralPrediction)
17201720
assert result.content == expected_content
17211721

1722+
def test_map_setting_prediction_unsupported_type():
1723+
"""Test that _map_setting_prediction raises RuntimeError for unsupported types."""
1724+
with pytest.raises(
1725+
RuntimeError, match='Unsupported prediction type.*int.*Expected str, dict, or MistralPrediction'
1726+
):
1727+
MistralModel._map_setting_prediction(123) # pyright: ignore[reportPrivateUsage]
1728+
17221729

17231730
def test_generate_user_output_format_complex(mistral_api_key: str):
17241731
"""

0 commit comments

Comments
 (0)