mistralai 0.5.5a50__py3-none-any.whl → 1.0.0__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/agents.py +434 -0
- mistralai/basesdk.py +43 -6
- mistralai/chat.py +29 -34
- mistralai/client.py +1 -1
- mistralai/embeddings.py +4 -4
- mistralai/files.py +10 -10
- mistralai/fim.py +17 -18
- mistralai/fine_tuning.py +10 -849
- mistralai/jobs.py +844 -0
- mistralai/models/__init__.py +6 -4
- mistralai/models/agentscompletionrequest.py +96 -0
- mistralai/models/agentscompletionstreamrequest.py +92 -0
- mistralai/models/assistantmessage.py +4 -9
- mistralai/models/chatcompletionchoice.py +4 -15
- mistralai/models/chatcompletionrequest.py +11 -16
- mistralai/models/chatcompletionstreamrequest.py +11 -16
- mistralai/models/completionresponsestreamchoice.py +4 -9
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
- mistralai/models/deltamessage.py +4 -9
- mistralai/models/detailedjobout.py +4 -9
- mistralai/models/embeddingrequest.py +4 -9
- mistralai/models/eventout.py +4 -9
- mistralai/models/fileschema.py +4 -9
- mistralai/models/fimcompletionrequest.py +11 -16
- mistralai/models/fimcompletionstreamrequest.py +11 -16
- mistralai/models/ftmodelout.py +4 -9
- mistralai/models/functioncall.py +9 -3
- mistralai/models/githubrepositoryin.py +4 -9
- mistralai/models/githubrepositoryout.py +4 -9
- mistralai/models/httpvalidationerror.py +1 -1
- mistralai/models/jobin.py +4 -9
- mistralai/models/jobmetadataout.py +4 -9
- mistralai/models/jobout.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +1 -59
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
- mistralai/models/legacyjobmetadataout.py +4 -9
- mistralai/models/metricout.py +4 -9
- mistralai/models/modelcard.py +4 -9
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
- mistralai/models/retrievefileout.py +4 -9
- mistralai/models/security.py +4 -4
- mistralai/models/toolmessage.py +4 -9
- mistralai/models/trainingparameters.py +4 -9
- mistralai/models/trainingparametersin.py +4 -9
- mistralai/models/updateftmodelin.py +4 -9
- mistralai/models/uploadfileout.py +4 -9
- mistralai/models/wandbintegration.py +4 -9
- mistralai/models/wandbintegrationout.py +4 -9
- mistralai/models_.py +24 -24
- mistralai/sdk.py +14 -6
- mistralai/sdkconfiguration.py +5 -4
- mistralai/types/basemodel.py +10 -6
- mistralai/utils/__init__.py +4 -0
- mistralai/utils/eventstreaming.py +8 -9
- mistralai/utils/logger.py +16 -0
- mistralai/utils/retries.py +2 -2
- mistralai/utils/security.py +5 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/METADATA +136 -67
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/RECORD +105 -98
- mistralai_azure/basesdk.py +42 -4
- mistralai_azure/chat.py +15 -20
- mistralai_azure/models/__init__.py +3 -3
- mistralai_azure/models/assistantmessage.py +4 -9
- mistralai_azure/models/chatcompletionchoice.py +4 -15
- mistralai_azure/models/chatcompletionrequest.py +7 -12
- mistralai_azure/models/chatcompletionstreamrequest.py +7 -12
- mistralai_azure/models/completionresponsestreamchoice.py +4 -9
- mistralai_azure/models/deltamessage.py +4 -9
- mistralai_azure/models/functioncall.py +9 -3
- mistralai_azure/models/httpvalidationerror.py +1 -1
- mistralai_azure/models/toolmessage.py +4 -9
- mistralai_azure/sdk.py +7 -2
- mistralai_azure/sdkconfiguration.py +5 -4
- mistralai_azure/types/basemodel.py +10 -6
- mistralai_azure/utils/__init__.py +4 -0
- mistralai_azure/utils/eventstreaming.py +8 -9
- mistralai_azure/utils/logger.py +16 -0
- mistralai_azure/utils/retries.py +2 -2
- mistralai_gcp/basesdk.py +42 -4
- mistralai_gcp/chat.py +12 -17
- mistralai_gcp/fim.py +12 -13
- mistralai_gcp/models/__init__.py +3 -3
- mistralai_gcp/models/assistantmessage.py +4 -9
- mistralai_gcp/models/chatcompletionchoice.py +4 -15
- mistralai_gcp/models/chatcompletionrequest.py +9 -14
- mistralai_gcp/models/chatcompletionstreamrequest.py +9 -14
- mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
- mistralai_gcp/models/deltamessage.py +4 -9
- mistralai_gcp/models/fimcompletionrequest.py +11 -16
- mistralai_gcp/models/fimcompletionstreamrequest.py +11 -16
- mistralai_gcp/models/functioncall.py +9 -3
- mistralai_gcp/models/httpvalidationerror.py +1 -1
- mistralai_gcp/models/toolmessage.py +4 -9
- mistralai_gcp/sdk.py +9 -0
- mistralai_gcp/sdkconfiguration.py +5 -4
- mistralai_gcp/types/basemodel.py +10 -6
- mistralai_gcp/utils/__init__.py +4 -0
- mistralai_gcp/utils/eventstreaming.py +8 -9
- mistralai_gcp/utils/logger.py +16 -0
- mistralai_gcp/utils/retries.py +2 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/LICENSE +0 -0
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0.dist-info}/WHEEL +0 -0
|
@@ -36,18 +36,13 @@ class ToolMessage(BaseModel):
|
|
|
36
36
|
k = f.alias or n
|
|
37
37
|
val = serialized.get(k)
|
|
38
38
|
|
|
39
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
41
|
+
|
|
39
42
|
if val is not None and val != UNSET_SENTINEL:
|
|
40
43
|
m[k] = val
|
|
41
44
|
elif val != UNSET_SENTINEL and (
|
|
42
|
-
not k in optional_fields
|
|
43
|
-
or (
|
|
44
|
-
k in optional_fields
|
|
45
|
-
and k in nullable_fields
|
|
46
|
-
and (
|
|
47
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
-
or k in null_default_fields
|
|
49
|
-
) # pylint: disable=no-member
|
|
50
|
-
)
|
|
45
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
51
46
|
):
|
|
52
47
|
m[k] = val
|
|
53
48
|
|
mistralai_gcp/sdk.py
CHANGED
|
@@ -11,11 +11,13 @@ import httpx
|
|
|
11
11
|
from mistralai_gcp import models
|
|
12
12
|
from mistralai_gcp._hooks import BeforeRequestHook, SDKHooks
|
|
13
13
|
from mistralai_gcp.chat import Chat
|
|
14
|
+
from mistralai_gcp.fim import Fim
|
|
14
15
|
from mistralai_gcp.types import Nullable
|
|
15
16
|
|
|
16
17
|
from .basesdk import BaseSDK
|
|
17
18
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
18
19
|
from .sdkconfiguration import SDKConfiguration
|
|
20
|
+
from .utils.logger import Logger, NoOpLogger
|
|
19
21
|
from .utils.retries import RetryConfig
|
|
20
22
|
|
|
21
23
|
|
|
@@ -23,6 +25,7 @@ class MistralGoogleCloud(BaseSDK):
|
|
|
23
25
|
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."""
|
|
24
26
|
|
|
25
27
|
chat: Chat
|
|
28
|
+
fim: Fim
|
|
26
29
|
r"""Chat Completion API"""
|
|
27
30
|
|
|
28
31
|
def __init__(
|
|
@@ -32,6 +35,7 @@ class MistralGoogleCloud(BaseSDK):
|
|
|
32
35
|
client: Optional[HttpClient] = None,
|
|
33
36
|
async_client: Optional[AsyncHttpClient] = None,
|
|
34
37
|
retry_config: Optional[Nullable[RetryConfig]] = None,
|
|
38
|
+
debug_logger: Optional[Logger] = None,
|
|
35
39
|
) -> None:
|
|
36
40
|
r"""Instantiates the SDK configuring it with the provided parameters.
|
|
37
41
|
|
|
@@ -73,6 +77,9 @@ class MistralGoogleCloud(BaseSDK):
|
|
|
73
77
|
if async_client is None:
|
|
74
78
|
async_client = httpx.AsyncClient()
|
|
75
79
|
|
|
80
|
+
if debug_logger is None:
|
|
81
|
+
debug_logger = NoOpLogger()
|
|
82
|
+
|
|
76
83
|
assert issubclass(
|
|
77
84
|
type(async_client), AsyncHttpClient
|
|
78
85
|
), "The provided async_client must implement the AsyncHttpClient protocol."
|
|
@@ -94,6 +101,7 @@ class MistralGoogleCloud(BaseSDK):
|
|
|
94
101
|
server_url=f"https://{region}-aiplatform.googleapis.com",
|
|
95
102
|
server=None,
|
|
96
103
|
retry_config=retry_config,
|
|
104
|
+
debug_logger=debug_logger,
|
|
97
105
|
),
|
|
98
106
|
)
|
|
99
107
|
|
|
@@ -116,6 +124,7 @@ class MistralGoogleCloud(BaseSDK):
|
|
|
116
124
|
|
|
117
125
|
def _init_sdks(self):
|
|
118
126
|
self.chat = Chat(self.sdk_configuration)
|
|
127
|
+
self.fim = Fim(self.sdk_configuration)
|
|
119
128
|
|
|
120
129
|
|
|
121
130
|
class GoogleCloudBeforeRequestHook(BeforeRequestHook):
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from ._hooks import SDKHooks
|
|
5
5
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
6
|
-
from .utils import RetryConfig, remove_suffix
|
|
6
|
+
from .utils import Logger, RetryConfig, remove_suffix
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from mistralai_gcp import models
|
|
9
9
|
from mistralai_gcp.types import OptionalNullable, UNSET
|
|
@@ -23,14 +23,15 @@ SERVERS = {
|
|
|
23
23
|
class SDKConfiguration:
|
|
24
24
|
client: HttpClient
|
|
25
25
|
async_client: AsyncHttpClient
|
|
26
|
+
debug_logger: Logger
|
|
26
27
|
security: Optional[Union[models.Security,Callable[[], models.Security]]] = None
|
|
27
28
|
server_url: Optional[str] = ""
|
|
28
29
|
server: Optional[str] = ""
|
|
29
30
|
language: str = "python"
|
|
30
31
|
openapi_doc_version: str = "0.0.2"
|
|
31
|
-
sdk_version: str = "0.
|
|
32
|
-
gen_version: str = "2.
|
|
33
|
-
user_agent: str = "speakeasy-sdk/python 0.
|
|
32
|
+
sdk_version: str = "1.0.0-rc.2"
|
|
33
|
+
gen_version: str = "2.388.1"
|
|
34
|
+
user_agent: str = "speakeasy-sdk/python 1.0.0-rc.2 2.388.1 0.0.2 mistralai-gcp"
|
|
34
35
|
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
35
36
|
timeout_ms: Optional[int] = None
|
|
36
37
|
|
mistralai_gcp/types/basemodel.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from pydantic import ConfigDict, model_serializer
|
|
4
4
|
from pydantic import BaseModel as PydanticBaseModel
|
|
5
|
-
from typing import Literal, Optional, TypeVar, Union, NewType
|
|
6
|
-
from typing_extensions import TypeAliasType
|
|
5
|
+
from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType
|
|
6
|
+
from typing_extensions import TypeAliasType, TypeAlias
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class BaseModel(PydanticBaseModel):
|
|
@@ -26,10 +26,14 @@ UNSET_SENTINEL = "~?~unset~?~sentinel~?~"
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
T = TypeVar("T")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if TYPE_CHECKING:
|
|
30
|
+
Nullable: TypeAlias = Union[T, None]
|
|
31
|
+
OptionalNullable: TypeAlias = Union[Optional[Nullable[T]], Unset]
|
|
32
|
+
else:
|
|
33
|
+
Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
|
|
34
|
+
OptionalNullable = TypeAliasType(
|
|
35
|
+
"OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
|
|
36
|
+
)
|
|
33
37
|
|
|
34
38
|
UnrecognizedInt = NewType("UnrecognizedInt", int)
|
|
35
39
|
UnrecognizedStr = NewType("UnrecognizedStr", str)
|
mistralai_gcp/utils/__init__.py
CHANGED
|
@@ -34,6 +34,7 @@ from .serializers import (
|
|
|
34
34
|
)
|
|
35
35
|
from .url import generate_url, template_url, remove_suffix
|
|
36
36
|
from .values import get_global_from_env, match_content_type, match_status_codes, match_response
|
|
37
|
+
from .logger import Logger, get_body_content, NoOpLogger
|
|
37
38
|
|
|
38
39
|
__all__ = [
|
|
39
40
|
"BackoffStrategy",
|
|
@@ -41,6 +42,7 @@ __all__ = [
|
|
|
41
42
|
"find_metadata",
|
|
42
43
|
"FormMetadata",
|
|
43
44
|
"generate_url",
|
|
45
|
+
"get_body_content",
|
|
44
46
|
"get_discriminator",
|
|
45
47
|
"get_global_from_env",
|
|
46
48
|
"get_headers",
|
|
@@ -49,11 +51,13 @@ __all__ = [
|
|
|
49
51
|
"get_response_headers",
|
|
50
52
|
"get_security",
|
|
51
53
|
"HeaderMetadata",
|
|
54
|
+
"Logger",
|
|
52
55
|
"marshal_json",
|
|
53
56
|
"match_content_type",
|
|
54
57
|
"match_status_codes",
|
|
55
58
|
"match_response",
|
|
56
59
|
"MultipartFormMetadata",
|
|
60
|
+
"NoOpLogger",
|
|
57
61
|
"OpenEnumMeta",
|
|
58
62
|
"PathParamMetadata",
|
|
59
63
|
"QueryParamMetadata",
|
|
@@ -147,15 +147,14 @@ def _parse_event(
|
|
|
147
147
|
data = data[:-1]
|
|
148
148
|
event.data = data
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
data.isnumeric()
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
or data
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
):
|
|
150
|
+
data_is_primitive = (
|
|
151
|
+
data.isnumeric() or data == "true" or data == "false" or data == "null"
|
|
152
|
+
)
|
|
153
|
+
data_is_json = (
|
|
154
|
+
data.startswith("{") or data.startswith("[") or data.startswith('"')
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
if data_is_primitive or data_is_json:
|
|
159
158
|
try:
|
|
160
159
|
event.data = json.loads(data)
|
|
161
160
|
except Exception:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from typing import Any, Protocol
|
|
5
|
+
|
|
6
|
+
class Logger(Protocol):
|
|
7
|
+
def debug(self, msg: str, *args: Any, **kwargs: Any) -> None:
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
class NoOpLogger:
|
|
11
|
+
def debug(self, msg: str, *args: Any, **kwargs: Any) -> None:
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def get_body_content(req: httpx.Request) -> str:
|
|
15
|
+
return "<streaming body>" if not hasattr(req, "_content") else str(req.content)
|
|
16
|
+
|
mistralai_gcp/utils/retries.py
CHANGED
|
@@ -76,7 +76,7 @@ def retry(func, retries: Retries):
|
|
|
76
76
|
|
|
77
77
|
status_major = res.status_code / 100
|
|
78
78
|
|
|
79
|
-
if
|
|
79
|
+
if code_range <= status_major < code_range + 1:
|
|
80
80
|
raise TemporaryError(res)
|
|
81
81
|
else:
|
|
82
82
|
parsed_code = int(code)
|
|
@@ -125,7 +125,7 @@ async def retry_async(func, retries: Retries):
|
|
|
125
125
|
|
|
126
126
|
status_major = res.status_code / 100
|
|
127
127
|
|
|
128
|
-
if
|
|
128
|
+
if code_range <= status_major < code_range + 1:
|
|
129
129
|
raise TemporaryError(res)
|
|
130
130
|
else:
|
|
131
131
|
parsed_code = int(code)
|
|
File without changes
|
|
File without changes
|