@@ -44,6 +44,7 @@ def __init__(
44
44
* ,
45
45
api_key : str | None = None ,
46
46
mistral_client : Mistral | None = None ,
47
+ base_url : str | None = None ,
47
48
http_client : AsyncHTTPClient | None = None ,
48
49
) -> None :
49
50
"""Create a new Mistral provider.
@@ -52,11 +53,13 @@ def __init__(
52
53
api_key: The API key to use for authentication, if not provided, the `MISTRAL_API_KEY` environment variable
53
54
will be used if available.
54
55
mistral_client: An existing `Mistral` client to use, if provided, `api_key` and `http_client` must be `None`.
56
+ base_url: The base url for the Mistral requests.
55
57
http_client: An existing async client to use for making HTTP requests.
56
58
"""
57
59
if mistral_client is not None :
58
60
assert http_client is None , 'Cannot provide both `mistral_client` and `http_client`'
59
61
assert api_key is None , 'Cannot provide both `mistral_client` and `api_key`'
62
+ assert base_url is None , 'Cannot provide both `mistral_client` and `base_url`'
60
63
self ._client = mistral_client
61
64
else :
62
65
api_key = api_key or os .environ .get ('MISTRAL_API_KEY' )
@@ -67,7 +70,7 @@ def __init__(
67
70
'to use the Mistral provider.'
68
71
)
69
72
elif http_client is not None :
70
- self ._client = Mistral (api_key = api_key , async_client = http_client )
73
+ self ._client = Mistral (api_key = api_key , async_client = http_client , server_url = base_url )
71
74
else :
72
75
http_client = cached_async_http_client (provider = 'mistral' )
73
- self ._client = Mistral (api_key = api_key , async_client = http_client )
76
+ self ._client = Mistral (api_key = api_key , async_client = http_client , server_url = base_url )
0 commit comments