mistralai 1.9.10__py3-none-any.whl → 1.10.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/registration.py +5 -0
- mistralai/_hooks/tracing.py +50 -0
- mistralai/_version.py +3 -3
- mistralai/accesses.py +51 -116
- mistralai/agents.py +58 -85
- mistralai/audio.py +8 -3
- mistralai/basesdk.py +15 -5
- mistralai/batch.py +6 -3
- mistralai/beta.py +10 -5
- mistralai/chat.py +70 -97
- mistralai/classifiers.py +57 -144
- mistralai/conversations.py +435 -412
- mistralai/documents.py +156 -359
- mistralai/embeddings.py +21 -42
- mistralai/extra/observability/__init__.py +15 -0
- mistralai/extra/observability/otel.py +393 -0
- mistralai/extra/run/tools.py +28 -16
- mistralai/files.py +53 -176
- mistralai/fim.py +46 -73
- mistralai/fine_tuning.py +6 -3
- mistralai/jobs.py +49 -158
- mistralai/libraries.py +71 -178
- mistralai/mistral_agents.py +298 -179
- mistralai/mistral_jobs.py +51 -138
- mistralai/models/__init__.py +94 -5
- mistralai/models/agent.py +15 -2
- mistralai/models/agentconversation.py +11 -3
- mistralai/models/agentcreationrequest.py +6 -2
- mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
- mistralai/models/agents_api_v1_agents_getop.py +40 -3
- mistralai/models/agents_api_v1_agents_listop.py +72 -2
- mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
- mistralai/models/agents_api_v1_conversations_listop.py +39 -2
- mistralai/models/agentscompletionrequest.py +21 -6
- mistralai/models/agentscompletionstreamrequest.py +21 -6
- mistralai/models/agentupdaterequest.py +18 -2
- mistralai/models/audiotranscriptionrequest.py +2 -0
- mistralai/models/batchjobin.py +10 -0
- mistralai/models/chatcompletionrequest.py +22 -5
- mistralai/models/chatcompletionstreamrequest.py +22 -5
- mistralai/models/conversationrequest.py +15 -4
- mistralai/models/conversationrestartrequest.py +50 -2
- mistralai/models/conversationrestartstreamrequest.py +50 -2
- mistralai/models/conversationstreamrequest.py +15 -4
- mistralai/models/documentout.py +26 -10
- mistralai/models/documentupdatein.py +24 -3
- mistralai/models/embeddingrequest.py +8 -8
- mistralai/models/files_api_routes_list_filesop.py +7 -0
- mistralai/models/fimcompletionrequest.py +8 -9
- mistralai/models/fimcompletionstreamrequest.py +8 -9
- mistralai/models/httpvalidationerror.py +11 -6
- mistralai/models/libraries_documents_list_v1op.py +15 -2
- mistralai/models/libraryout.py +10 -7
- mistralai/models/listfilesout.py +35 -4
- mistralai/models/mistralerror.py +26 -0
- mistralai/models/modelcapabilities.py +13 -4
- mistralai/models/modelconversation.py +8 -2
- mistralai/models/no_response_error.py +13 -0
- mistralai/models/ocrpageobject.py +26 -5
- mistralai/models/ocrrequest.py +17 -1
- mistralai/models/ocrtableobject.py +31 -0
- mistralai/models/prediction.py +4 -0
- mistralai/models/requestsource.py +7 -0
- mistralai/models/responseformat.py +4 -2
- mistralai/models/responseformats.py +0 -1
- mistralai/models/responsevalidationerror.py +25 -0
- mistralai/models/sdkerror.py +30 -14
- mistralai/models/sharingdelete.py +36 -5
- mistralai/models/sharingin.py +36 -5
- mistralai/models/sharingout.py +3 -3
- mistralai/models/toolexecutiondeltaevent.py +13 -4
- mistralai/models/toolexecutiondoneevent.py +13 -4
- mistralai/models/toolexecutionentry.py +9 -4
- mistralai/models/toolexecutionstartedevent.py +13 -4
- mistralai/models_.py +67 -212
- mistralai/ocr.py +33 -36
- mistralai/sdk.py +15 -2
- mistralai/transcriptions.py +21 -60
- mistralai/utils/__init__.py +18 -5
- mistralai/utils/eventstreaming.py +10 -0
- mistralai/utils/serializers.py +3 -2
- mistralai/utils/unmarshal_json_response.py +24 -0
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/METADATA +89 -40
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/RECORD +86 -75
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info}/WHEEL +1 -1
- {mistralai-1.9.10.dist-info → mistralai-1.10.0.dist-info/licenses}/LICENSE +0 -0
mistralai/models/prediction.py
CHANGED
|
@@ -10,11 +10,15 @@ from typing_extensions import Annotated, NotRequired, TypedDict
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class PredictionTypedDict(TypedDict):
|
|
13
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
14
|
+
|
|
13
15
|
type: Literal["content"]
|
|
14
16
|
content: NotRequired[str]
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
class Prediction(BaseModel):
|
|
20
|
+
r"""Enable users to specify an expected completion, optimizing response times by leveraging known or predictable content."""
|
|
21
|
+
|
|
18
22
|
TYPE: Annotated[
|
|
19
23
|
Annotated[
|
|
20
24
|
Optional[Literal["content"]], AfterValidator(validate_const("content"))
|
|
@@ -10,14 +10,16 @@ from typing_extensions import NotRequired, TypedDict
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class ResponseFormatTypedDict(TypedDict):
|
|
13
|
+
r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. 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. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide."""
|
|
14
|
+
|
|
13
15
|
type: NotRequired[ResponseFormats]
|
|
14
|
-
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."""
|
|
15
16
|
json_schema: NotRequired[Nullable[JSONSchemaTypedDict]]
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class ResponseFormat(BaseModel):
|
|
20
|
+
r"""Specify the format that the model must output. By default it will use `{ \"type\": \"text\" }`. 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. Setting to `{ \"type\": \"json_schema\" }` enables JSON schema mode, which guarantees the message the model generates is in JSON and follows the schema you provide."""
|
|
21
|
+
|
|
19
22
|
type: Optional[ResponseFormats] = None
|
|
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
23
|
|
|
22
24
|
json_schema: OptionalNullable[JSONSchema] = UNSET
|
|
23
25
|
|
|
@@ -5,4 +5,3 @@ from typing import Literal
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
ResponseFormats = Literal["text", "json_object", "json_schema"]
|
|
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."""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
from mistralai.models import MistralError
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ResponseValidationError(MistralError):
|
|
10
|
+
"""Error raised when there is a type mismatch between the response data and the expected Pydantic model."""
|
|
11
|
+
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
message: str,
|
|
15
|
+
raw_response: httpx.Response,
|
|
16
|
+
cause: Exception,
|
|
17
|
+
body: Optional[str] = None,
|
|
18
|
+
):
|
|
19
|
+
message = f"{message}: {cause}"
|
|
20
|
+
super().__init__(message, raw_response, body)
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def cause(self):
|
|
24
|
+
"""Normally the Pydantic ValidationError"""
|
|
25
|
+
return self.__cause__
|
mistralai/models/sdkerror.py
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
from dataclasses import dataclass
|
|
4
|
-
from typing import Optional
|
|
5
3
|
import httpx
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
from mistralai.models import MistralError
|
|
7
|
+
|
|
8
|
+
MAX_MESSAGE_LEN = 10_000
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SDKError(MistralError):
|
|
12
|
+
"""The fallback error class if no more specific error class is matched."""
|
|
13
|
+
|
|
14
|
+
def __init__(
|
|
15
|
+
self, message: str, raw_response: httpx.Response, body: Optional[str] = None
|
|
16
|
+
):
|
|
17
|
+
body_display = body or raw_response.text or '""'
|
|
6
18
|
|
|
19
|
+
if message:
|
|
20
|
+
message += ": "
|
|
21
|
+
message += f"Status {raw_response.status_code}"
|
|
7
22
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
23
|
+
headers = raw_response.headers
|
|
24
|
+
content_type = headers.get("content-type", '""')
|
|
25
|
+
if content_type != "application/json":
|
|
26
|
+
if " " in content_type:
|
|
27
|
+
content_type = f'"{content_type}"'
|
|
28
|
+
message += f" Content-Type {content_type}"
|
|
11
29
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
if len(body_display) > MAX_MESSAGE_LEN:
|
|
31
|
+
truncated = body_display[:MAX_MESSAGE_LEN]
|
|
32
|
+
remaining = len(body_display) - MAX_MESSAGE_LEN
|
|
33
|
+
body_display = f"{truncated}...and {remaining} more chars"
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if len(self.body) > 0:
|
|
20
|
-
body = f"\n{self.body}"
|
|
35
|
+
message += f". Body: {body_display}"
|
|
36
|
+
message = message.strip()
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
super().__init__(message, raw_response, body)
|
|
@@ -2,25 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .entitytype import EntityType
|
|
5
|
-
from mistralai.types import BaseModel
|
|
5
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
6
|
from mistralai.utils import validate_open_enum
|
|
7
|
+
from pydantic import model_serializer
|
|
7
8
|
from pydantic.functional_validators import PlainValidator
|
|
8
|
-
from typing_extensions import Annotated, TypedDict
|
|
9
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class SharingDeleteTypedDict(TypedDict):
|
|
12
|
-
org_id: str
|
|
13
13
|
share_with_uuid: str
|
|
14
14
|
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
15
15
|
share_with_type: EntityType
|
|
16
16
|
r"""The type of entity, used to share a library."""
|
|
17
|
+
org_id: NotRequired[Nullable[str]]
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class SharingDelete(BaseModel):
|
|
20
|
-
org_id: str
|
|
21
|
-
|
|
22
21
|
share_with_uuid: str
|
|
23
22
|
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
24
23
|
|
|
25
24
|
share_with_type: Annotated[EntityType, PlainValidator(validate_open_enum(False))]
|
|
26
25
|
r"""The type of entity, used to share a library."""
|
|
26
|
+
|
|
27
|
+
org_id: OptionalNullable[str] = UNSET
|
|
28
|
+
|
|
29
|
+
@model_serializer(mode="wrap")
|
|
30
|
+
def serialize_model(self, handler):
|
|
31
|
+
optional_fields = ["org_id"]
|
|
32
|
+
nullable_fields = ["org_id"]
|
|
33
|
+
null_default_fields = []
|
|
34
|
+
|
|
35
|
+
serialized = handler(self)
|
|
36
|
+
|
|
37
|
+
m = {}
|
|
38
|
+
|
|
39
|
+
for n, f in type(self).model_fields.items():
|
|
40
|
+
k = f.alias or n
|
|
41
|
+
val = serialized.get(k)
|
|
42
|
+
serialized.pop(k, None)
|
|
43
|
+
|
|
44
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
45
|
+
is_set = (
|
|
46
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
47
|
+
or k in null_default_fields
|
|
48
|
+
) # pylint: disable=no-member
|
|
49
|
+
|
|
50
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
51
|
+
m[k] = val
|
|
52
|
+
elif val != UNSET_SENTINEL and (
|
|
53
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
54
|
+
):
|
|
55
|
+
m[k] = val
|
|
56
|
+
|
|
57
|
+
return m
|
mistralai/models/sharingin.py
CHANGED
|
@@ -3,24 +3,23 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
from .entitytype import EntityType
|
|
5
5
|
from .shareenum import ShareEnum
|
|
6
|
-
from mistralai.types import BaseModel
|
|
6
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
7
|
from mistralai.utils import validate_open_enum
|
|
8
|
+
from pydantic import model_serializer
|
|
8
9
|
from pydantic.functional_validators import PlainValidator
|
|
9
|
-
from typing_extensions import Annotated, TypedDict
|
|
10
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class SharingInTypedDict(TypedDict):
|
|
13
|
-
org_id: str
|
|
14
14
|
level: ShareEnum
|
|
15
15
|
share_with_uuid: str
|
|
16
16
|
r"""The id of the entity (user, workspace or organization) to share with"""
|
|
17
17
|
share_with_type: EntityType
|
|
18
18
|
r"""The type of entity, used to share a library."""
|
|
19
|
+
org_id: NotRequired[Nullable[str]]
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class SharingIn(BaseModel):
|
|
22
|
-
org_id: str
|
|
23
|
-
|
|
24
23
|
level: Annotated[ShareEnum, PlainValidator(validate_open_enum(False))]
|
|
25
24
|
|
|
26
25
|
share_with_uuid: str
|
|
@@ -28,3 +27,35 @@ class SharingIn(BaseModel):
|
|
|
28
27
|
|
|
29
28
|
share_with_type: Annotated[EntityType, PlainValidator(validate_open_enum(False))]
|
|
30
29
|
r"""The type of entity, used to share a library."""
|
|
30
|
+
|
|
31
|
+
org_id: OptionalNullable[str] = UNSET
|
|
32
|
+
|
|
33
|
+
@model_serializer(mode="wrap")
|
|
34
|
+
def serialize_model(self, handler):
|
|
35
|
+
optional_fields = ["org_id"]
|
|
36
|
+
nullable_fields = ["org_id"]
|
|
37
|
+
null_default_fields = []
|
|
38
|
+
|
|
39
|
+
serialized = handler(self)
|
|
40
|
+
|
|
41
|
+
m = {}
|
|
42
|
+
|
|
43
|
+
for n, f in type(self).model_fields.items():
|
|
44
|
+
k = f.alias or n
|
|
45
|
+
val = serialized.get(k)
|
|
46
|
+
serialized.pop(k, None)
|
|
47
|
+
|
|
48
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
49
|
+
is_set = (
|
|
50
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
51
|
+
or k in null_default_fields
|
|
52
|
+
) # pylint: disable=no-member
|
|
53
|
+
|
|
54
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
55
|
+
m[k] = val
|
|
56
|
+
elif val != UNSET_SENTINEL and (
|
|
57
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
58
|
+
):
|
|
59
|
+
m[k] = val
|
|
60
|
+
|
|
61
|
+
return m
|
mistralai/models/sharingout.py
CHANGED
|
@@ -11,7 +11,7 @@ class SharingOutTypedDict(TypedDict):
|
|
|
11
11
|
org_id: str
|
|
12
12
|
role: str
|
|
13
13
|
share_with_type: str
|
|
14
|
-
share_with_uuid: str
|
|
14
|
+
share_with_uuid: Nullable[str]
|
|
15
15
|
user_id: NotRequired[Nullable[str]]
|
|
16
16
|
|
|
17
17
|
|
|
@@ -24,14 +24,14 @@ class SharingOut(BaseModel):
|
|
|
24
24
|
|
|
25
25
|
share_with_type: str
|
|
26
26
|
|
|
27
|
-
share_with_uuid: str
|
|
27
|
+
share_with_uuid: Nullable[str]
|
|
28
28
|
|
|
29
29
|
user_id: OptionalNullable[str] = UNSET
|
|
30
30
|
|
|
31
31
|
@model_serializer(mode="wrap")
|
|
32
32
|
def serialize_model(self, handler):
|
|
33
33
|
optional_fields = ["user_id"]
|
|
34
|
-
nullable_fields = ["user_id"]
|
|
34
|
+
nullable_fields = ["user_id", "share_with_uuid"]
|
|
35
35
|
null_default_fields = []
|
|
36
36
|
|
|
37
37
|
serialized = handler(self)
|
|
@@ -4,16 +4,25 @@ from __future__ import annotations
|
|
|
4
4
|
from .builtinconnectors import BuiltInConnectors
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
|
-
from typing import Literal, Optional
|
|
8
|
-
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
from typing import Literal, Optional, Union
|
|
8
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
ToolExecutionDeltaEventType = Literal["tool.execution.delta"]
|
|
12
12
|
|
|
13
|
+
ToolExecutionDeltaEventNameTypedDict = TypeAliasType(
|
|
14
|
+
"ToolExecutionDeltaEventNameTypedDict", Union[BuiltInConnectors, str]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
ToolExecutionDeltaEventName = TypeAliasType(
|
|
19
|
+
"ToolExecutionDeltaEventName", Union[BuiltInConnectors, str]
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
|
|
14
23
|
class ToolExecutionDeltaEventTypedDict(TypedDict):
|
|
15
24
|
id: str
|
|
16
|
-
name:
|
|
25
|
+
name: ToolExecutionDeltaEventNameTypedDict
|
|
17
26
|
arguments: str
|
|
18
27
|
type: NotRequired[ToolExecutionDeltaEventType]
|
|
19
28
|
created_at: NotRequired[datetime]
|
|
@@ -23,7 +32,7 @@ class ToolExecutionDeltaEventTypedDict(TypedDict):
|
|
|
23
32
|
class ToolExecutionDeltaEvent(BaseModel):
|
|
24
33
|
id: str
|
|
25
34
|
|
|
26
|
-
name:
|
|
35
|
+
name: ToolExecutionDeltaEventName
|
|
27
36
|
|
|
28
37
|
arguments: str
|
|
29
38
|
|
|
@@ -4,16 +4,25 @@ from __future__ import annotations
|
|
|
4
4
|
from .builtinconnectors import BuiltInConnectors
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
|
-
from typing import Any, Dict, Literal, Optional
|
|
8
|
-
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
from typing import Any, Dict, Literal, Optional, Union
|
|
8
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
ToolExecutionDoneEventType = Literal["tool.execution.done"]
|
|
12
12
|
|
|
13
|
+
ToolExecutionDoneEventNameTypedDict = TypeAliasType(
|
|
14
|
+
"ToolExecutionDoneEventNameTypedDict", Union[BuiltInConnectors, str]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
ToolExecutionDoneEventName = TypeAliasType(
|
|
19
|
+
"ToolExecutionDoneEventName", Union[BuiltInConnectors, str]
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
|
|
14
23
|
class ToolExecutionDoneEventTypedDict(TypedDict):
|
|
15
24
|
id: str
|
|
16
|
-
name:
|
|
25
|
+
name: ToolExecutionDoneEventNameTypedDict
|
|
17
26
|
type: NotRequired[ToolExecutionDoneEventType]
|
|
18
27
|
created_at: NotRequired[datetime]
|
|
19
28
|
output_index: NotRequired[int]
|
|
@@ -23,7 +32,7 @@ class ToolExecutionDoneEventTypedDict(TypedDict):
|
|
|
23
32
|
class ToolExecutionDoneEvent(BaseModel):
|
|
24
33
|
id: str
|
|
25
34
|
|
|
26
|
-
name:
|
|
35
|
+
name: ToolExecutionDoneEventName
|
|
27
36
|
|
|
28
37
|
type: Optional[ToolExecutionDoneEventType] = "tool.execution.done"
|
|
29
38
|
|
|
@@ -5,17 +5,22 @@ from .builtinconnectors import BuiltInConnectors
|
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
7
7
|
from pydantic import model_serializer
|
|
8
|
-
from typing import Any, Dict, Literal, Optional
|
|
9
|
-
from typing_extensions import NotRequired, TypedDict
|
|
8
|
+
from typing import Any, Dict, Literal, Optional, Union
|
|
9
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
ToolExecutionEntryObject = Literal["entry"]
|
|
13
13
|
|
|
14
14
|
ToolExecutionEntryType = Literal["tool.execution"]
|
|
15
15
|
|
|
16
|
+
NameTypedDict = TypeAliasType("NameTypedDict", Union[BuiltInConnectors, str])
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Name = TypeAliasType("Name", Union[BuiltInConnectors, str])
|
|
20
|
+
|
|
16
21
|
|
|
17
22
|
class ToolExecutionEntryTypedDict(TypedDict):
|
|
18
|
-
name:
|
|
23
|
+
name: NameTypedDict
|
|
19
24
|
arguments: str
|
|
20
25
|
object: NotRequired[ToolExecutionEntryObject]
|
|
21
26
|
type: NotRequired[ToolExecutionEntryType]
|
|
@@ -26,7 +31,7 @@ class ToolExecutionEntryTypedDict(TypedDict):
|
|
|
26
31
|
|
|
27
32
|
|
|
28
33
|
class ToolExecutionEntry(BaseModel):
|
|
29
|
-
name:
|
|
34
|
+
name: Name
|
|
30
35
|
|
|
31
36
|
arguments: str
|
|
32
37
|
|
|
@@ -4,16 +4,25 @@ from __future__ import annotations
|
|
|
4
4
|
from .builtinconnectors import BuiltInConnectors
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
from mistralai.types import BaseModel
|
|
7
|
-
from typing import Literal, Optional
|
|
8
|
-
from typing_extensions import NotRequired, TypedDict
|
|
7
|
+
from typing import Literal, Optional, Union
|
|
8
|
+
from typing_extensions import NotRequired, TypeAliasType, TypedDict
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
ToolExecutionStartedEventType = Literal["tool.execution.started"]
|
|
12
12
|
|
|
13
|
+
ToolExecutionStartedEventNameTypedDict = TypeAliasType(
|
|
14
|
+
"ToolExecutionStartedEventNameTypedDict", Union[BuiltInConnectors, str]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
ToolExecutionStartedEventName = TypeAliasType(
|
|
19
|
+
"ToolExecutionStartedEventName", Union[BuiltInConnectors, str]
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
|
|
14
23
|
class ToolExecutionStartedEventTypedDict(TypedDict):
|
|
15
24
|
id: str
|
|
16
|
-
name:
|
|
25
|
+
name: ToolExecutionStartedEventNameTypedDict
|
|
17
26
|
arguments: str
|
|
18
27
|
type: NotRequired[ToolExecutionStartedEventType]
|
|
19
28
|
created_at: NotRequired[datetime]
|
|
@@ -23,7 +32,7 @@ class ToolExecutionStartedEventTypedDict(TypedDict):
|
|
|
23
32
|
class ToolExecutionStartedEvent(BaseModel):
|
|
24
33
|
id: str
|
|
25
34
|
|
|
26
|
-
name:
|
|
35
|
+
name: ToolExecutionStartedEventName
|
|
27
36
|
|
|
28
37
|
arguments: str
|
|
29
38
|
|