mistralai 1.9.11__py3-none-any.whl → 1.10.1__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.
Files changed (151) hide show
  1. mistralai/_hooks/registration.py +5 -0
  2. mistralai/_hooks/tracing.py +75 -0
  3. mistralai/_version.py +2 -2
  4. mistralai/accesses.py +8 -8
  5. mistralai/agents.py +29 -17
  6. mistralai/chat.py +41 -29
  7. mistralai/classifiers.py +13 -1
  8. mistralai/conversations.py +294 -62
  9. mistralai/documents.py +19 -3
  10. mistralai/embeddings.py +13 -7
  11. mistralai/extra/README.md +1 -1
  12. mistralai/extra/mcp/auth.py +10 -11
  13. mistralai/extra/mcp/base.py +17 -16
  14. mistralai/extra/mcp/sse.py +13 -15
  15. mistralai/extra/mcp/stdio.py +5 -6
  16. mistralai/extra/observability/__init__.py +15 -0
  17. mistralai/extra/observability/otel.py +372 -0
  18. mistralai/extra/run/context.py +33 -43
  19. mistralai/extra/run/result.py +29 -30
  20. mistralai/extra/run/tools.py +34 -23
  21. mistralai/extra/struct_chat.py +15 -8
  22. mistralai/extra/utils/response_format.py +5 -3
  23. mistralai/files.py +6 -0
  24. mistralai/fim.py +17 -5
  25. mistralai/mistral_agents.py +229 -1
  26. mistralai/mistral_jobs.py +39 -13
  27. mistralai/models/__init__.py +99 -3
  28. mistralai/models/agent.py +15 -2
  29. mistralai/models/agentconversation.py +11 -3
  30. mistralai/models/agentcreationrequest.py +6 -2
  31. mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
  32. mistralai/models/agents_api_v1_agents_getop.py +40 -3
  33. mistralai/models/agents_api_v1_agents_listop.py +72 -2
  34. mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
  35. mistralai/models/agents_api_v1_conversations_listop.py +39 -2
  36. mistralai/models/agentscompletionrequest.py +21 -6
  37. mistralai/models/agentscompletionstreamrequest.py +21 -6
  38. mistralai/models/agentupdaterequest.py +18 -2
  39. mistralai/models/audioencoding.py +13 -0
  40. mistralai/models/audioformat.py +19 -0
  41. mistralai/models/audiotranscriptionrequest.py +2 -0
  42. mistralai/models/batchjobin.py +26 -5
  43. mistralai/models/batchjobout.py +5 -0
  44. mistralai/models/batchrequest.py +48 -0
  45. mistralai/models/chatcompletionrequest.py +22 -5
  46. mistralai/models/chatcompletionstreamrequest.py +22 -5
  47. mistralai/models/classificationrequest.py +37 -3
  48. mistralai/models/conversationrequest.py +15 -4
  49. mistralai/models/conversationrestartrequest.py +50 -2
  50. mistralai/models/conversationrestartstreamrequest.py +50 -2
  51. mistralai/models/conversationstreamrequest.py +15 -4
  52. mistralai/models/documentout.py +26 -10
  53. mistralai/models/documentupdatein.py +24 -3
  54. mistralai/models/embeddingrequest.py +19 -11
  55. mistralai/models/files_api_routes_list_filesop.py +7 -0
  56. mistralai/models/fimcompletionrequest.py +8 -9
  57. mistralai/models/fimcompletionstreamrequest.py +8 -9
  58. mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
  59. mistralai/models/libraries_documents_list_v1op.py +15 -2
  60. mistralai/models/libraryout.py +10 -7
  61. mistralai/models/listfilesout.py +35 -4
  62. mistralai/models/modelcapabilities.py +13 -4
  63. mistralai/models/modelconversation.py +8 -2
  64. mistralai/models/ocrpageobject.py +26 -5
  65. mistralai/models/ocrrequest.py +17 -1
  66. mistralai/models/ocrtableobject.py +31 -0
  67. mistralai/models/prediction.py +4 -0
  68. mistralai/models/requestsource.py +7 -0
  69. mistralai/models/responseformat.py +4 -2
  70. mistralai/models/responseformats.py +0 -1
  71. mistralai/models/sharingdelete.py +36 -5
  72. mistralai/models/sharingin.py +36 -5
  73. mistralai/models/sharingout.py +3 -3
  74. mistralai/models/toolexecutiondeltaevent.py +13 -4
  75. mistralai/models/toolexecutiondoneevent.py +13 -4
  76. mistralai/models/toolexecutionentry.py +9 -4
  77. mistralai/models/toolexecutionstartedevent.py +13 -4
  78. mistralai/models/toolfilechunk.py +11 -4
  79. mistralai/models/toolreferencechunk.py +13 -4
  80. mistralai/models_.py +2 -14
  81. mistralai/ocr.py +18 -0
  82. mistralai/transcriptions.py +4 -4
  83. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/METADATA +162 -152
  84. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/RECORD +168 -144
  85. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/WHEEL +1 -1
  86. mistralai_azure/_version.py +3 -3
  87. mistralai_azure/basesdk.py +15 -5
  88. mistralai_azure/chat.py +59 -98
  89. mistralai_azure/models/__init__.py +50 -3
  90. mistralai_azure/models/chatcompletionrequest.py +16 -4
  91. mistralai_azure/models/chatcompletionstreamrequest.py +16 -4
  92. mistralai_azure/models/httpvalidationerror.py +11 -6
  93. mistralai_azure/models/mistralazureerror.py +26 -0
  94. mistralai_azure/models/no_response_error.py +13 -0
  95. mistralai_azure/models/prediction.py +4 -0
  96. mistralai_azure/models/responseformat.py +4 -2
  97. mistralai_azure/models/responseformats.py +0 -1
  98. mistralai_azure/models/responsevalidationerror.py +25 -0
  99. mistralai_azure/models/sdkerror.py +30 -14
  100. mistralai_azure/models/systemmessage.py +7 -3
  101. mistralai_azure/models/systemmessagecontentchunks.py +21 -0
  102. mistralai_azure/models/thinkchunk.py +35 -0
  103. mistralai_azure/ocr.py +15 -36
  104. mistralai_azure/utils/__init__.py +18 -5
  105. mistralai_azure/utils/eventstreaming.py +10 -0
  106. mistralai_azure/utils/serializers.py +3 -2
  107. mistralai_azure/utils/unmarshal_json_response.py +24 -0
  108. mistralai_gcp/_hooks/types.py +7 -0
  109. mistralai_gcp/_version.py +4 -4
  110. mistralai_gcp/basesdk.py +27 -25
  111. mistralai_gcp/chat.py +75 -98
  112. mistralai_gcp/fim.py +39 -74
  113. mistralai_gcp/httpclient.py +6 -16
  114. mistralai_gcp/models/__init__.py +321 -116
  115. mistralai_gcp/models/assistantmessage.py +1 -1
  116. mistralai_gcp/models/chatcompletionrequest.py +36 -7
  117. mistralai_gcp/models/chatcompletionresponse.py +6 -6
  118. mistralai_gcp/models/chatcompletionstreamrequest.py +36 -7
  119. mistralai_gcp/models/completionresponsestreamchoice.py +1 -1
  120. mistralai_gcp/models/deltamessage.py +1 -1
  121. mistralai_gcp/models/fimcompletionrequest.py +3 -9
  122. mistralai_gcp/models/fimcompletionresponse.py +6 -6
  123. mistralai_gcp/models/fimcompletionstreamrequest.py +3 -9
  124. mistralai_gcp/models/httpvalidationerror.py +11 -6
  125. mistralai_gcp/models/imageurl.py +1 -1
  126. mistralai_gcp/models/jsonschema.py +1 -1
  127. mistralai_gcp/models/mistralgcperror.py +26 -0
  128. mistralai_gcp/models/mistralpromptmode.py +8 -0
  129. mistralai_gcp/models/no_response_error.py +13 -0
  130. mistralai_gcp/models/prediction.py +4 -0
  131. mistralai_gcp/models/responseformat.py +5 -3
  132. mistralai_gcp/models/responseformats.py +0 -1
  133. mistralai_gcp/models/responsevalidationerror.py +25 -0
  134. mistralai_gcp/models/sdkerror.py +30 -14
  135. mistralai_gcp/models/systemmessage.py +7 -3
  136. mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
  137. mistralai_gcp/models/thinkchunk.py +35 -0
  138. mistralai_gcp/models/toolmessage.py +1 -1
  139. mistralai_gcp/models/usageinfo.py +71 -8
  140. mistralai_gcp/models/usermessage.py +1 -1
  141. mistralai_gcp/sdk.py +12 -10
  142. mistralai_gcp/sdkconfiguration.py +0 -7
  143. mistralai_gcp/types/basemodel.py +3 -3
  144. mistralai_gcp/utils/__init__.py +143 -45
  145. mistralai_gcp/utils/datetimes.py +23 -0
  146. mistralai_gcp/utils/enums.py +67 -27
  147. mistralai_gcp/utils/eventstreaming.py +10 -0
  148. mistralai_gcp/utils/forms.py +49 -28
  149. mistralai_gcp/utils/serializers.py +33 -3
  150. mistralai_gcp/utils/unmarshal_json_response.py +24 -0
  151. {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/licenses/LICENSE +0 -0
@@ -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
@@ -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
@@ -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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
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: BuiltInConnectors
35
+ name: ToolExecutionStartedEventName
27
36
 
28
37
  arguments: str
29
38
 
@@ -4,15 +4,22 @@ from __future__ import annotations
4
4
  from .builtinconnectors import BuiltInConnectors
5
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
6
  from pydantic import model_serializer
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
  ToolFileChunkType = Literal["tool_file"]
12
12
 
13
+ ToolFileChunkToolTypedDict = TypeAliasType(
14
+ "ToolFileChunkToolTypedDict", Union[BuiltInConnectors, str]
15
+ )
16
+
17
+
18
+ ToolFileChunkTool = TypeAliasType("ToolFileChunkTool", Union[BuiltInConnectors, str])
19
+
13
20
 
14
21
  class ToolFileChunkTypedDict(TypedDict):
15
- tool: BuiltInConnectors
22
+ tool: ToolFileChunkToolTypedDict
16
23
  file_id: str
17
24
  type: NotRequired[ToolFileChunkType]
18
25
  file_name: NotRequired[Nullable[str]]
@@ -20,7 +27,7 @@ class ToolFileChunkTypedDict(TypedDict):
20
27
 
21
28
 
22
29
  class ToolFileChunk(BaseModel):
23
- tool: BuiltInConnectors
30
+ tool: ToolFileChunkTool
24
31
 
25
32
  file_id: str
26
33
 
@@ -4,15 +4,24 @@ from __future__ import annotations
4
4
  from .builtinconnectors import BuiltInConnectors
5
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
6
  from pydantic import model_serializer
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
  ToolReferenceChunkType = Literal["tool_reference"]
12
12
 
13
+ ToolReferenceChunkToolTypedDict = TypeAliasType(
14
+ "ToolReferenceChunkToolTypedDict", Union[BuiltInConnectors, str]
15
+ )
16
+
17
+
18
+ ToolReferenceChunkTool = TypeAliasType(
19
+ "ToolReferenceChunkTool", Union[BuiltInConnectors, str]
20
+ )
21
+
13
22
 
14
23
  class ToolReferenceChunkTypedDict(TypedDict):
15
- tool: BuiltInConnectors
24
+ tool: ToolReferenceChunkToolTypedDict
16
25
  title: str
17
26
  type: NotRequired[ToolReferenceChunkType]
18
27
  url: NotRequired[Nullable[str]]
@@ -21,7 +30,7 @@ class ToolReferenceChunkTypedDict(TypedDict):
21
30
 
22
31
 
23
32
  class ToolReferenceChunk(BaseModel):
24
- tool: BuiltInConnectors
33
+ tool: ToolReferenceChunkTool
25
34
 
26
35
  title: str
27
36
 
mistralai/models_.py CHANGED
@@ -73,18 +73,12 @@ class Models(BaseSDK):
73
73
  ),
