You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use [Mistral](https://mistral.ai) through their API, go to [console.mistral.ai/api-keys/](https://console.mistral.ai/api-keys/) and follow your nose until you find the place to generate an API key.
509
509
510
-
[`MistralModelName`][pydantic_ai.models.mistral.MistralModelName] contains a list of the most popular Mistral models.
510
+
[`LatestMistralModelNames`][pydantic_ai.models.mistral.LatestMistralModelNames] contains a list of the most popular Mistral models.
511
511
512
512
### Environment variable
513
513
@@ -537,15 +537,37 @@ agent = Agent(model)
537
537
...
538
538
```
539
539
540
-
### `api_key` argument
540
+
### `provider` argument
541
+
542
+
You can provide a custom [`Provider`][pydantic_ai.providers.Provider] via the
If you don't want to or can't set the environment variable, you can pass it at runtime via the [`api_key` argument][pydantic_ai.models.mistral.MistralModel.__init__]:
557
+
You can also customize the provider with a custom `httpx.AsyncHTTPClient`:
558
+
559
+
```python {title="groq_model_custom_provider.py"}
560
+
from httpx import AsyncClient
543
561
544
-
```python {title="mistral_model_api_key.py"}
545
562
from pydantic_ai import Agent
546
563
from pydantic_ai.models.mistral import MistralModel
564
+
from pydantic_ai.providers.mistral import MistralProvider
547
565
548
-
model = MistralModel('mistral-small-latest', api_key='your-api-key')
0 commit comments