mistralai 1.5.1__py3-none-any.whl → 1.5.2rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_hooks/types.py +15 -3
- mistralai/_version.py +3 -3
- mistralai/agents.py +32 -12
- mistralai/basesdk.py +8 -0
- mistralai/chat.py +32 -12
- mistralai/classifiers.py +32 -12
- mistralai/embeddings.py +20 -10
- mistralai/extra/utils/response_format.py +3 -3
- mistralai/files.py +36 -0
- mistralai/fim.py +32 -12
- mistralai/httpclient.py +4 -2
- mistralai/jobs.py +30 -0
- mistralai/mistral_jobs.py +24 -0
- mistralai/models/__init__.py +6 -1
- mistralai/models/documenturlchunk.py +8 -14
- mistralai/models/embeddingrequest.py +7 -7
- mistralai/models/filepurpose.py +1 -1
- mistralai/models_.py +66 -18
- mistralai/ocr.py +16 -6
- mistralai/sdk.py +19 -3
- mistralai/sdkconfiguration.py +4 -2
- mistralai/utils/__init__.py +2 -0
- mistralai/utils/serializers.py +10 -6
- mistralai/utils/values.py +4 -1
- {mistralai-1.5.1.dist-info → mistralai-1.5.2rc1.dist-info}/METADATA +66 -19
- {mistralai-1.5.1.dist-info → mistralai-1.5.2rc1.dist-info}/RECORD +73 -69
- mistralai_azure/__init__.py +10 -1
- mistralai_azure/_hooks/types.py +15 -3
- mistralai_azure/_version.py +3 -0
- mistralai_azure/basesdk.py +8 -0
- mistralai_azure/chat.py +88 -20
- mistralai_azure/httpclient.py +52 -0
- mistralai_azure/models/__init__.py +7 -0
- mistralai_azure/models/assistantmessage.py +2 -0
- mistralai_azure/models/chatcompletionrequest.py +8 -10
- mistralai_azure/models/chatcompletionstreamrequest.py +8 -10
- mistralai_azure/models/function.py +3 -0
- mistralai_azure/models/jsonschema.py +61 -0
- mistralai_azure/models/prediction.py +25 -0
- mistralai_azure/models/responseformat.py +42 -1
- mistralai_azure/models/responseformats.py +1 -1
- mistralai_azure/models/toolcall.py +3 -0
- mistralai_azure/sdk.py +56 -14
- mistralai_azure/sdkconfiguration.py +14 -6
- mistralai_azure/utils/__init__.py +2 -0
- mistralai_azure/utils/serializers.py +10 -6
- mistralai_azure/utils/values.py +4 -1
- mistralai_gcp/__init__.py +10 -1
- mistralai_gcp/_hooks/types.py +15 -3
- mistralai_gcp/_version.py +3 -0
- mistralai_gcp/basesdk.py +8 -0
- mistralai_gcp/chat.py +89 -21
- mistralai_gcp/fim.py +61 -21
- mistralai_gcp/httpclient.py +52 -0
- mistralai_gcp/models/__init__.py +7 -0
- mistralai_gcp/models/assistantmessage.py +2 -0
- mistralai_gcp/models/chatcompletionrequest.py +8 -10
- mistralai_gcp/models/chatcompletionstreamrequest.py +8 -10
- mistralai_gcp/models/fimcompletionrequest.py +2 -3
- mistralai_gcp/models/fimcompletionstreamrequest.py +2 -3
- mistralai_gcp/models/function.py +3 -0
- mistralai_gcp/models/jsonschema.py +61 -0
- mistralai_gcp/models/prediction.py +25 -0
- mistralai_gcp/models/responseformat.py +42 -1
- mistralai_gcp/models/responseformats.py +1 -1
- mistralai_gcp/models/toolcall.py +3 -0
- mistralai_gcp/sdk.py +63 -19
- mistralai_gcp/sdkconfiguration.py +14 -6
- mistralai_gcp/utils/__init__.py +2 -0
- mistralai_gcp/utils/serializers.py +10 -6
- mistralai_gcp/utils/values.py +4 -1
- {mistralai-1.5.1.dist-info → mistralai-1.5.2rc1.dist-info}/LICENSE +0 -0
- {mistralai-1.5.1.dist-info → mistralai-1.5.2rc1.dist-info}/WHEEL +0 -0
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .jsonschema import JSONSchema, JSONSchemaTypedDict
|
|
4
5
|
from .responseformats import ResponseFormats
|
|
5
|
-
from mistralai_azure.types import
|
|
6
|
+
from mistralai_azure.types import (
|
|
7
|
+
BaseModel,
|
|
8
|
+
Nullable,
|
|
9
|
+
OptionalNullable,
|
|
10
|
+
UNSET,
|
|
11
|
+
UNSET_SENTINEL,
|
|
12
|
+
)
|
|
13
|
+
from pydantic import model_serializer
|
|
6
14
|
from typing import Optional
|
|
7
15
|
from typing_extensions import NotRequired, TypedDict
|
|
8
16
|
|
|
@@ -10,8 +18,41 @@ from typing_extensions import NotRequired, TypedDict
|
|
|
10
18
|
class ResponseFormatTypedDict(TypedDict):
|
|
11
19
|
type: NotRequired[ResponseFormats]
|
|
12
20
|
r"""An object specifying the format that the model must output. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message."""
|
|
21
|
+
json_schema: NotRequired[Nullable[JSONSchemaTypedDict]]
|
|
13
22
|
|
|
14
23
|
|
|
15
24
|
class ResponseFormat(BaseModel):
|
|
16
25
|
type: Optional[ResponseFormats] = None
|
|
17
26
|
r"""An object specifying the format that the model must output. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message."""
|
|
27
|
+
|
|
28
|
+
json_schema: OptionalNullable[JSONSchema] = UNSET
|
|
29
|
+
|
|
30
|
+
@model_serializer(mode="wrap")
|
|
31
|
+
def serialize_model(self, handler):
|
|
32
|
+
optional_fields = ["type", "json_schema"]
|
|
33
|
+
nullable_fields = ["json_schema"]
|
|
34
|
+
null_default_fields = []
|
|
35
|
+
|
|
36
|
+
serialized = handler(self)
|
|
37
|
+
|
|
38
|
+
m = {}
|
|
39
|
+
|
|
40
|
+
for n, f in self.model_fields.items():
|
|
41
|
+
k = f.alias or n
|
|
42
|
+
val = serialized.get(k)
|
|
43
|
+
serialized.pop(k, None)
|
|
44
|
+
|
|
45
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
46
|
+
is_set = (
|
|
47
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
+
or k in null_default_fields
|
|
49
|
+
) # pylint: disable=no-member
|
|
50
|
+
|
|
51
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
52
|
+
m[k] = val
|
|
53
|
+
elif val != UNSET_SENTINEL and (
|
|
54
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
55
|
+
):
|
|
56
|
+
m[k] = val
|
|
57
|
+
|
|
58
|
+
return m
|
|
@@ -4,5 +4,5 @@ from __future__ import annotations
|
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
ResponseFormats = Literal["text", "json_object"]
|
|
7
|
+
ResponseFormats = Literal["text", "json_object", "json_schema"]
|
|
8
8
|
r"""An object specifying the format that the model must output. Setting to `{ \"type\": \"json_object\" }` enables JSON mode, which guarantees the message the model generates is in JSON. When using JSON mode you MUST also instruct the model to produce JSON yourself with a system or a user message."""
|
|
@@ -14,6 +14,7 @@ class ToolCallTypedDict(TypedDict):
|
|
|
14
14
|
function: FunctionCallTypedDict
|
|
15
15
|
id: NotRequired[str]
|
|
16
16
|
type: NotRequired[ToolTypes]
|
|
17
|
+
index: NotRequired[int]
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class ToolCall(BaseModel):
|
|
@@ -24,3 +25,5 @@ class ToolCall(BaseModel):
|
|
|
24
25
|
type: Annotated[Optional[ToolTypes], PlainValidator(validate_open_enum(False))] = (
|
|
25
26
|
None
|
|
26
27
|
)
|
|
28
|
+
|
|
29
|
+
index: Optional[int] = 0
|
mistralai_azure/sdk.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
"""Code generated by Speakeasy (https://
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import weakref
|
|
4
|
+
from typing import Any, Callable, Dict, Optional, Union, cast
|
|
4
5
|
|
|
5
6
|
import httpx
|
|
7
|
+
|
|
6
8
|
from mistralai_azure import models, utils
|
|
7
9
|
from mistralai_azure._hooks import SDKHooks
|
|
8
10
|
from mistralai_azure.chat import Chat
|
|
9
|
-
from mistralai_azure.types import
|
|
11
|
+
from mistralai_azure.types import UNSET, OptionalNullable
|
|
10
12
|
|
|
11
13
|
from .basesdk import BaseSDK
|
|
12
|
-
from .httpclient import AsyncHttpClient, HttpClient
|
|
14
|
+
from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients
|
|
13
15
|
from .sdkconfiguration import SDKConfiguration
|
|
14
|
-
from .utils.logger import Logger,
|
|
16
|
+
from .utils.logger import Logger, get_default_logger
|
|
15
17
|
from .utils.retries import RetryConfig
|
|
16
18
|
|
|
17
19
|
|
|
@@ -19,7 +21,7 @@ class MistralAzure(BaseSDK):
|
|
|
19
21
|
r"""Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it."""
|
|
20
22
|
|
|
21
23
|
chat: Chat
|
|
22
|
-
r"""Chat Completion API"""
|
|
24
|
+
r"""Chat Completion API."""
|
|
23
25
|
|
|
24
26
|
def __init__(
|
|
25
27
|
self,
|
|
@@ -28,7 +30,8 @@ class MistralAzure(BaseSDK):
|
|
|
28
30
|
url_params: Optional[Dict[str, str]] = None,
|
|
29
31
|
client: Optional[HttpClient] = None,
|
|
30
32
|
async_client: Optional[AsyncHttpClient] = None,
|
|
31
|
-
retry_config:
|
|
33
|
+
retry_config: OptionalNullable[RetryConfig] = UNSET,
|
|
34
|
+
timeout_ms: Optional[int] = None,
|
|
32
35
|
debug_logger: Optional[Logger] = None,
|
|
33
36
|
) -> None:
|
|
34
37
|
r"""Instantiates the SDK configuring it with the provided parameters.
|
|
@@ -39,7 +42,9 @@ class MistralAzure(BaseSDK):
|
|
|
39
42
|
:param client: The HTTP client to use for all synchronous methods
|
|
40
43
|
:param async_client: The Async HTTP client to use for all asynchronous methods
|
|
41
44
|
:param retry_config: The retry configuration to use for all supported methods
|
|
45
|
+
:param timeout_ms: Optional request timeout applied to each operation in milliseconds
|
|
42
46
|
"""
|
|
47
|
+
|
|
43
48
|
# if azure_endpoint doesn't end with `/v1` add it
|
|
44
49
|
if not azure_endpoint.endswith("/"):
|
|
45
50
|
azure_endpoint += "/"
|
|
@@ -47,28 +52,30 @@ class MistralAzure(BaseSDK):
|
|
|
47
52
|
azure_endpoint += "v1/"
|
|
48
53
|
server_url = azure_endpoint
|
|
49
54
|
|
|
55
|
+
client_supplied = True
|
|
50
56
|
if client is None:
|
|
51
57
|
client = httpx.Client()
|
|
58
|
+
client_supplied = False
|
|
52
59
|
|
|
53
60
|
assert issubclass(
|
|
54
61
|
type(client), HttpClient
|
|
55
62
|
), "The provided client must implement the HttpClient protocol."
|
|
56
63
|
|
|
64
|
+
async_client_supplied = True
|
|
57
65
|
if async_client is None:
|
|
58
66
|
async_client = httpx.AsyncClient()
|
|
67
|
+
async_client_supplied = False
|
|
68
|
+
|
|
69
|
+
if debug_logger is None:
|
|
70
|
+
debug_logger = get_default_logger()
|
|
59
71
|
|
|
60
72
|
assert issubclass(
|
|
61
73
|
type(async_client), AsyncHttpClient
|
|
62
74
|
), "The provided async_client must implement the AsyncHttpClient protocol."
|
|
63
75
|
|
|
64
|
-
if debug_logger is None:
|
|
65
|
-
debug_logger = NoOpLogger()
|
|
66
|
-
|
|
67
76
|
security: Any = None
|
|
68
77
|
if callable(azure_api_key):
|
|
69
|
-
security = lambda: models.Security( # pylint: disable=unnecessary-lambda-assignment
|
|
70
|
-
api_key=azure_api_key()
|
|
71
|
-
)
|
|
78
|
+
security = lambda: models.Security(api_key=azure_api_key()) # pylint: disable=unnecessary-lambda-assignment
|
|
72
79
|
else:
|
|
73
80
|
security = models.Security(api_key=azure_api_key)
|
|
74
81
|
|
|
@@ -80,11 +87,14 @@ class MistralAzure(BaseSDK):
|
|
|
80
87
|
self,
|
|
81
88
|
SDKConfiguration(
|
|
82
89
|
client=client,
|
|
90
|
+
client_supplied=client_supplied,
|
|
83
91
|
async_client=async_client,
|
|
92
|
+
async_client_supplied=async_client_supplied,
|
|
84
93
|
security=security,
|
|
85
94
|
server_url=server_url,
|
|
86
95
|
server=None,
|
|
87
96
|
retry_config=retry_config,
|
|
97
|
+
timeout_ms=timeout_ms,
|
|
88
98
|
debug_logger=debug_logger,
|
|
89
99
|
),
|
|
90
100
|
)
|
|
@@ -93,7 +103,7 @@ class MistralAzure(BaseSDK):
|
|
|
93
103
|
|
|
94
104
|
current_server_url, *_ = self.sdk_configuration.get_server_details()
|
|
95
105
|
server_url, self.sdk_configuration.client = hooks.sdk_init(
|
|
96
|
-
current_server_url,
|
|
106
|
+
current_server_url, client
|
|
97
107
|
)
|
|
98
108
|
if current_server_url != server_url:
|
|
99
109
|
self.sdk_configuration.server_url = server_url
|
|
@@ -101,7 +111,39 @@ class MistralAzure(BaseSDK):
|
|
|
101
111
|
# pylint: disable=protected-access
|
|
102
112
|
self.sdk_configuration.__dict__["_hooks"] = hooks
|
|
103
113
|
|
|
114
|
+
weakref.finalize(
|
|
115
|
+
self,
|
|
116
|
+
close_clients,
|
|
117
|
+
cast(ClientOwner, self.sdk_configuration),
|
|
118
|
+
self.sdk_configuration.client,
|
|
119
|
+
self.sdk_configuration.client_supplied,
|
|
120
|
+
self.sdk_configuration.async_client,
|
|
121
|
+
self.sdk_configuration.async_client_supplied,
|
|
122
|
+
)
|
|
123
|
+
|
|
104
124
|
self._init_sdks()
|
|
105
125
|
|
|
106
126
|
def _init_sdks(self):
|
|
107
127
|
self.chat = Chat(self.sdk_configuration)
|
|
128
|
+
|
|
129
|
+
def __enter__(self):
|
|
130
|
+
return self
|
|
131
|
+
|
|
132
|
+
async def __aenter__(self):
|
|
133
|
+
return self
|
|
134
|
+
|
|
135
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
136
|
+
if (
|
|
137
|
+
self.sdk_configuration.client is not None
|
|
138
|
+
and not self.sdk_configuration.client_supplied
|
|
139
|
+
):
|
|
140
|
+
self.sdk_configuration.client.close()
|
|
141
|
+
self.sdk_configuration.client = None
|
|
142
|
+
|
|
143
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
144
|
+
if (
|
|
145
|
+
self.sdk_configuration.async_client is not None
|
|
146
|
+
and not self.sdk_configuration.async_client_supplied
|
|
147
|
+
):
|
|
148
|
+
await self.sdk_configuration.async_client.aclose()
|
|
149
|
+
self.sdk_configuration.async_client = None
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from ._hooks import SDKHooks
|
|
4
|
+
from ._version import (
|
|
5
|
+
__gen_version__,
|
|
6
|
+
__openapi_doc_version__,
|
|
7
|
+
__user_agent__,
|
|
8
|
+
__version__,
|
|
9
|
+
)
|
|
4
10
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
5
11
|
from .utils import Logger, RetryConfig, remove_suffix
|
|
6
12
|
from dataclasses import dataclass
|
|
@@ -20,17 +26,19 @@ SERVERS = {
|
|
|
20
26
|
|
|
21
27
|
@dataclass
|
|
22
28
|
class SDKConfiguration:
|
|
23
|
-
client: HttpClient
|
|
24
|
-
|
|
29
|
+
client: Union[HttpClient, None]
|
|
30
|
+
client_supplied: bool
|
|
31
|
+
async_client: Union[AsyncHttpClient, None]
|
|
32
|
+
async_client_supplied: bool
|
|
25
33
|
debug_logger: Logger
|
|
26
34
|
security: Optional[Union[models.Security, Callable[[], models.Security]]] = None
|
|
27
35
|
server_url: Optional[str] = ""
|
|
28
36
|
server: Optional[str] = ""
|
|
29
37
|
language: str = "python"
|
|
30
|
-
openapi_doc_version: str =
|
|
31
|
-
sdk_version: str =
|
|
32
|
-
gen_version: str =
|
|
33
|
-
user_agent: str =
|
|
38
|
+
openapi_doc_version: str = __openapi_doc_version__
|
|
39
|
+
sdk_version: str = __version__
|
|
40
|
+
gen_version: str = __gen_version__
|
|
41
|
+
user_agent: str = __user_agent__
|
|
34
42
|
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
35
43
|
timeout_ms: Optional[int] = None
|
|
36
44
|
|
|
@@ -42,6 +42,7 @@ from .values import (
|
|
|
42
42
|
match_content_type,
|
|
43
43
|
match_status_codes,
|
|
44
44
|
match_response,
|
|
45
|
+
cast_partial,
|
|
45
46
|
)
|
|
46
47
|
from .logger import Logger, get_body_content, get_default_logger
|
|
47
48
|
|
|
@@ -94,4 +95,5 @@ __all__ = [
|
|
|
94
95
|
"validate_float",
|
|
95
96
|
"validate_int",
|
|
96
97
|
"validate_open_enum",
|
|
98
|
+
"cast_partial",
|
|
97
99
|
]
|
|
@@ -7,14 +7,15 @@ import httpx
|
|
|
7
7
|
from typing_extensions import get_origin
|
|
8
8
|
from pydantic import ConfigDict, create_model
|
|
9
9
|
from pydantic_core import from_json
|
|
10
|
-
from
|
|
10
|
+
from typing_inspection.typing_objects import is_union
|
|
11
11
|
|
|
12
12
|
from ..types.basemodel import BaseModel, Nullable, OptionalNullable, Unset
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def serialize_decimal(as_str: bool):
|
|
16
16
|
def serialize(d):
|
|
17
|
-
|
|
17
|
+
# Optional[T] is a Union[T, None]
|
|
18
|
+
if is_union(type(d)) and type(None) in get_args(type(d)) and d is None:
|
|
18
19
|
return None
|
|
19
20
|
if isinstance(d, Unset):
|
|
20
21
|
return d
|
|
@@ -42,7 +43,8 @@ def validate_decimal(d):
|
|
|
42
43
|
|
|
43
44
|
def serialize_float(as_str: bool):
|
|
44
45
|
def serialize(f):
|
|
45
|
-
|
|
46
|
+
# Optional[T] is a Union[T, None]
|
|
47
|
+
if is_union(type(f)) and type(None) in get_args(type(f)) and f is None:
|
|
46
48
|
return None
|
|
47
49
|
if isinstance(f, Unset):
|
|
48
50
|
return f
|
|
@@ -70,7 +72,8 @@ def validate_float(f):
|
|
|
70
72
|
|
|
71
73
|
def serialize_int(as_str: bool):
|
|
72
74
|
def serialize(i):
|
|
73
|
-
|
|
75
|
+
# Optional[T] is a Union[T, None]
|
|
76
|
+
if is_union(type(i)) and type(None) in get_args(type(i)) and i is None:
|
|
74
77
|
return None
|
|
75
78
|
if isinstance(i, Unset):
|
|
76
79
|
return i
|
|
@@ -118,7 +121,8 @@ def validate_open_enum(is_int: bool):
|
|
|
118
121
|
|
|
119
122
|
def validate_const(v):
|
|
120
123
|
def validate(c):
|
|
121
|
-
|
|
124
|
+
# Optional[T] is a Union[T, None]
|
|
125
|
+
if is_union(type(c)) and type(None) in get_args(type(c)) and c is None:
|
|
122
126
|
return None
|
|
123
127
|
|
|
124
128
|
if v != c:
|
|
@@ -163,7 +167,7 @@ def marshal_json(val, typ):
|
|
|
163
167
|
if len(d) == 0:
|
|
164
168
|
return ""
|
|
165
169
|
|
|
166
|
-
return json.dumps(d[next(iter(d))], separators=(",", ":")
|
|
170
|
+
return json.dumps(d[next(iter(d))], separators=(",", ":"))
|
|
167
171
|
|
|
168
172
|
|
|
169
173
|
def is_nullable(field):
|
mistralai_azure/utils/values.py
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from enum import Enum
|
|
5
5
|
from email.message import Message
|
|
6
|
+
from functools import partial
|
|
6
7
|
import os
|
|
7
|
-
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union
|
|
8
|
+
from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, Union, cast
|
|
8
9
|
|
|
9
10
|
from httpx import Response
|
|
10
11
|
from pydantic import BaseModel
|
|
@@ -51,6 +52,8 @@ def match_status_codes(status_codes: List[str], status_code: int) -> bool:
|
|
|
51
52
|
|
|
52
53
|
T = TypeVar("T")
|
|
53
54
|
|
|
55
|
+
def cast_partial(typ):
|
|
56
|
+
return partial(cast, typ)
|
|
54
57
|
|
|
55
58
|
def get_global_from_env(
|
|
56
59
|
value: Optional[T], env_key: str, type_cast: Callable[[str], T]
|
mistralai_gcp/__init__.py
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
from ._version import
|
|
3
|
+
from ._version import (
|
|
4
|
+
__title__,
|
|
5
|
+
__version__,
|
|
6
|
+
__openapi_doc_version__,
|
|
7
|
+
__gen_version__,
|
|
8
|
+
__user_agent__,
|
|
9
|
+
)
|
|
4
10
|
from .sdk import *
|
|
5
11
|
from .sdkconfiguration import *
|
|
6
12
|
from .models import *
|
|
7
13
|
|
|
8
14
|
|
|
9
15
|
VERSION: str = __version__
|
|
16
|
+
OPENAPI_DOC_VERSION = __openapi_doc_version__
|
|
17
|
+
SPEAKEASY_GENERATOR_VERSION = __gen_version__
|
|
18
|
+
USER_AGENT = __user_agent__
|
mistralai_gcp/_hooks/types.py
CHANGED
|
@@ -7,16 +7,19 @@ from typing import Any, Callable, List, Optional, Tuple, Union
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class HookContext:
|
|
10
|
+
base_url: str
|
|
10
11
|
operation_id: str
|
|
11
12
|
oauth2_scopes: Optional[List[str]] = None
|
|
12
13
|
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
|
13
14
|
|
|
14
15
|
def __init__(
|
|
15
16
|
self,
|
|
17
|
+
base_url: str,
|
|
16
18
|
operation_id: str,
|
|
17
19
|
oauth2_scopes: Optional[List[str]],
|
|
18
20
|
security_source: Optional[Union[Any, Callable[[], Any]]],
|
|
19
21
|
):
|
|
22
|
+
self.base_url = base_url
|
|
20
23
|
self.operation_id = operation_id
|
|
21
24
|
self.oauth2_scopes = oauth2_scopes
|
|
22
25
|
self.security_source = security_source
|
|
@@ -25,21 +28,30 @@ class HookContext:
|
|
|
25
28
|
class BeforeRequestContext(HookContext):
|
|
26
29
|
def __init__(self, hook_ctx: HookContext):
|
|
27
30
|
super().__init__(
|
|
28
|
-
hook_ctx.
|
|
31
|
+
hook_ctx.base_url,
|
|
32
|
+
hook_ctx.operation_id,
|
|
33
|
+
hook_ctx.oauth2_scopes,
|
|
34
|
+
hook_ctx.security_source,
|
|
29
35
|
)
|
|
30
36
|
|
|
31
37
|
|
|
32
38
|
class AfterSuccessContext(HookContext):
|
|
33
39
|
def __init__(self, hook_ctx: HookContext):
|
|
34
40
|
super().__init__(
|
|
35
|
-
hook_ctx.
|
|
41
|
+
hook_ctx.base_url,
|
|
42
|
+
hook_ctx.operation_id,
|
|
43
|
+
hook_ctx.oauth2_scopes,
|
|
44
|
+
hook_ctx.security_source,
|
|
36
45
|
)
|
|
37
46
|
|
|
38
47
|
|
|
39
48
|
class AfterErrorContext(HookContext):
|
|
40
49
|
def __init__(self, hook_ctx: HookContext):
|
|
41
50
|
super().__init__(
|
|
42
|
-
hook_ctx.
|
|
51
|
+
hook_ctx.base_url,
|
|
52
|
+
hook_ctx.operation_id,
|
|
53
|
+
hook_ctx.oauth2_scopes,
|
|
54
|
+
hook_ctx.security_source,
|
|
43
55
|
)
|
|
44
56
|
|
|
45
57
|
|
mistralai_gcp/_version.py
CHANGED
|
@@ -4,6 +4,9 @@ import importlib.metadata
|
|
|
4
4
|
|
|
5
5
|
__title__: str = "mistralai-gcp"
|
|
6
6
|
__version__: str = "1.2.6"
|
|
7
|
+
__openapi_doc_version__: str = "0.0.2"
|
|
8
|
+
__gen_version__: str = "2.548.6"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 1.2.6 2.548.6 0.0.2 mistralai-gcp"
|
|
7
10
|
|
|
8
11
|
try:
|
|
9
12
|
if __package__ is not None:
|
mistralai_gcp/basesdk.py
CHANGED
|
@@ -231,6 +231,10 @@ class BaseSDK:
|
|
|
231
231
|
req.headers,
|
|
232
232
|
get_body_content(req),
|
|
233
233
|
)
|
|
234
|
+
|
|
235
|
+
if client is None:
|
|
236
|
+
raise ValueError("client is required")
|
|
237
|
+
|
|
234
238
|
http_res = client.send(req, stream=stream)
|
|
235
239
|
except Exception as e:
|
|
236
240
|
_, e = self.sdk_configuration.get_hooks().after_error(
|
|
@@ -303,6 +307,10 @@ class BaseSDK:
|
|
|
303
307
|
req.headers,
|
|
304
308
|
get_body_content(req),
|
|
305
309
|
)
|
|
310
|
+
|
|
311
|
+
if client is None:
|
|
312
|
+
raise ValueError("client is required")
|
|
313
|
+
|
|
306
314
|
http_res = await client.send(req, stream=stream)
|
|
307
315
|
except Exception as e:
|
|
308
316
|
_, e = self.sdk_configuration.get_hooks().after_error(
|