mistralai 1.2.2__py3-none-any.whl → 1.2.4__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 (89) hide show
  1. mistralai/_version.py +1 -1
  2. mistralai/agents.py +5 -5
  3. mistralai/chat.py +5 -5
  4. mistralai/files.py +166 -0
  5. mistralai/fim.py +5 -5
  6. mistralai/httpclient.py +6 -0
  7. mistralai/jobs.py +2 -2
  8. mistralai/models/__init__.py +22 -3
  9. mistralai/models/agentscompletionrequest.py +23 -11
  10. mistralai/models/agentscompletionstreamrequest.py +23 -13
  11. mistralai/models/apiendpoint.py +11 -3
  12. mistralai/models/assistantmessage.py +7 -3
  13. mistralai/models/batchjobin.py +4 -2
  14. mistralai/models/chatclassificationrequest.py +26 -17
  15. mistralai/models/chatcompletionrequest.py +19 -11
  16. mistralai/models/chatcompletionstreamrequest.py +23 -13
  17. mistralai/models/classificationrequest.py +7 -3
  18. mistralai/models/contentchunk.py +9 -3
  19. mistralai/models/deltamessage.py +5 -3
  20. mistralai/models/detailedjobout.py +2 -3
  21. mistralai/models/embeddingrequest.py +3 -3
  22. mistralai/models/files_api_routes_get_signed_urlop.py +25 -0
  23. mistralai/models/filesignedurl.py +13 -0
  24. mistralai/models/fimcompletionrequest.py +7 -3
  25. mistralai/models/fimcompletionstreamrequest.py +7 -3
  26. mistralai/models/functioncall.py +3 -3
  27. mistralai/models/imageurlchunk.py +9 -14
  28. mistralai/models/jobin.py +2 -3
  29. mistralai/models/jobout.py +2 -3
  30. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +9 -4
  31. mistralai/models/modellist.py +4 -2
  32. mistralai/models/referencechunk.py +20 -0
  33. mistralai/models/retrieve_model_v1_models_model_id_getop.py +5 -4
  34. mistralai/models/systemmessage.py +7 -3
  35. mistralai/models/textchunk.py +3 -9
  36. mistralai/models/toolmessage.py +14 -5
  37. mistralai/models/usermessage.py +5 -3
  38. mistralai/models/validationerror.py +3 -3
  39. mistralai/sdk.py +14 -0
  40. mistralai/sdkconfiguration.py +3 -3
  41. mistralai/utils/annotations.py +42 -17
  42. mistralai/utils/eventstreaming.py +61 -1
  43. {mistralai-1.2.2.dist-info → mistralai-1.2.4.dist-info}/METADATA +181 -176
  44. {mistralai-1.2.2.dist-info → mistralai-1.2.4.dist-info}/RECORD +88 -84
  45. mistralai_azure/_version.py +1 -1
  46. mistralai_azure/chat.py +5 -5
  47. mistralai_azure/httpclient.py +6 -0
  48. mistralai_azure/models/__init__.py +13 -1
  49. mistralai_azure/models/assistantmessage.py +7 -3
  50. mistralai_azure/models/chatcompletionrequest.py +23 -11
  51. mistralai_azure/models/chatcompletionstreamrequest.py +19 -13
  52. mistralai_azure/models/contentchunk.py +14 -2
  53. mistralai_azure/models/deltamessage.py +5 -3
  54. mistralai_azure/models/functioncall.py +3 -3
  55. mistralai_azure/models/referencechunk.py +20 -0
  56. mistralai_azure/models/systemmessage.py +7 -3
  57. mistralai_azure/models/textchunk.py +3 -9
  58. mistralai_azure/models/toolmessage.py +14 -5
  59. mistralai_azure/models/usermessage.py +5 -3
  60. mistralai_azure/models/validationerror.py +3 -3
  61. mistralai_azure/sdkconfiguration.py +3 -3
  62. mistralai_azure/utils/annotations.py +42 -17
  63. mistralai_azure/utils/eventstreaming.py +61 -1
  64. mistralai_gcp/_version.py +1 -1
  65. mistralai_gcp/chat.py +5 -5
  66. mistralai_gcp/fim.py +5 -5
  67. mistralai_gcp/httpclient.py +6 -0
  68. mistralai_gcp/models/__init__.py +13 -1
  69. mistralai_gcp/models/assistantmessage.py +7 -3
  70. mistralai_gcp/models/chatcompletionrequest.py +23 -11
  71. mistralai_gcp/models/chatcompletionstreamrequest.py +19 -13
  72. mistralai_gcp/models/contentchunk.py +14 -2
  73. mistralai_gcp/models/deltamessage.py +5 -3
  74. mistralai_gcp/models/fimcompletionrequest.py +7 -3
  75. mistralai_gcp/models/fimcompletionstreamrequest.py +7 -3
  76. mistralai_gcp/models/functioncall.py +3 -3
  77. mistralai_gcp/models/referencechunk.py +20 -0
  78. mistralai_gcp/models/systemmessage.py +7 -3
  79. mistralai_gcp/models/textchunk.py +3 -9
  80. mistralai_gcp/models/toolmessage.py +14 -5
  81. mistralai_gcp/models/usermessage.py +5 -3
  82. mistralai_gcp/models/validationerror.py +3 -3
  83. mistralai_gcp/sdk.py +5 -4
  84. mistralai_gcp/sdkconfiguration.py +3 -3
  85. mistralai_gcp/utils/annotations.py +42 -17
  86. mistralai_gcp/utils/eventstreaming.py +61 -1
  87. mistralai/models/finetuneablemodel.py +0 -14
  88. {mistralai-1.2.2.dist-info → mistralai-1.2.4.dist-info}/LICENSE +0 -0
  89. {mistralai-1.2.2.dist-info → mistralai-1.2.4.dist-info}/WHEEL +0 -0