74
74
  ),
75
75
  request=req,
76
- error_status_codes=["422", "4XX", "5XX"],
76
+ error_status_codes=["4XX", "5XX"],
77
77
  retry_config=retry_config,
78
78
  )
79
79
 
80
- response_data: Any = None
81
80
  if utils.match_response(http_res, "200", "application/json"):
82
81
  return unmarshal_json_response(models.ModelList, http_res)
83
- if utils.match_response(http_res, "422", "application/json"):
84
- response_data = unmarshal_json_response(
85
- models.HTTPValidationErrorData, http_res
86
- )
87
- raise models.HTTPValidationError(response_data, http_res)
88
82
  if utils.match_response(http_res, "4XX", "*"):
89
83
  http_res_text = utils.stream_to_text(http_res)
90
84
  raise models.SDKError("API error occurred", http_res, http_res_text)
@@ -155,18 +149,12 @@ class Models(BaseSDK):
155
149
  ),
156
150
  ),
157
151
  request=req,
158
- error_status_codes=["422", "4XX", "5XX"],
152
+ error_status_codes=["4XX", "5XX"],
159
153
  retry_config=retry_config,
160
154
  )
161
155
 
162
- response_data: Any = None
163
156
  if utils.match_response(http_res, "200", "application/json"):
164
157
  return unmarshal_json_response(models.ModelList, http_res)
