mistralai 1.0.3__py3-none-any.whl → 1.1.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/_hooks/sdkhooks.py +23 -4
- mistralai/_hooks/types.py +27 -9
- mistralai/agents.py +286 -150
- mistralai/basesdk.py +90 -5
- mistralai/chat.py +260 -144
- mistralai/embeddings.py +73 -53
- mistralai/files.py +252 -192
- mistralai/fim.py +174 -110
- mistralai/fine_tuning.py +3 -2
- mistralai/jobs.py +372 -263
- mistralai/models/__init__.py +499 -46
- mistralai/models/agentscompletionrequest.py +47 -11
- mistralai/models/agentscompletionstreamrequest.py +49 -11
- mistralai/models/archiveftmodelout.py +6 -2
- mistralai/models/assistantmessage.py +11 -4
- mistralai/models/{modelcard.py → basemodelcard.py} +37 -14
- mistralai/models/chatcompletionchoice.py +4 -2
- mistralai/models/chatcompletionrequest.py +57 -11
- mistralai/models/chatcompletionresponse.py +6 -2
- mistralai/models/chatcompletionstreamrequest.py +59 -11
- mistralai/models/checkpointout.py +3 -2
- mistralai/models/completionchunk.py +10 -3
- mistralai/models/completionevent.py +1 -2
- mistralai/models/completionresponsestreamchoice.py +13 -5
- mistralai/models/contentchunk.py +13 -10
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +4 -3
- mistralai/models/deletefileout.py +3 -2
- mistralai/models/deletemodelout.py +3 -2
- mistralai/models/deltamessage.py +9 -4
- mistralai/models/detailedjobout.py +59 -7
- mistralai/models/embeddingrequest.py +9 -4
- mistralai/models/embeddingresponse.py +5 -2
- mistralai/models/embeddingresponsedata.py +3 -2
- mistralai/models/eventout.py +9 -4
- mistralai/models/files_api_routes_delete_fileop.py +4 -3
- mistralai/models/files_api_routes_retrieve_fileop.py +4 -3
- mistralai/models/files_api_routes_upload_fileop.py +27 -8
- mistralai/models/fileschema.py +26 -5
- mistralai/models/fimcompletionrequest.py +26 -5
- mistralai/models/fimcompletionresponse.py +6 -2
- mistralai/models/fimcompletionstreamrequest.py +26 -5
- mistralai/models/finetuneablemodel.py +7 -1
- mistralai/models/ftmodelcapabilitiesout.py +4 -2
- mistralai/models/ftmodelcard.py +103 -0
- mistralai/models/ftmodelout.py +32 -6
- mistralai/models/function.py +3 -2
- mistralai/models/functioncall.py +2 -2
- mistralai/models/functionname.py +17 -0
- mistralai/models/githubrepositoryin.py +15 -4
- mistralai/models/githubrepositoryout.py +15 -4
- mistralai/models/httpvalidationerror.py +2 -2
- mistralai/models/imageurl.py +48 -0
- mistralai/models/imageurlchunk.py +32 -0
- mistralai/models/jobin.py +22 -5
- mistralai/models/jobmetadataout.py +31 -6
- mistralai/models/jobout.py +55 -7
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +83 -16
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +4 -3
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +9 -4
- mistralai/models/jobsout.py +6 -2
- mistralai/models/legacyjobmetadataout.py +45 -6
- mistralai/models/listfilesout.py +2 -2
- mistralai/models/metricout.py +11 -6
- mistralai/models/modelcapabilities.py +7 -2
- mistralai/models/modellist.py +21 -7
- mistralai/models/responseformat.py +6 -7
- mistralai/models/responseformats.py +8 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +24 -5
- mistralai/models/retrievefileout.py +26 -5
- mistralai/models/security.py +12 -3
- mistralai/models/systemmessage.py +6 -5
- mistralai/models/textchunk.py +9 -4
- mistralai/models/tool.py +9 -8
- mistralai/models/toolcall.py +9 -7
- mistralai/models/toolchoice.py +29 -0
- mistralai/models/toolchoiceenum.py +7 -0
- mistralai/models/toolmessage.py +11 -4
- mistralai/models/tooltypes.py +8 -0
- mistralai/models/trainingfile.py +2 -2
- mistralai/models/trainingparameters.py +27 -6
- mistralai/models/trainingparametersin.py +29 -8
- mistralai/models/unarchiveftmodelout.py +6 -2
- mistralai/models/updateftmodelin.py +8 -4
- mistralai/models/uploadfileout.py +26 -5
- mistralai/models/usageinfo.py +3 -2
- mistralai/models/usermessage.py +6 -5
- mistralai/models/validationerror.py +3 -2
- mistralai/models/wandbintegration.py +14 -4
- mistralai/models/wandbintegrationout.py +13 -4
- mistralai/models_.py +392 -294
- mistralai/sdk.py +24 -19
- mistralai/sdkconfiguration.py +6 -8
- mistralai/utils/__init__.py +6 -1
- mistralai/utils/logger.py +4 -1
- mistralai/utils/retries.py +2 -1
- mistralai/utils/security.py +13 -6
- {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/METADATA +102 -73
- mistralai-1.1.0.dist-info/RECORD +254 -0
- mistralai_azure/_hooks/sdkhooks.py +23 -4
- mistralai_azure/_hooks/types.py +27 -9
- mistralai_azure/basesdk.py +91 -6
- mistralai_azure/chat.py +252 -144
- mistralai_azure/models/__init__.py +157 -15
- mistralai_azure/models/assistantmessage.py +18 -5
- mistralai_azure/models/chatcompletionchoice.py +7 -3
- mistralai_azure/models/chatcompletionrequest.py +65 -12
- mistralai_azure/models/chatcompletionresponse.py +6 -2
- mistralai_azure/models/chatcompletionstreamrequest.py +67 -12
- mistralai_azure/models/completionchunk.py +10 -3
- mistralai_azure/models/completionevent.py +1 -2
- mistralai_azure/models/completionresponsestreamchoice.py +10 -4
- mistralai_azure/models/contentchunk.py +4 -11
- mistralai_azure/models/deltamessage.py +16 -5
- mistralai_azure/models/function.py +3 -2
- mistralai_azure/models/functioncall.py +2 -2
- mistralai_azure/models/functionname.py +17 -0
- mistralai_azure/models/httpvalidationerror.py +2 -2
- mistralai_azure/models/responseformat.py +6 -7
- mistralai_azure/models/responseformats.py +8 -0
- mistralai_azure/models/security.py +12 -3
- mistralai_azure/models/systemmessage.py +6 -5
- mistralai_azure/models/textchunk.py +9 -4
- mistralai_azure/models/tool.py +9 -8
- mistralai_azure/models/toolcall.py +9 -7
- mistralai_azure/models/toolchoice.py +29 -0
- mistralai_azure/models/toolchoiceenum.py +7 -0
- mistralai_azure/models/toolmessage.py +18 -5
- mistralai_azure/models/tooltypes.py +8 -0
- mistralai_azure/models/usageinfo.py +3 -2
- mistralai_azure/models/usermessage.py +6 -5
- mistralai_azure/models/validationerror.py +3 -2
- mistralai_azure/sdkconfiguration.py +6 -8
- mistralai_azure/utils/__init__.py +8 -3
- mistralai_azure/utils/forms.py +10 -9
- mistralai_azure/utils/headers.py +8 -8
- mistralai_azure/utils/logger.py +6 -0
- mistralai_azure/utils/queryparams.py +16 -14
- mistralai_azure/utils/retries.py +2 -1
- mistralai_azure/utils/security.py +12 -6
- mistralai_azure/utils/serializers.py +17 -8
- mistralai_azure/utils/url.py +13 -8
- mistralai_azure/utils/values.py +6 -0
- mistralai_gcp/_hooks/sdkhooks.py +23 -4
- mistralai_gcp/_hooks/types.py +27 -9
- mistralai_gcp/basesdk.py +91 -6
- mistralai_gcp/chat.py +252 -144
- mistralai_gcp/fim.py +166 -110
- mistralai_gcp/models/__init__.py +179 -17
- mistralai_gcp/models/assistantmessage.py +18 -5
- mistralai_gcp/models/chatcompletionchoice.py +7 -3
- mistralai_gcp/models/chatcompletionrequest.py +62 -12
- mistralai_gcp/models/chatcompletionresponse.py +6 -2
- mistralai_gcp/models/chatcompletionstreamrequest.py +64 -12
- mistralai_gcp/models/completionchunk.py +10 -3
- mistralai_gcp/models/completionevent.py +1 -2
- mistralai_gcp/models/completionresponsestreamchoice.py +10 -4
- mistralai_gcp/models/contentchunk.py +4 -11
- mistralai_gcp/models/deltamessage.py +16 -5
- mistralai_gcp/models/fimcompletionrequest.py +33 -6
- mistralai_gcp/models/fimcompletionresponse.py +6 -2
- mistralai_gcp/models/fimcompletionstreamrequest.py +33 -6
- mistralai_gcp/models/function.py +3 -2
- mistralai_gcp/models/functioncall.py +2 -2
- mistralai_gcp/models/functionname.py +17 -0
- mistralai_gcp/models/httpvalidationerror.py +2 -2
- mistralai_gcp/models/responseformat.py +6 -7
- mistralai_gcp/models/responseformats.py +8 -0
- mistralai_gcp/models/security.py +12 -3
- mistralai_gcp/models/systemmessage.py +6 -5
- mistralai_gcp/models/textchunk.py +9 -4
- mistralai_gcp/models/tool.py +9 -8
- mistralai_gcp/models/toolcall.py +9 -7
- mistralai_gcp/models/toolchoice.py +29 -0
- mistralai_gcp/models/toolchoiceenum.py +7 -0
- mistralai_gcp/models/toolmessage.py +18 -5
- mistralai_gcp/models/tooltypes.py +8 -0
- mistralai_gcp/models/usageinfo.py +3 -2
- mistralai_gcp/models/usermessage.py +6 -5
- mistralai_gcp/models/validationerror.py +3 -2
- mistralai_gcp/sdk.py +6 -7
- mistralai_gcp/sdkconfiguration.py +6 -8
- mistralai_gcp/utils/__init__.py +8 -3
- mistralai_gcp/utils/forms.py +10 -9
- mistralai_gcp/utils/headers.py +8 -8
- mistralai_gcp/utils/logger.py +6 -0
- mistralai_gcp/utils/queryparams.py +16 -14
- mistralai_gcp/utils/retries.py +2 -1
- mistralai_gcp/utils/security.py +12 -6
- mistralai_gcp/utils/serializers.py +17 -8
- mistralai_gcp/utils/url.py +13 -8
- mistralai_gcp/utils/values.py +6 -0
- mistralai-1.0.3.dist-info/RECORD +0 -236
- {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/LICENSE +0 -0
- {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/WHEEL +0 -0
mistralai/_hooks/sdkhooks.py
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
|
-
from .types import
|
|
4
|
+
from .types import (
|
|
5
|
+
SDKInitHook,
|
|
6
|
+
BeforeRequestContext,
|
|
7
|
+
BeforeRequestHook,
|
|
8
|
+
AfterSuccessContext,
|
|
9
|
+
AfterSuccessHook,
|
|
10
|
+
AfterErrorContext,
|
|
11
|
+
AfterErrorHook,
|
|
12
|
+
Hooks,
|
|
13
|
+
)
|
|
5
14
|
from .registration import init_hooks
|
|
6
15
|
from typing import List, Optional, Tuple
|
|
7
16
|
from mistralai.httpclient import HttpClient
|
|
8
17
|
|
|
18
|
+
|
|
9
19
|
class SDKHooks(Hooks):
|
|
10
20
|
def __init__(self) -> None:
|
|
11
21
|
self.sdk_init_hooks: List[SDKInitHook] = []
|
|
@@ -31,7 +41,9 @@ class SDKHooks(Hooks):
|
|
|
31
41
|
base_url, client = hook.sdk_init(base_url, client)
|
|
32
42
|
return base_url, client
|
|
33
43
|
|
|
34
|
-
def before_request(
|
|
44
|
+
def before_request(
|
|
45
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
|
46
|
+
) -> httpx.Request:
|
|
35
47
|
for hook in self.before_request_hooks:
|
|
36
48
|
out = hook.before_request(hook_ctx, request)
|
|
37
49
|
if isinstance(out, Exception):
|
|
@@ -40,7 +52,9 @@ class SDKHooks(Hooks):
|
|
|
40
52
|
|
|
41
53
|
return request
|
|
42
54
|
|
|
43
|
-
def after_success(
|
|
55
|
+
def after_success(
|
|
56
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
|
57
|
+
) -> httpx.Response:
|
|
44
58
|
for hook in self.after_success_hooks:
|
|
45
59
|
out = hook.after_success(hook_ctx, response)
|
|
46
60
|
if isinstance(out, Exception):
|
|
@@ -48,7 +62,12 @@ class SDKHooks(Hooks):
|
|
|
48
62
|
response = out
|
|
49
63
|
return response
|
|
50
64
|
|
|
51
|
-
def after_error(
|
|
65
|
+
def after_error(
|
|
66
|
+
self,
|
|
67
|
+
hook_ctx: AfterErrorContext,
|
|
68
|
+
response: Optional[httpx.Response],
|
|
69
|
+
error: Optional[Exception],
|
|
70
|
+
) -> Tuple[Optional[httpx.Response], Optional[Exception]]:
|
|
52
71
|
for hook in self.after_error_hooks:
|
|
53
72
|
result = hook.after_error(hook_ctx, response, error)
|
|
54
73
|
if isinstance(result, Exception):
|
mistralai/_hooks/types.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
from abc import ABC, abstractmethod
|
|
5
4
|
import httpx
|
|
6
5
|
from mistralai.httpclient import HttpClient
|
|
@@ -12,7 +11,12 @@ class HookContext:
|
|
|
12
11
|
oauth2_scopes: Optional[List[str]] = None
|
|
13
12
|
security_source: Optional[Union[Any, Callable[[], Any]]] = None
|
|
14
13
|
|
|
15
|
-
def __init__(
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
operation_id: str,
|
|
17
|
+
oauth2_scopes: Optional[List[str]],
|
|
18
|
+
security_source: Optional[Union[Any, Callable[[], Any]]],
|
|
19
|
+
):
|
|
16
20
|
self.operation_id = operation_id
|
|
17
21
|
self.oauth2_scopes = oauth2_scopes
|
|
18
22
|
self.security_source = security_source
|
|
@@ -20,18 +24,23 @@ class HookContext:
|
|
|
20
24
|
|
|
21
25
|
class BeforeRequestContext(HookContext):
|
|
22
26
|
def __init__(self, hook_ctx: HookContext):
|
|
23
|
-
super().__init__(
|
|
27
|
+
super().__init__(
|
|
28
|
+
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
|
29
|
+
)
|
|
24
30
|
|
|
25
31
|
|
|
26
32
|
class AfterSuccessContext(HookContext):
|
|
27
33
|
def __init__(self, hook_ctx: HookContext):
|
|
28
|
-
super().__init__(
|
|
29
|
-
|
|
34
|
+
super().__init__(
|
|
35
|
+
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
|
36
|
+
)
|
|
30
37
|
|
|
31
38
|
|
|
32
39
|
class AfterErrorContext(HookContext):
|
|
33
40
|
def __init__(self, hook_ctx: HookContext):
|
|
34
|
-
super().__init__(
|
|
41
|
+
super().__init__(
|
|
42
|
+
hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source
|
|
43
|
+
)
|
|
35
44
|
|
|
36
45
|
|
|
37
46
|
class SDKInitHook(ABC):
|
|
@@ -42,19 +51,28 @@ class SDKInitHook(ABC):
|
|
|
42
51
|
|
|
43
52
|
class BeforeRequestHook(ABC):
|
|
44
53
|
@abstractmethod
|
|
45
|
-
def before_request(
|
|
54
|
+
def before_request(
|
|
55
|
+
self, hook_ctx: BeforeRequestContext, request: httpx.Request
|
|
56
|
+
) -> Union[httpx.Request, Exception]:
|
|
46
57
|
pass
|
|
47
58
|
|
|
48
59
|
|
|
49
60
|
class AfterSuccessHook(ABC):
|
|
50
61
|
@abstractmethod
|
|
51
|
-
def after_success(
|
|
62
|
+
def after_success(
|
|
63
|
+
self, hook_ctx: AfterSuccessContext, response: httpx.Response
|
|
64
|
+
) -> Union[httpx.Response, Exception]:
|
|
52
65
|
pass
|
|
53
66
|
|
|
54
67
|
|
|
55
68
|
class AfterErrorHook(ABC):
|
|
56
69
|
@abstractmethod
|
|
57
|
-
def after_error(
|
|
70
|
+
def after_error(
|
|
71
|
+
self,
|
|
72
|
+
hook_ctx: AfterErrorContext,
|
|
73
|
+
response: Optional[httpx.Response],
|
|
74
|
+
error: Optional[Exception],
|
|
75
|
+
) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
|
|
58
76
|
pass
|
|
59
77
|
|
|
60
78
|
|