@@ -10,15 +10,18 @@ from mistralai.utils import get_discriminator
10
10
  import pydantic
11
11
  from pydantic import Discriminator, Tag, model_serializer
12
12
  from typing import List, Union
13
- from typing_extensions import Annotated, TypedDict
13
+ from typing_extensions import Annotated, TypeAliasType, TypedDict
14
14
 
15
15
 
16
- TwoTypedDict = Union[
17
- SystemMessageTypedDict,
18
- UserMessageTypedDict,
19
- AssistantMessageTypedDict,
20
- ToolMessageTypedDict,
21
- ]
16
+ TwoTypedDict = TypeAliasType(
17
+ "TwoTypedDict",
18
+ Union[
19
+ SystemMessageTypedDict,
20
+ UserMessageTypedDict,
21
+ AssistantMessageTypedDict,
22
+ ToolMessageTypedDict,
23
+ ],
24
+ )
22
25
 
23
26
 
24
27
  Two = Annotated[
@@ -32,12 +35,15 @@ Two = Annotated[
32
35
  ]
33
36
 
34
37
 
35
- OneTypedDict = Union[
36
- SystemMessageTypedDict,
37
- UserMessageTypedDict,
38
- AssistantMessageTypedDict,
39
- ToolMessageTypedDict,
40
- ]
38
+ OneTypedDict = TypeAliasType(
39
+ "OneTypedDict",
40
+ Union[
41
+ SystemMessageTypedDict,
42
+ UserMessageTypedDict,
43
+ AssistantMessageTypedDict,
44
+ ToolMessageTypedDict,
45
+ ],
46
+ )
41
47
 
42
48
 
43
49
  One = Annotated[
@@ -51,13 +57,16 @@ One = Annotated[
51
57
  ]
52
58
 
53
59
 
54
- ChatClassificationRequestInputsTypedDict = Union[
55
- List[OneTypedDict], List[List[TwoTypedDict]]
56
- ]
60
+ ChatClassificationRequestInputsTypedDict = TypeAliasType(
61
+ "ChatClassificationRequestInputsTypedDict",
62
+ Union[List[OneTypedDict], List[List[TwoTypedDict]]],
63
+ )
57
64
  r"""Chat to classify"""
58
65
 
59
66
 
60
- ChatClassificationRequestInputs = Union[List[One], List[List[Two]]]
67
+ ChatClassificationRequestInputs = TypeAliasType(
68
+ "ChatClassificationRequestInputs", Union[List[One], List[List[Two]]]
69
+ )
61
70
  r"""Chat to classify"""
62
71
 
63
72
 
@@ -13,23 +13,26 @@ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_
13
13
  from mistralai.utils import get_discriminator
14
14
  from pydantic import Discriminator, Tag, model_serializer
15
15
  from typing import List, Optional, Union
16
- from typing_extensions import Annotated, NotRequired, TypedDict
16
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
19
- StopTypedDict = Union[str, List[str]]
19
+ StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]])
20
20
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
21
21
 