165
- if utils.match_response(http_res, "422", "application/json"):
166
- response_data = unmarshal_json_response(
167
- models.HTTPValidationErrorData, http_res
168
- )
169
- raise models.HTTPValidationError(response_data, http_res)
170
158
  if utils.match_response(http_res, "4XX", "*"):
171
159
  http_res_text = await utils.stream_to_text_async(http_res)
172
160
  raise models.SDKError("API error occurred", http_res, http_res_text)
mistralai/ocr.py CHANGED
@@ -28,6 +28,9 @@ class Ocr(BaseSDK):
28
28
  document_annotation_format: OptionalNullable[
29
29
  Union[models.ResponseFormat, models.ResponseFormatTypedDict]
30
30
  ] = UNSET,
31
+ table_format: OptionalNullable[models.TableFormat] = UNSET,
32
+ extract_header: Optional[bool] = None,
33
+ extract_footer: Optional[bool] = None,
31
34
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
32
35
  server_url: Optional[str] = None,
33
36
  timeout_ms: Optional[int] = None,
@@ -44,6 +47,9 @@ class Ocr(BaseSDK):
44
47
  :param image_min_size: Minimum height and width of image to extract
45
48
  :param bbox_annotation_format: Structured output class for extracting useful information from each extracted bounding box / image from document. Only json_schema is valid for this field
