mistralai 1.0.2__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.2.dist-info → mistralai-1.1.0.dist-info}/METADATA +103 -74
- 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 +14 -10
- 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.2.dist-info/RECORD +0 -236
- {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/LICENSE +0 -0
- {mistralai-1.0.2.dist-info → mistralai-1.1.0.dist-info}/WHEEL +0 -0
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from
|
|
5
|
-
import pydantic
|
|
6
|
-
from typing import Final, Optional, TypedDict
|
|
7
|
-
from typing_extensions import Annotated
|
|
4
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
8
5
|
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
text: str
|
|
12
|
-
|
|
7
|
+
ContentChunkTypedDict = TextChunkTypedDict
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
TYPE: Annotated[Final[Optional[str]], pydantic.Field(alias="type")] = "text" # type: ignore
|
|
17
|
-
|
|
9
|
+
|
|
10
|
+
ContentChunk = TextChunk
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .toolcall import ToolCall, ToolCallTypedDict
|
|
5
|
-
from mistralai_azure.types import
|
|
5
|
+
from mistralai_azure.types import (
|
|
6
|
+
BaseModel,
|
|
7
|
+
Nullable,
|
|
8
|
+
OptionalNullable,
|
|
9
|
+
UNSET,
|
|
10
|
+
UNSET_SENTINEL,
|
|
11
|
+
)
|
|
6
12
|
from pydantic import model_serializer
|
|
7
13
|
from typing import List, Optional, TypedDict
|
|
8
14
|
from typing_extensions import NotRequired
|
|
@@ -12,13 +18,15 @@ class DeltaMessageTypedDict(TypedDict):
|
|
|
12
18
|
role: NotRequired[str]
|
|
13
19
|
content: NotRequired[Nullable[str]]
|
|
14
20
|
tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
|
|
15
|
-
|
|
21
|
+
|
|
16
22
|
|
|
17
23
|
class DeltaMessage(BaseModel):
|
|
18
24
|
role: Optional[str] = None
|
|
25
|
+
|
|
19
26
|
content: OptionalNullable[str] = UNSET
|
|
27
|
+
|
|
20
28
|
tool_calls: OptionalNullable[List[ToolCall]] = UNSET
|
|
21
|
-
|
|
29
|
+
|
|
22
30
|
@model_serializer(mode="wrap")
|
|
23
31
|
def serialize_model(self, handler):
|
|
24
32
|
optional_fields = ["role", "content", "tool_calls"]
|
|
@@ -32,9 +40,13 @@ class DeltaMessage(BaseModel):
|
|
|
32
40
|
for n, f in self.model_fields.items():
|
|
33
41
|
k = f.alias or n
|
|
34
42
|
val = serialized.get(k)
|
|
43
|
+
serialized.pop(k, None)
|
|
35
44
|
|
|
36
45
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
37
|
-
is_set = (
|
|
46
|
+
is_set = (
|
|
47
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
+
or k in null_default_fields
|
|
49
|
+
) # pylint: disable=no-member
|
|
38
50
|
|
|
39
51
|
if val is not None and val != UNSET_SENTINEL:
|
|
40
52
|
m[k] = val
|
|
@@ -44,4 +56,3 @@ class DeltaMessage(BaseModel):
|
|
|
44
56
|
m[k] = val
|
|
45
57
|
|
|
46
58
|
return m
|
|
47
|
-
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai_azure.types import BaseModel
|
|
5
|
+
from typing import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FunctionNameTypedDict(TypedDict):
|
|
9
|
+
r"""this restriction of `Function` is used to select a specific function to call"""
|
|
10
|
+
|
|
11
|
+
name: str
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class FunctionName(BaseModel):
|
|
15
|
+
r"""this restriction of `Function` is used to select a specific function to call"""
|
|
16
|
+
|
|
17
|
+
name: str
|
|
@@ -6,13 +6,14 @@ from mistralai_azure import utils
|
|
|
6
6
|
from mistralai_azure.types import BaseModel
|
|
7
7
|
from typing import List, Optional
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
class HTTPValidationErrorData(BaseModel):
|
|
10
11
|
detail: Optional[List[ValidationError]] = None
|
|
11
|
-
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class HTTPValidationError(Exception):
|
|
15
15
|
r"""Validation Error"""
|
|
16
|
+
|
|
16
17
|
data: HTTPValidationErrorData
|
|
17
18
|
|
|
18
19
|
def __init__(self, data: HTTPValidationErrorData):
|
|
@@ -20,4 +21,3 @@ class HTTPValidationError(Exception):
|
|
|
20
21
|
|
|
21
22
|
def __str__(self) -> str:
|
|
22
23
|
return utils.marshal_json(self.data, HTTPValidationErrorData)
|
|
23
|
-
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .responseformats import ResponseFormats
|
|
4
5
|
from mistralai_azure.types import BaseModel
|
|
5
|
-
from typing import
|
|
6
|
+
from typing import Optional, TypedDict
|
|
6
7
|
from typing_extensions import NotRequired
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
ResponseFormats = Literal["text", "json_object"]
|
|
10
|
-
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."""
|
|
11
|
-
|
|
12
10
|
class ResponseFormatTypedDict(TypedDict):
|
|
13
11
|
type: NotRequired[ResponseFormats]
|
|
14
|
-
|
|
12
|
+
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."""
|
|
13
|
+
|
|
15
14
|
|
|
16
15
|
class ResponseFormat(BaseModel):
|
|
17
|
-
type: Optional[ResponseFormats] =
|
|
18
|
-
|
|
16
|
+
type: Optional[ResponseFormats] = None
|
|
17
|
+
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."""
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
ResponseFormats = Literal["text", "json_object"]
|
|
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."""
|
|
@@ -9,8 +9,17 @@ from typing_extensions import Annotated
|
|
|
9
9
|
|
|
10
10
|
class SecurityTypedDict(TypedDict):
|
|
11
11
|
api_key: str
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
|
|
14
14
|
class Security(BaseModel):
|
|
15
|
-
api_key: Annotated[
|
|
16
|
-
|
|
15
|
+
api_key: Annotated[
|
|
16
|
+
str,
|
|
17
|
+
FieldMetadata(
|
|
18
|
+
security=SecurityMetadata(
|
|
19
|
+
scheme=True,
|
|
20
|
+
scheme_type="http",
|
|
21
|
+
sub_type="bearer",
|
|
22
|
+
field_name="Authorization",
|
|
23
|
+
)
|
|
24
|
+
),
|
|
25
|
+
]
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .
|
|
4
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
5
5
|
from mistralai_azure.types import BaseModel
|
|
6
6
|
from typing import List, Literal, Optional, TypedDict, Union
|
|
7
7
|
from typing_extensions import NotRequired
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
ContentTypedDict = Union[str, List[
|
|
10
|
+
ContentTypedDict = Union[str, List[TextChunkTypedDict]]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
Content = Union[str, List[
|
|
13
|
+
Content = Union[str, List[TextChunk]]
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
Role = Literal["system"]
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
class SystemMessageTypedDict(TypedDict):
|
|
19
20
|
content: ContentTypedDict
|
|
20
21
|
role: NotRequired[Role]
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
|
|
23
24
|
class SystemMessage(BaseModel):
|
|
24
25
|
content: Content
|
|
26
|
+
|
|
25
27
|
role: Optional[Role] = "system"
|
|
26
|
-
|
|
@@ -3,15 +3,20 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from mistralai_azure.types import BaseModel
|
|
5
5
|
import pydantic
|
|
6
|
-
from typing import Final, Optional, TypedDict
|
|
6
|
+
from typing import Final, Literal, Optional, TypedDict
|
|
7
7
|
from typing_extensions import Annotated
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
Type = Literal["text"]
|
|
11
|
+
|
|
12
|
+
|
|
10
13
|
class TextChunkTypedDict(TypedDict):
|
|
11
14
|
text: str
|
|
12
|
-
|
|
15
|
+
|
|
13
16
|
|
|
14
17
|
class TextChunk(BaseModel):
|
|
15
18
|
text: str
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
|
|
20
|
+
# fmt: off
|
|
21
|
+
TYPE: Annotated[Final[Optional[Type]], pydantic.Field(alias="type")] = "text" # type: ignore
|
|
22
|
+
# fmt: on
|
mistralai_azure/models/tool.py
CHANGED
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .function import Function, FunctionTypedDict
|
|
5
|
-
from
|
|
5
|
+
from .tooltypes import ToolTypes
|
|
6
|
+
from mistralai_azure.types import BaseModel
|
|
6
7
|
from mistralai_azure.utils import validate_open_enum
|
|
7
8
|
from pydantic.functional_validators import PlainValidator
|
|
8
|
-
from typing import
|
|
9
|
+
from typing import Optional, TypedDict
|
|
9
10
|
from typing_extensions import Annotated, NotRequired
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
ToolToolTypes = Union[Literal["function"], UnrecognizedStr]
|
|
13
|
-
|
|
14
13
|
class ToolTypedDict(TypedDict):
|
|
15
14
|
function: FunctionTypedDict
|
|
16
|
-
type: NotRequired[
|
|
17
|
-
|
|
15
|
+
type: NotRequired[ToolTypes]
|
|
16
|
+
|
|
18
17
|
|
|
19
18
|
class Tool(BaseModel):
|
|
20
19
|
function: Function
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
type: Annotated[Optional[ToolTypes], PlainValidator(validate_open_enum(False))] = (
|
|
22
|
+
None
|
|
23
|
+
)
|
|
@@ -2,23 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .functioncall import FunctionCall, FunctionCallTypedDict
|
|
5
|
-
from
|
|
5
|
+
from .tooltypes import ToolTypes
|
|
6
|
+
from mistralai_azure.types import BaseModel
|
|
6
7
|
from mistralai_azure.utils import validate_open_enum
|
|
7
8
|
from pydantic.functional_validators import PlainValidator
|
|
8
|
-
from typing import
|
|
9
|
+
from typing import Optional, TypedDict
|
|
9
10
|
from typing_extensions import Annotated, NotRequired
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
ToolTypes = Union[Literal["function"], UnrecognizedStr]
|
|
13
|
-
|
|
14
13
|
class ToolCallTypedDict(TypedDict):
|
|
15
14
|
function: FunctionCallTypedDict
|
|
16
15
|
id: NotRequired[str]
|
|
17
16
|
type: NotRequired[ToolTypes]
|
|
18
|
-
|
|
17
|
+
|
|
19
18
|
|
|
20
19
|
class ToolCall(BaseModel):
|
|
21
20
|
function: FunctionCall
|
|
21
|
+
|
|
22
22
|
id: Optional[str] = "null"
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
type: Annotated[Optional[ToolTypes], PlainValidator(validate_open_enum(False))] = (
|
|
25
|
+
None
|
|
26
|
+
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .functionname import FunctionName, FunctionNameTypedDict
|
|
5
|
+
from .tooltypes import ToolTypes
|
|
6
|
+
from mistralai_azure.types import BaseModel
|
|
7
|
+
from mistralai_azure.utils import validate_open_enum
|
|
8
|
+
from pydantic.functional_validators import PlainValidator
|
|
9
|
+
from typing import Optional, TypedDict
|
|
10
|
+
from typing_extensions import Annotated, NotRequired
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ToolChoiceTypedDict(TypedDict):
|
|
14
|
+
r"""ToolChoice is either a ToolChoiceEnum or a ToolChoice"""
|
|
15
|
+
|
|
16
|
+
function: FunctionNameTypedDict
|
|
17
|
+
r"""this restriction of `Function` is used to select a specific function to call"""
|
|
18
|
+
type: NotRequired[ToolTypes]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ToolChoice(BaseModel):
|
|
22
|
+
r"""ToolChoice is either a ToolChoiceEnum or a ToolChoice"""
|
|
23
|
+
|
|
24
|
+
function: FunctionName
|
|
25
|
+
r"""this restriction of `Function` is used to select a specific function to call"""
|
|
26
|
+
|
|
27
|
+
type: Annotated[Optional[ToolTypes], PlainValidator(validate_open_enum(False))] = (
|
|
28
|
+
None
|
|
29
|
+
)
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from mistralai_azure.types import
|
|
4
|
+
from mistralai_azure.types import (
|
|
5
|
+
BaseModel,
|
|
6
|
+
Nullable,
|
|
7
|
+
OptionalNullable,
|
|
8
|
+
UNSET,
|
|
9
|
+
UNSET_SENTINEL,
|
|
10
|
+
)
|
|
5
11
|
from pydantic import model_serializer
|
|
6
12
|
from typing import Literal, Optional, TypedDict
|
|
7
13
|
from typing_extensions import NotRequired
|
|
@@ -9,19 +15,23 @@ from typing_extensions import NotRequired
|
|
|
9
15
|
|
|
10
16
|
ToolMessageRole = Literal["tool"]
|
|
11
17
|
|
|
18
|
+
|
|
12
19
|
class ToolMessageTypedDict(TypedDict):
|
|
13
20
|
content: str
|
|
14
21
|
tool_call_id: NotRequired[Nullable[str]]
|
|
15
22
|
name: NotRequired[Nullable[str]]
|
|
16
23
|
role: NotRequired[ToolMessageRole]
|
|
17
|
-
|
|
24
|
+
|
|
18
25
|
|
|
19
26
|
class ToolMessage(BaseModel):
|
|
20
27
|
content: str
|
|
28
|
+
|
|
21
29
|
tool_call_id: OptionalNullable[str] = UNSET
|
|
30
|
+
|
|
22
31
|
name: OptionalNullable[str] = UNSET
|
|
32
|
+
|
|
23
33
|
role: Optional[ToolMessageRole] = "tool"
|
|
24
|
-
|
|
34
|
+
|
|
25
35
|
@model_serializer(mode="wrap")
|
|
26
36
|
def serialize_model(self, handler):
|
|
27
37
|
optional_fields = ["tool_call_id", "name", "role"]
|
|
@@ -35,9 +45,13 @@ class ToolMessage(BaseModel):
|
|
|
35
45
|
for n, f in self.model_fields.items():
|
|
36
46
|
k = f.alias or n
|
|
37
47
|
val = serialized.get(k)
|
|
48
|
+
serialized.pop(k, None)
|
|
38
49
|
|
|
39
50
|
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
-
is_set = (
|
|
51
|
+
is_set = (
|
|
52
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
53
|
+
or k in null_default_fields
|
|
54
|
+
) # pylint: disable=no-member
|
|
41
55
|
|
|
42
56
|
if val is not None and val != UNSET_SENTINEL:
|
|
43
57
|
m[k] = val
|
|
@@ -47,4 +61,3 @@ class ToolMessage(BaseModel):
|
|
|
47
61
|
m[k] = val
|
|
48
62
|
|
|
49
63
|
return m
|
|
50
|
-
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
-
from .
|
|
4
|
+
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
5
5
|
from mistralai_azure.types import BaseModel
|
|
6
6
|
from typing import List, Literal, Optional, TypedDict, Union
|
|
7
7
|
from typing_extensions import NotRequired
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
UserMessageContentTypedDict = Union[str, List[
|
|
10
|
+
UserMessageContentTypedDict = Union[str, List[ContentChunkTypedDict]]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
UserMessageContent = Union[str, List[
|
|
13
|
+
UserMessageContent = Union[str, List[ContentChunk]]
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
UserMessageRole = Literal["user"]
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
class UserMessageTypedDict(TypedDict):
|
|
19
20
|
content: UserMessageContentTypedDict
|
|
20
21
|
role: NotRequired[UserMessageRole]
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
|
|
23
24
|
class UserMessage(BaseModel):
|
|
24
25
|
content: UserMessageContent
|
|
26
|
+
|
|
25
27
|
role: Optional[UserMessageRole] = "user"
|
|
26
|
-
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
from ._hooks import SDKHooks
|
|
5
4
|
from .httpclient import AsyncHttpClient, HttpClient
|
|
6
5
|
from .utils import Logger, RetryConfig, remove_suffix
|
|
@@ -14,7 +13,7 @@ from typing import Callable, Dict, Optional, Tuple, Union
|
|
|
14
13
|
SERVER_PROD = "prod"
|
|
15
14
|
r"""Production server"""
|
|
16
15
|
SERVERS = {
|
|
17
|
-
|
|
16
|
+
SERVER_PROD: "https://api.mistral.ai",
|
|
18
17
|
}
|
|
19
18
|
"""Contains the list of servers available to the SDK"""
|
|
20
19
|
|
|
@@ -24,14 +23,14 @@ class SDKConfiguration:
|
|
|
24
23
|
client: HttpClient
|
|
25
24
|
async_client: AsyncHttpClient
|
|
26
25
|
debug_logger: Logger
|
|
27
|
-
security: Optional[Union[models.Security,Callable[[], models.Security]]] = None
|
|
26
|
+
security: Optional[Union[models.Security, Callable[[], models.Security]]] = None
|
|
28
27
|
server_url: Optional[str] = ""
|
|
29
28
|
server: Optional[str] = ""
|
|
30
29
|
language: str = "python"
|
|
31
30
|
openapi_doc_version: str = "0.0.2"
|
|
32
|
-
sdk_version: str = "1.
|
|
33
|
-
gen_version: str = "2.
|
|
34
|
-
user_agent: str = "speakeasy-sdk/python 1.
|
|
31
|
+
sdk_version: str = "1.2.2"
|
|
32
|
+
gen_version: str = "2.415.6"
|
|
33
|
+
user_agent: str = "speakeasy-sdk/python 1.2.2 2.415.6 0.0.2 mistralai_azure"
|
|
35
34
|
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
36
35
|
timeout_ms: Optional[int] = None
|
|
37
36
|
|
|
@@ -45,10 +44,9 @@ class SDKConfiguration:
|
|
|
45
44
|
self.server = SERVER_PROD
|
|
46
45
|
|
|
47
46
|
if self.server not in SERVERS:
|
|
48
|
-
raise ValueError(f
|
|
47
|
+
raise ValueError(f'Invalid server "{self.server}"')
|
|
49
48
|
|
|
50
49
|
return SERVERS[self.server], {}
|
|
51
50
|
|
|
52
|
-
|
|
53
51
|
def get_hooks(self) -> SDKHooks:
|
|
54
52
|
return self._hooks
|
|
@@ -33,8 +33,13 @@ from .serializers import (
|
|
|
33
33
|
validate_open_enum,
|
|
34
34
|
)
|
|
35
35
|
from .url import generate_url, template_url, remove_suffix
|
|
36
|
-
from .values import
|
|
37
|
-
|
|
36
|
+
from .values import (
|
|
37
|
+
get_global_from_env,
|
|
38
|
+
match_content_type,
|
|
39
|
+
match_status_codes,
|
|
40
|
+
match_response,
|
|
41
|
+
)
|
|
42
|
+
from .logger import Logger, get_body_content, get_default_logger
|
|
38
43
|
|
|
39
44
|
__all__ = [
|
|
40
45
|
"BackoffStrategy",
|
|
@@ -43,6 +48,7 @@ __all__ = [
|
|
|
43
48
|
"FormMetadata",
|
|
44
49
|
"generate_url",
|
|
45
50
|
"get_body_content",
|
|
51
|
+
"get_default_logger",
|
|
46
52
|
"get_discriminator",
|
|
47
53
|
"get_global_from_env",
|
|
48
54
|
"get_headers",
|
|
@@ -57,7 +63,6 @@ __all__ = [
|
|
|
57
63
|
"match_status_codes",
|
|
58
64
|
"match_response",
|
|
59
65
|
"MultipartFormMetadata",
|
|
60
|
-
"NoOpLogger",
|
|
61
66
|
"OpenEnumMeta",
|
|
62
67
|
"PathParamMetadata",
|
|
63
68
|
"QueryParamMetadata",
|
mistralai_azure/utils/forms.py
CHANGED
|
@@ -17,7 +17,7 @@ from .metadata import (
|
|
|
17
17
|
MultipartFormMetadata,
|
|
18
18
|
find_field_metadata,
|
|
19
19
|
)
|
|
20
|
-
from .values import _val_to_string
|
|
20
|
+
from .values import _is_set, _val_to_string
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def _populate_form(
|
|
@@ -27,7 +27,7 @@ def _populate_form(
|
|
|
27
27
|
delimiter: str,
|
|
28
28
|
form: Dict[str, List[str]],
|
|
29
29
|
):
|
|
30
|
-
if obj
|
|
30
|
+
if not _is_set(obj):
|
|
31
31
|
return form
|
|
32
32
|
|
|
33
33
|
if isinstance(obj, BaseModel):
|
|
@@ -41,7 +41,7 @@ def _populate_form(
|
|
|
41
41
|
continue
|
|
42
42
|
|
|
43
43
|
val = getattr(obj, name)
|
|
44
|
-
if val
|
|
44
|
+
if not _is_set(val):
|
|
45
45
|
continue
|
|
46
46
|
|
|
47
47
|
if explode:
|
|
@@ -54,7 +54,7 @@ def _populate_form(
|
|
|
54
54
|
elif isinstance(obj, Dict):
|
|
55
55
|
items = []
|
|
56
56
|
for key, value in obj.items():
|
|
57
|
-
if value
|
|
57
|
+
if not _is_set(value):
|
|
58
58
|
continue
|
|
59
59
|
|
|
60
60
|
if explode:
|
|
@@ -68,7 +68,7 @@ def _populate_form(
|
|
|
68
68
|
items = []
|
|
69
69
|
|
|
70
70
|
for value in obj:
|
|
71
|
-
if value
|
|
71
|
+
if not _is_set(value):
|
|
72
72
|
continue
|
|
73
73
|
|
|
74
74
|
if explode:
|
|
@@ -102,7 +102,7 @@ def serialize_multipart_form(
|
|
|
102
102
|
field = request_fields[name]
|
|
103
103
|
|
|
104
104
|
val = getattr(request, name)
|
|
105
|
-
if val
|
|
105
|
+
if not _is_set(val):
|
|
106
106
|
continue
|
|
107
107
|
|
|
108
108
|
field_metadata = find_field_metadata(field, MultipartFormMetadata)
|
|
@@ -156,7 +156,7 @@ def serialize_multipart_form(
|
|
|
156
156
|
values = []
|
|
157
157
|
|
|
158
158
|
for value in val:
|
|
159
|
-
if value
|
|
159
|
+
if not _is_set(value):
|
|
160
160
|
continue
|
|
161
161
|
values.append(_val_to_string(value))
|
|
162
162
|
|
|
@@ -176,7 +176,7 @@ def serialize_form_data(data: Any) -> Dict[str, Any]:
|
|
|
176
176
|
field = data_fields[name]
|
|
177
177
|
|
|
178
178
|
val = getattr(data, name)
|
|
179
|
-
if val
|
|
179
|
+
if not _is_set(val):
|
|
180
180
|
continue
|
|
181
181
|
|
|
182
182
|
metadata = find_field_metadata(field, FormMetadata)
|
|
@@ -200,7 +200,8 @@ def serialize_form_data(data: Any) -> Dict[str, Any]:
|
|
|
200
200
|
raise ValueError(f"Invalid form style for field {name}")
|
|
201
201
|
elif isinstance(data, Dict):
|
|
202
202
|
for key, value in data.items():
|
|
203
|
-
|
|
203
|
+
if _is_set(value):
|
|
204
|
+
form[key] = [_val_to_string(value)]
|
|
204
205
|
else:
|
|
205
206
|
raise TypeError(f"Invalid request body type {type(data)} for form data")
|
|
206
207
|
|