22
22
 
23
- Stop = Union[str, List[str]]
23
+ Stop = TypeAliasType("Stop", Union[str, List[str]])
24
24
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
25
25
 
26
26
 
27
- MessagesTypedDict = Union[
28
- SystemMessageTypedDict,
29
- UserMessageTypedDict,
30
- AssistantMessageTypedDict,
31
- ToolMessageTypedDict,
32
- ]
27
+ MessagesTypedDict = TypeAliasType(
28
+ "MessagesTypedDict",
29
+ Union[
30
+ SystemMessageTypedDict,
31
+ UserMessageTypedDict,
32
+ AssistantMessageTypedDict,
33
+ ToolMessageTypedDict,
34
+ ],
35
+ )
33
36
 
34
37
 
35
38
  Messages = Annotated[
@@ -43,10 +46,15 @@ Messages = Annotated[
43
46
  ]
44
47
 
45
48
 
46
- ChatCompletionRequestToolChoiceTypedDict = Union[ToolChoiceTypedDict, ToolChoiceEnum]
49
+ ChatCompletionRequestToolChoiceTypedDict = TypeAliasType(
50
+ "ChatCompletionRequestToolChoiceTypedDict",
51
+ Union[ToolChoiceTypedDict, ToolChoiceEnum],
52
+ )
47
53
 
48
54
 
49
- ChatCompletionRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
55
+ ChatCompletionRequestToolChoice = TypeAliasType(
56
+ "ChatCompletionRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
57
+ )
50
58
 
51
59
 
52
60
  class ChatCompletionRequestTypedDict(TypedDict):
@@ -13,23 +13,30 @@ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_
13
13
  from mistralai.utils import get_discriminator
14
14
  from pydantic import Discriminator, Tag, model_serializer
15
15
  from typing import List, Optional, Union
16
- from typing_extensions import Annotated, NotRequired, TypedDict
16
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
17
17
 
18
18
 
19
- ChatCompletionStreamRequestStopTypedDict = Union[str, List[str]]
19
+ ChatCompletionStreamRequestStopTypedDict = TypeAliasType(
20
+ "ChatCompletionStreamRequestStopTypedDict", Union[str, List[str]]
21
+ )
20
22
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
21
23
 
22
24
 
23
- ChatCompletionStreamRequestStop = Union[str, List[str]]
25
+ ChatCompletionStreamRequestStop = TypeAliasType(
26
+ "ChatCompletionStreamRequestStop", Union[str, List[str]]
27
+ )
24
28
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
25
29
 
26
30
 
27
- ChatCompletionStreamRequestMessagesTypedDict = Union[
28
- SystemMessageTypedDict,
29
- UserMessageTypedDict,
30
- AssistantMessageTypedDict,
31
- ToolMessageTypedDict,
32
- ]
31
+ ChatCompletionStreamRequestMessagesTypedDict = TypeAliasType(
32
+ "ChatCompletionStreamRequestMessagesTypedDict",
33
+ Union[
34
+ SystemMessageTypedDict,
35
+ UserMessageTypedDict,
36
+ AssistantMessageTypedDict,
37
+ ToolMessageTypedDict,
38
+ ],
39
+ )
33
40
 
34
41
 
35
42
  ChatCompletionStreamRequestMessages = Annotated[
@@ -43,12 +50,15 @@ ChatCompletionStreamRequestMessages = Annotated[
43
50
  ]
44
51
 
45
52
 
46
- ChatCompletionStreamRequestToolChoiceTypedDict = Union[
47
- ToolChoiceTypedDict, ToolChoiceEnum
48
- ]
53
+ ChatCompletionStreamRequestToolChoiceTypedDict = TypeAliasType(
54
+ "ChatCompletionStreamRequestToolChoiceTypedDict",
55
+ Union[ToolChoiceTypedDict, ToolChoiceEnum],
56
+ )
49
57
 
50
58
 
51
- ChatCompletionStreamRequestToolChoice = Union[ToolChoice, ToolChoiceEnum]
59
+ ChatCompletionStreamRequestToolChoice = TypeAliasType(
60
+ "ChatCompletionStreamRequestToolChoice", Union[ToolChoice, ToolChoiceEnum]
61
+ )
52
62
 
53
63
 
54
64
  class ChatCompletionStreamRequestTypedDict(TypedDict):
@@ -5,14 +5,18 @@ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_
5
5
  import pydantic
6
6
  from pydantic import model_serializer
7
7
  from typing import List, Union
8
- from typing_extensions import Annotated, NotRequired, TypedDict
8
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
9
9
 
10
10
 
11
- ClassificationRequestInputsTypedDict = Union[str, List[str]]
11
+ ClassificationRequestInputsTypedDict = TypeAliasType(
12
+ "ClassificationRequestInputsTypedDict", Union[str, List[str]]
13
+ )
12
14
  r"""Text to classify."""
13
15
 
14
16
 
15
- ClassificationRequestInputs = Union[str, List[str]]
17
+ ClassificationRequestInputs = TypeAliasType(
18
+ "ClassificationRequestInputs", Union[str, List[str]]
19
+ )
16
20
  r"""Text to classify."""
17
21
 
18
22
 
@@ -2,19 +2,25 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
5
+ from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
5
6
  from .textchunk import TextChunk, TextChunkTypedDict
6
7
  from mistralai.utils import get_discriminator
7
8
  from pydantic import Discriminator, Tag
8
9
  from typing import Union
9
- from typing_extensions import Annotated
10
+ from typing_extensions import Annotated, TypeAliasType
10
11
 
11
12
 
12
- ContentChunkTypedDict = Union[TextChunkTypedDict, ImageURLChunkTypedDict]
13
+ ContentChunkTypedDict = TypeAliasType(
14
+ "ContentChunkTypedDict",
15
+ Union[TextChunkTypedDict, ImageURLChunkTypedDict, ReferenceChunkTypedDict],
16
+ )
13
17
 
14
18
 
15
19
  ContentChunk = Annotated[
16
20
  Union[
17
- Annotated[ImageURLChunk, Tag("image_url")], Annotated[TextChunk, Tag("text")]
21
+ Annotated[ImageURLChunk, Tag("image_url")],
22
+ Annotated[TextChunk, Tag("text")],
23
+ Annotated[ReferenceChunk, Tag("reference")],
18
24
  ],
19
25
  Discriminator(lambda m: get_discriminator(m, "type", "type")),
20
26
  ]
@@ -6,13 +6,15 @@ from .toolcall import ToolCall, ToolCallTypedDict
6
6
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
7
7
  from pydantic import model_serializer
8
8
  from typing import List, Union
9
- from typing_extensions import NotRequired, TypedDict
9
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
10
10
 
11
11
 
12
- ContentTypedDict = Union[str, List[ContentChunkTypedDict]]
12
+ ContentTypedDict = TypeAliasType(
13
+ "ContentTypedDict", Union[str, List[ContentChunkTypedDict]]
14
+ )
13
15
 
14
16
 
15
- Content = Union[str, List[ContentChunk]]
17
+ Content = TypeAliasType("Content", Union[str, List[ContentChunk]])
16
18
 
17
19
 
18
20
  class DeltaMessageTypedDict(TypedDict):
@@ -3,7 +3,6 @@
3
3
  from __future__ import annotations
4
4
  from .checkpointout import CheckpointOut, CheckpointOutTypedDict
5
5
  from .eventout import EventOut, EventOutTypedDict
6
- from .finetuneablemodel import FineTuneableModel
7
6
  from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
8
7
  from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
9
8
  from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
@@ -48,7 +47,7 @@ class DetailedJobOutTypedDict(TypedDict):
48
47
  id: str
49
48
  auto_start: bool
50
49
  hyperparameters: TrainingParametersTypedDict
51
- model: FineTuneableModel
50
+ model: str
52
51
  r"""The name of the model to fine-tune."""
53
52
  status: DetailedJobOutStatus
54
53
  job_type: str
@@ -75,7 +74,7 @@ class DetailedJobOut(BaseModel):
75
74
 
76
75
  hyperparameters: TrainingParameters
77
76
 
78
- model: FineTuneableModel
77
+ model: str
79
78
  r"""The name of the model to fine-tune."""
80
79
 
81
80
  status: DetailedJobOutStatus
@@ -5,14 +5,14 @@ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_
5
5
  import pydantic
6
6
  from pydantic import model_serializer
7
7
  from typing import List, Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypedDict
8
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
9
9
 
10
10
 
11
- InputsTypedDict = Union[str, List[str]]
11
+ InputsTypedDict = TypeAliasType("InputsTypedDict", Union[str, List[str]])
12
12
  r"""Text to embed."""
13
13
 
14
14
 
15
- Inputs = Union[str, List[str]]
15
+ Inputs = TypeAliasType("Inputs", Union[str, List[str]])
16
16
  r"""Text to embed."""
17
17
 
18
18
 
@@ -0,0 +1,25 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from mistralai.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
6
+ from typing import Optional
7
+ from typing_extensions import Annotated, NotRequired, TypedDict
8
+
9
+
10
+ class FilesAPIRoutesGetSignedURLRequestTypedDict(TypedDict):
11
+ file_id: str
12
+ expiry: NotRequired[int]
13
+ r"""Number of hours before the url becomes invalid. Defaults to 24h"""
14
+
15
+
16
+ class FilesAPIRoutesGetSignedURLRequest(BaseModel):
17
+ file_id: Annotated[
18
+ str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
19
+ ]
20
+
21
+ expiry: Annotated[
22
+ Optional[int],
23
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
24
+ ] = 24
25
+ r"""Number of hours before the url becomes invalid. Defaults to 24h"""
@@ -0,0 +1,13 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from typing_extensions import TypedDict
6
+
7
+
8
+ class FileSignedURLTypedDict(TypedDict):
9
+ url: str
10
+
11
+
12
+ class FileSignedURL(BaseModel):
13
+ url: str
@@ -4,14 +4,18 @@ from __future__ import annotations
4
4
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
5
  from pydantic import model_serializer
6
6
  from typing import List, Optional, Union
7
- from typing_extensions import NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
8
8
 
9
9
 
10
- FIMCompletionRequestStopTypedDict = Union[str, List[str]]
10
+ FIMCompletionRequestStopTypedDict = TypeAliasType(
11
+ "FIMCompletionRequestStopTypedDict", Union[str, List[str]]
12
+ )
11
13
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
12
14
 
13
15
 
14
- FIMCompletionRequestStop = Union[str, List[str]]
16
+ FIMCompletionRequestStop = TypeAliasType(
17
+ "FIMCompletionRequestStop", Union[str, List[str]]
18
+ )
15
19
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
16
20
 
17
21
 
@@ -4,14 +4,18 @@ from __future__ import annotations
4
4
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
5
  from pydantic import model_serializer
6
6
  from typing import List, Optional, Union
7
- from typing_extensions import NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
8
8
 
9
9
 
10
- FIMCompletionStreamRequestStopTypedDict = Union[str, List[str]]
10
+ FIMCompletionStreamRequestStopTypedDict = TypeAliasType(
11
+ "FIMCompletionStreamRequestStopTypedDict", Union[str, List[str]]
12
+ )
11
13
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
12
14
 
13
15
 
14
- FIMCompletionStreamRequestStop = Union[str, List[str]]
16
+ FIMCompletionStreamRequestStop = TypeAliasType(
17
+ "FIMCompletionStreamRequestStop", Union[str, List[str]]
18
+ )
15
19
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
16
20
 
17
21
 
@@ -3,13 +3,13 @@
3
3
  from __future__ import annotations
4
4
  from mistralai.types import BaseModel
5
5
  from typing import Any, Dict, Union
6
- from typing_extensions import TypedDict
6
+ from typing_extensions import TypeAliasType, TypedDict
7
7
 
8
8
 
9
- ArgumentsTypedDict = Union[Dict[str, Any], str]
9
+ ArgumentsTypedDict = TypeAliasType("ArgumentsTypedDict", Union[Dict[str, Any], str])
10
10
 
11
11
 
12
- Arguments = Union[Dict[str, Any], str]
12
+ Arguments = TypeAliasType("Arguments", Union[Dict[str, Any], str])
13
13
 
14
14
 
15
15
  class FunctionCallTypedDict(TypedDict):
@@ -3,26 +3,26 @@
3
3
  from __future__ import annotations
4
4
  from .imageurl import ImageURL, ImageURLTypedDict
5
5
  from mistralai.types import BaseModel
6
- from mistralai.utils import validate_const
7
- import pydantic
8
- from pydantic.functional_validators import AfterValidator
9
6
  from typing import Literal, Optional, Union
10
- from typing_extensions import Annotated, TypedDict
7
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
11
8
 
12
9
 
13
- ImageURLChunkType = Literal["image_url"]
10
+ ImageURLChunkImageURLTypedDict = TypeAliasType(
11
+ "ImageURLChunkImageURLTypedDict", Union[ImageURLTypedDict, str]
12
+ )
13
+
14
14
 
15
- ImageURLChunkImageURLTypedDict = Union[ImageURLTypedDict, str]
15
+ ImageURLChunkImageURL = TypeAliasType("ImageURLChunkImageURL", Union[ImageURL, str])
16
16
 
17
17
 
18
- ImageURLChunkImageURL = Union[ImageURL, str]
18
+ ImageURLChunkType = Literal["image_url"]
19
19
 
20
20
 
21
21
  class ImageURLChunkTypedDict(TypedDict):
22
22
  r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
23
23
 
24
24
  image_url: ImageURLChunkImageURLTypedDict
25
- type: ImageURLChunkType
25
+ type: NotRequired[ImageURLChunkType]
26
26
 
27
27
 
28
28
  class ImageURLChunk(BaseModel):
@@ -30,9 +30,4 @@ class ImageURLChunk(BaseModel):
30
30
 
31
31
  image_url: ImageURLChunkImageURL
32
32
 
33
- TYPE: Annotated[
34
- Annotated[
35
- Optional[ImageURLChunkType], AfterValidator(validate_const("image_url"))
36
- ],
37
- pydantic.Field(alias="type"),
38
- ] = "image_url"
33
+ type: Optional[ImageURLChunkType] = "image_url"
mistralai/models/jobin.py CHANGED
@@ -1,7 +1,6 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .finetuneablemodel import FineTuneableModel
5
4
  from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
6
5
  from .trainingfile import TrainingFile, TrainingFileTypedDict
7
6
  from .trainingparametersin import TrainingParametersIn, TrainingParametersInTypedDict
@@ -25,7 +24,7 @@ JobInRepositories = GithubRepositoryIn
25
24
 
26
25
 
27
26
  class JobInTypedDict(TypedDict):
28
- model: FineTuneableModel
27
+ model: str
29
28
  r"""The name of the model to fine-tune."""
30
29
  hyperparameters: TrainingParametersInTypedDict
31
30
  r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
@@ -42,7 +41,7 @@ class JobInTypedDict(TypedDict):
42
41
 
43
42
 
44
43
  class JobIn(BaseModel):
45
- model: FineTuneableModel
44
+ model: str
46
45
  r"""The name of the model to fine-tune."""
47
46
 
48
47
  hyperparameters: TrainingParametersIn
@@ -1,7 +1,6 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .finetuneablemodel import FineTuneableModel
5
4
  from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
6
5
  from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
7
6
  from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
@@ -49,7 +48,7 @@ class JobOutTypedDict(TypedDict):
49
48
  r"""The ID of the job."""
50
49
  auto_start: bool
51
50
  hyperparameters: TrainingParametersTypedDict
52
- model: FineTuneableModel
51
+ model: str
53
52
  r"""The name of the model to fine-tune."""
54
53
  status: Status
55
54
  r"""The current status of the fine-tuning job."""
@@ -85,7 +84,7 @@ class JobOut(BaseModel):
85
84
 
86
85
  hyperparameters: TrainingParameters
87
86
 
88
- model: FineTuneableModel
87
+ model: str
89
88
  r"""The name of the model to fine-tune."""
90
89
 
91
90
  status: Status
@@ -4,13 +4,18 @@ from __future__ import annotations
4
4
  from .jobout import JobOut, JobOutTypedDict
5
5
  from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
6
6
  from typing import Union
7
+ from typing_extensions import TypeAliasType
7
8
 
8
9
 
9
- JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = Union[
10
- LegacyJobMetadataOutTypedDict, JobOutTypedDict
11
- ]
10
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict = TypeAliasType(
11
+ "JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict",
12
+ Union[LegacyJobMetadataOutTypedDict, JobOutTypedDict],
13
+ )
12
14
  r"""OK"""
13
15
 
14
16
 
15
- JobsAPIRoutesFineTuningCreateFineTuningJobResponse = Union[LegacyJobMetadataOut, JobOut]
17
+ JobsAPIRoutesFineTuningCreateFineTuningJobResponse = TypeAliasType(
18
+ "JobsAPIRoutesFineTuningCreateFineTuningJobResponse",
19
+ Union[LegacyJobMetadataOut, JobOut],
20
+ )
16
21
  r"""OK"""
@@ -7,10 +7,12 @@ from mistralai.types import BaseModel
7
7
  from mistralai.utils import get_discriminator
8
8
  from pydantic import Discriminator, Tag
9
9
  from typing import List, Optional, Union
10
- from typing_extensions import Annotated, NotRequired, TypedDict
10
+ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
11
11
 
12
12
 
13
- DataTypedDict = Union[BaseModelCardTypedDict, FTModelCardTypedDict]
13
+ DataTypedDict = TypeAliasType(
14
+ "DataTypedDict", Union[BaseModelCardTypedDict, FTModelCardTypedDict]
15
+ )
14
16
 
15
17
 
16
18
  Data = Annotated[
@@ -0,0 +1,20 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai.types import BaseModel
5
+ from typing import List, Literal, Optional
6
+ from typing_extensions import NotRequired, TypedDict
7
+
8
+
9
+ ReferenceChunkType = Literal["reference"]
10
+
11
+
12
+ class ReferenceChunkTypedDict(TypedDict):
13
+ reference_ids: List[int]
14
+ type: NotRequired[ReferenceChunkType]
15
+
16
+
17
+ class ReferenceChunk(BaseModel):
18
+ reference_ids: List[int]
19
+
20
+ type: Optional[ReferenceChunkType] = "reference"
@@ -7,7 +7,7 @@ from mistralai.types import BaseModel
7
7
  from mistralai.utils import FieldMetadata, PathParamMetadata, get_discriminator
8
8
  from pydantic import Discriminator, Tag
9
9
  from typing import Union
10
- from typing_extensions import Annotated, TypedDict
10
+ from typing_extensions import Annotated, TypeAliasType, TypedDict
11
11
 
12
12
 
13
13
  class RetrieveModelV1ModelsModelIDGetRequestTypedDict(TypedDict):
@@ -22,9 +22,10 @@ class RetrieveModelV1ModelsModelIDGetRequest(BaseModel):
22
22
  r"""The ID of the model to retrieve."""
23
23
 
24
24
 
25
- RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGetTypedDict = Union[
26
- BaseModelCardTypedDict, FTModelCardTypedDict
27
- ]
25
+ RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGetTypedDict = TypeAliasType(
26
+ "RetrieveModelV1ModelsModelIDGetResponseRetrieveModelV1ModelsModelIDGetTypedDict",
27
+ Union[BaseModelCardTypedDict, FTModelCardTypedDict],
28
+ )
28
29
  r"""Successful Response"""
29
30
 
30
31
 
@@ -4,13 +4,17 @@ from __future__ import annotations
4
4
  from .textchunk import TextChunk, TextChunkTypedDict
5
5
  from mistralai.types import BaseModel
6
6
  from typing import List, Literal, Optional, Union
7
- from typing_extensions import NotRequired, TypedDict
7
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
8
8
 
9
9
 
10
- SystemMessageContentTypedDict = Union[str, List[TextChunkTypedDict]]
10
+ SystemMessageContentTypedDict = TypeAliasType(
11
+ "SystemMessageContentTypedDict", Union[str, List[TextChunkTypedDict]]
12
+ )
11
13
 
12
14
 
13
- SystemMessageContent = Union[str, List[TextChunk]]
15
+ SystemMessageContent = TypeAliasType(
16
+ "SystemMessageContent", Union[str, List[TextChunk]]
17
+ )
14
18
 
15
19
 
16
20
  Role = Literal["system"]
@@ -2,11 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from mistralai.types import BaseModel
5
- from mistralai.utils import validate_const
6
- import pydantic
7
- from pydantic.functional_validators import AfterValidator
8
5
  from typing import Literal, Optional
9
- from typing_extensions import Annotated, TypedDict
6
+ from typing_extensions import NotRequired, TypedDict
10
7
 
11
8
 
12
9
  TextChunkType = Literal["text"]
@@ -14,13 +11,10 @@ TextChunkType = Literal["text"]
14
11
 
15
12
  class TextChunkTypedDict(TypedDict):
16
13
  text: str
17
- type: TextChunkType
14
+ type: NotRequired[TextChunkType]
18
15
 
19
16
 
20
17
  class TextChunk(BaseModel):
21
18
  text: str
22
19
 
23
- TYPE: Annotated[
24
- Annotated[Optional[TextChunkType], AfterValidator(validate_const("text"))],
25
- pydantic.Field(alias="type"),
26
- ] = "text"
20
+ type: Optional[TextChunkType] = "text"