46
49
  :param document_annotation_format: Structured output class for extracting useful information from the entire document. Only json_schema is valid for this field
50
+ :param table_format:
51
+ :param extract_header:
52
+ :param extract_footer:
47
53
  :param retries: Override the default retry configuration for this method
48
54
  :param server_url: Override the default server URL for this method
49
55
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -73,6 +79,9 @@ class Ocr(BaseSDK):
73
79
  document_annotation_format=utils.get_pydantic_model(
74
80
  document_annotation_format, OptionalNullable[models.ResponseFormat]
75
81
  ),
82
+ table_format=table_format,
83
+ extract_header=extract_header,
84
+ extract_footer=extract_footer,
76
85
  )
77
86
 
78
87
  req = self._build_request(
@@ -150,6 +159,9 @@ class Ocr(BaseSDK):
150
159
  document_annotation_format: OptionalNullable[
151
160
  Union[models.ResponseFormat, models.ResponseFormatTypedDict]
152
161
  ] = UNSET,
162
+ table_format: OptionalNullable[models.TableFormat] = UNSET,
163
+ extract_header: Optional[bool] = None,
164
+ extract_footer: Optional[bool] = None,
153
165
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
154
166
  server_url: Optional[str] = None,
155
167
  timeout_ms: Optional[int] = None,
@@ -166,6 +178,9 @@ class Ocr(BaseSDK):
166
178
  :param image_min_size: Minimum height and width of image to extract
167
179
  :param bbox_annotation_format: Structured output class for extracting useful information from each extracted bounding box / image from document. Only json_schema is valid for this field
168
180
  :param document_annotation_format: Structured output class for extracting useful information from the entire document. Only json_schema is valid for this field
181
+ :param table_format:
182
+ :param extract_header:
183
+ :param extract_footer:
169
184
  :param retries: Override the default retry configuration for this method
170
185
  :param server_url: Override the default server URL for this method
171
186
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -195,6 +210,9 @@ class Ocr(BaseSDK):
195
210
  document_annotation_format=utils.get_pydantic_model(
196
211
  document_annotation_format, OptionalNullable[models.ResponseFormat]
197
212
  ),
213
+ table_format=table_format,
214
+ extract_header=extract_header,
215
+ extract_footer=extract_footer,
198
216
  )
199
217
 
200
218
  req = self._build_request_async(
@@ -29,7 +29,7 @@ class Transcriptions(BaseSDK):
29
29
  ) -> models.TranscriptionResponse:
30
30
  r"""Create Transcription
31
31
 
32
- :param model:
32
+ :param model: ID of the model to be used.
33
33
  :param file:
34
34
  :param file_url: Url of a file to be transcribed
35
35
  :param file_id: ID of a file uploaded to /v1/files
@@ -131,7 +131,7 @@ class Transcriptions(BaseSDK):
131
131
  ) -> models.TranscriptionResponse:
132
132
  r"""Create Transcription
133
133
 
134
- :param model:
134
+ :param model: ID of the model to be used.
135
135
  :param file:
136
136
  :param file_url: Url of a file to be transcribed
137
137
  :param file_id: ID of a file uploaded to /v1/files
@@ -231,7 +231,7 @@ class Transcriptions(BaseSDK):
231
231
  timeout_ms: Optional[int] = None,
232
232
  http_headers: Optional[Mapping[str, str]] = None,
233
233
  ) -> eventstreaming.EventStream[models.TranscriptionStreamEvents]:
234
- r"""Create streaming transcription (SSE)
234
+ r"""Create Streaming Transcription (SSE)
235
235
 
236
236
  :param model:
237
237
  :param file:
@@ -343,7 +343,7 @@ class Transcriptions(BaseSDK):
343
343
  timeout_ms: Optional[int] = None,
344
344
  http_headers: Optional[Mapping[str, str]] = None,
345
345
  ) -> eventstreaming.EventStreamAsync[models.TranscriptionStreamEvents]:
346
- r"""Create streaming transcription (SSE)
346
+ r"""Create Streaming Transcription (SSE)
347
347
 
348
348
  :param model:
349
349
  :param file: