mistralai 1.0.3__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. mistralai/_hooks/sdkhooks.py +23 -4
  2. mistralai/_hooks/types.py +27 -9
  3. mistralai/agents.py +286 -150
  4. mistralai/basesdk.py +90 -5
  5. mistralai/chat.py +260 -144
  6. mistralai/embeddings.py +73 -53
  7. mistralai/files.py +252 -192
  8. mistralai/fim.py +174 -110
  9. mistralai/fine_tuning.py +3 -2
  10. mistralai/jobs.py +372 -263
  11. mistralai/models/__init__.py +499 -46
  12. mistralai/models/agentscompletionrequest.py +47 -11
  13. mistralai/models/agentscompletionstreamrequest.py +49 -11
  14. mistralai/models/archiveftmodelout.py +6 -2
  15. mistralai/models/assistantmessage.py +11 -4
  16. mistralai/models/{modelcard.py → basemodelcard.py} +37 -14
  17. mistralai/models/chatcompletionchoice.py +4 -2
  18. mistralai/models/chatcompletionrequest.py +57 -11
  19. mistralai/models/chatcompletionresponse.py +6 -2
  20. mistralai/models/chatcompletionstreamrequest.py +59 -11
  21. mistralai/models/checkpointout.py +3 -2
  22. mistralai/models/completionchunk.py +10 -3
  23. mistralai/models/completionevent.py +1 -2
  24. mistralai/models/completionresponsestreamchoice.py +13 -5
  25. mistralai/models/contentchunk.py +13 -10
  26. mistralai/models/delete_model_v1_models_model_id_deleteop.py +4 -3
  27. mistralai/models/deletefileout.py +3 -2
  28. mistralai/models/deletemodelout.py +3 -2
  29. mistralai/models/deltamessage.py +9 -4
  30. mistralai/models/detailedjobout.py +59 -7
  31. mistralai/models/embeddingrequest.py +9 -4
  32. mistralai/models/embeddingresponse.py +5 -2
  33. mistralai/models/embeddingresponsedata.py +3 -2
  34. mistralai/models/eventout.py +9 -4
  35. mistralai/models/files_api_routes_delete_fileop.py +4 -3
  36. mistralai/models/files_api_routes_retrieve_fileop.py +4 -3
  37. mistralai/models/files_api_routes_upload_fileop.py +27 -8
  38. mistralai/models/fileschema.py +26 -5
  39. mistralai/models/fimcompletionrequest.py +26 -5
  40. mistralai/models/fimcompletionresponse.py +6 -2
  41. mistralai/models/fimcompletionstreamrequest.py +26 -5
  42. mistralai/models/finetuneablemodel.py +7 -1
  43. mistralai/models/ftmodelcapabilitiesout.py +4 -2
  44. mistralai/models/ftmodelcard.py +103 -0
  45. mistralai/models/ftmodelout.py +32 -6
  46. mistralai/models/function.py +3 -2
  47. mistralai/models/functioncall.py +2 -2
  48. mistralai/models/functionname.py +17 -0
  49. mistralai/models/githubrepositoryin.py +15 -4
  50. mistralai/models/githubrepositoryout.py +15 -4
  51. mistralai/models/httpvalidationerror.py +2 -2
  52. mistralai/models/imageurl.py +48 -0
  53. mistralai/models/imageurlchunk.py +32 -0
  54. mistralai/models/jobin.py +22 -5
  55. mistralai/models/jobmetadataout.py +31 -6
  56. mistralai/models/jobout.py +55 -7
  57. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +4 -3
  58. mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +4 -3
  59. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +3 -2
  60. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +4 -3
  61. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +83 -16
  62. mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +4 -3
  63. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +4 -3
  64. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +9 -4
  65. mistralai/models/jobsout.py +6 -2
  66. mistralai/models/legacyjobmetadataout.py +45 -6
  67. mistralai/models/listfilesout.py +2 -2
  68. mistralai/models/metricout.py +11 -6
  69. mistralai/models/modelcapabilities.py +7 -2
  70. mistralai/models/modellist.py +21 -7
  71. mistralai/models/responseformat.py +6 -7
  72. mistralai/models/responseformats.py +8 -0
  73. mistralai/models/retrieve_model_v1_models_model_id_getop.py +24 -5
  74. mistralai/models/retrievefileout.py +26 -5
  75. mistralai/models/security.py +12 -3
  76. mistralai/models/systemmessage.py +6 -5
  77. mistralai/models/textchunk.py +9 -4
  78. mistralai/models/tool.py +9 -8
  79. mistralai/models/toolcall.py +9 -7
  80. mistralai/models/toolchoice.py +29 -0
  81. mistralai/models/toolchoiceenum.py +7 -0
  82. mistralai/models/toolmessage.py +11 -4
  83. mistralai/models/tooltypes.py +8 -0
  84. mistralai/models/trainingfile.py +2 -2
  85. mistralai/models/trainingparameters.py +27 -6
  86. mistralai/models/trainingparametersin.py +29 -8
  87. mistralai/models/unarchiveftmodelout.py +6 -2
  88. mistralai/models/updateftmodelin.py +8 -4
  89. mistralai/models/uploadfileout.py +26 -5
  90. mistralai/models/usageinfo.py +3 -2
  91. mistralai/models/usermessage.py +6 -5
  92. mistralai/models/validationerror.py +3 -2
  93. mistralai/models/wandbintegration.py +14 -4
  94. mistralai/models/wandbintegrationout.py +13 -4
  95. mistralai/models_.py +392 -294
  96. mistralai/sdk.py +24 -19
  97. mistralai/sdkconfiguration.py +6 -8
  98. mistralai/utils/__init__.py +6 -1
  99. mistralai/utils/logger.py +4 -1
  100. mistralai/utils/retries.py +2 -1
  101. mistralai/utils/security.py +13 -6
  102. {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/METADATA +102 -73
  103. mistralai-1.1.0.dist-info/RECORD +254 -0
  104. mistralai_azure/_hooks/sdkhooks.py +23 -4
  105. mistralai_azure/_hooks/types.py +27 -9
  106. mistralai_azure/basesdk.py +91 -6
  107. mistralai_azure/chat.py +252 -144
  108. mistralai_azure/models/__init__.py +157 -15
  109. mistralai_azure/models/assistantmessage.py +18 -5
  110. mistralai_azure/models/chatcompletionchoice.py +7 -3
  111. mistralai_azure/models/chatcompletionrequest.py +65 -12
  112. mistralai_azure/models/chatcompletionresponse.py +6 -2
  113. mistralai_azure/models/chatcompletionstreamrequest.py +67 -12
  114. mistralai_azure/models/completionchunk.py +10 -3
  115. mistralai_azure/models/completionevent.py +1 -2
  116. mistralai_azure/models/completionresponsestreamchoice.py +10 -4
  117. mistralai_azure/models/contentchunk.py +4 -11
  118. mistralai_azure/models/deltamessage.py +16 -5
  119. mistralai_azure/models/function.py +3 -2
  120. mistralai_azure/models/functioncall.py +2 -2
  121. mistralai_azure/models/functionname.py +17 -0
  122. mistralai_azure/models/httpvalidationerror.py +2 -2
  123. mistralai_azure/models/responseformat.py +6 -7
  124. mistralai_azure/models/responseformats.py +8 -0
  125. mistralai_azure/models/security.py +12 -3
  126. mistralai_azure/models/systemmessage.py +6 -5
  127. mistralai_azure/models/textchunk.py +9 -4
  128. mistralai_azure/models/tool.py +9 -8
  129. mistralai_azure/models/toolcall.py +9 -7
  130. mistralai_azure/models/toolchoice.py +29 -0
  131. mistralai_azure/models/toolchoiceenum.py +7 -0
  132. mistralai_azure/models/toolmessage.py +18 -5
  133. mistralai_azure/models/tooltypes.py +8 -0
  134. mistralai_azure/models/usageinfo.py +3 -2
  135. mistralai_azure/models/usermessage.py +6 -5
  136. mistralai_azure/models/validationerror.py +3 -2
  137. mistralai_azure/sdkconfiguration.py +6 -8
  138. mistralai_azure/utils/__init__.py +8 -3
  139. mistralai_azure/utils/forms.py +10 -9
  140. mistralai_azure/utils/headers.py +8 -8
  141. mistralai_azure/utils/logger.py +6 -0
  142. mistralai_azure/utils/queryparams.py +16 -14
  143. mistralai_azure/utils/retries.py +2 -1
  144. mistralai_azure/utils/security.py +12 -6
  145. mistralai_azure/utils/serializers.py +17 -8
  146. mistralai_azure/utils/url.py +13 -8
  147. mistralai_azure/utils/values.py +6 -0
  148. mistralai_gcp/_hooks/sdkhooks.py +23 -4
  149. mistralai_gcp/_hooks/types.py +27 -9
  150. mistralai_gcp/basesdk.py +91 -6
  151. mistralai_gcp/chat.py +252 -144
  152. mistralai_gcp/fim.py +166 -110
  153. mistralai_gcp/models/__init__.py +179 -17
  154. mistralai_gcp/models/assistantmessage.py +18 -5
  155. mistralai_gcp/models/chatcompletionchoice.py +7 -3
  156. mistralai_gcp/models/chatcompletionrequest.py +62 -12
  157. mistralai_gcp/models/chatcompletionresponse.py +6 -2
  158. mistralai_gcp/models/chatcompletionstreamrequest.py +64 -12
  159. mistralai_gcp/models/completionchunk.py +10 -3
  160. mistralai_gcp/models/completionevent.py +1 -2
  161. mistralai_gcp/models/completionresponsestreamchoice.py +10 -4
  162. mistralai_gcp/models/contentchunk.py +4 -11
  163. mistralai_gcp/models/deltamessage.py +16 -5
  164. mistralai_gcp/models/fimcompletionrequest.py +33 -6
  165. mistralai_gcp/models/fimcompletionresponse.py +6 -2
  166. mistralai_gcp/models/fimcompletionstreamrequest.py +33 -6
  167. mistralai_gcp/models/function.py +3 -2
  168. mistralai_gcp/models/functioncall.py +2 -2
  169. mistralai_gcp/models/functionname.py +17 -0
  170. mistralai_gcp/models/httpvalidationerror.py +2 -2
  171. mistralai_gcp/models/responseformat.py +6 -7
  172. mistralai_gcp/models/responseformats.py +8 -0
  173. mistralai_gcp/models/security.py +12 -3
  174. mistralai_gcp/models/systemmessage.py +6 -5
  175. mistralai_gcp/models/textchunk.py +9 -4
  176. mistralai_gcp/models/tool.py +9 -8
  177. mistralai_gcp/models/toolcall.py +9 -7
  178. mistralai_gcp/models/toolchoice.py +29 -0
  179. mistralai_gcp/models/toolchoiceenum.py +7 -0
  180. mistralai_gcp/models/toolmessage.py +18 -5
  181. mistralai_gcp/models/tooltypes.py +8 -0
  182. mistralai_gcp/models/usageinfo.py +3 -2
  183. mistralai_gcp/models/usermessage.py +6 -5
  184. mistralai_gcp/models/validationerror.py +3 -2
  185. mistralai_gcp/sdk.py +6 -7
  186. mistralai_gcp/sdkconfiguration.py +6 -8
  187. mistralai_gcp/utils/__init__.py +8 -3
  188. mistralai_gcp/utils/forms.py +10 -9
  189. mistralai_gcp/utils/headers.py +8 -8
  190. mistralai_gcp/utils/logger.py +6 -0
  191. mistralai_gcp/utils/queryparams.py +16 -14
  192. mistralai_gcp/utils/retries.py +2 -1
  193. mistralai_gcp/utils/security.py +12 -6
  194. mistralai_gcp/utils/serializers.py +17 -8
  195. mistralai_gcp/utils/url.py +13 -8
  196. mistralai_gcp/utils/values.py +6 -0
  197. mistralai-1.0.3.dist-info/RECORD +0 -236
  198. {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/LICENSE +0 -0
  199. {mistralai-1.0.3.dist-info → mistralai-1.1.0.dist-info}/WHEEL +0 -0
@@ -14,20 +14,38 @@ class TrainingParametersTypedDict(TypedDict):
14
14
  warmup_fraction: NotRequired[Nullable[float]]
15
15
  epochs: NotRequired[Nullable[float]]
16
16
  fim_ratio: NotRequired[Nullable[float]]
17
-
17
+
18
18
 
19
19
  class TrainingParameters(BaseModel):
20
20
  training_steps: OptionalNullable[int] = UNSET
21
+
21
22
  learning_rate: Optional[float] = 0.0001
23
+
22
24
  weight_decay: OptionalNullable[float] = UNSET
25
+
23
26
  warmup_fraction: OptionalNullable[float] = UNSET
27
+
24
28
  epochs: OptionalNullable[float] = UNSET
29
+
25
30
  fim_ratio: OptionalNullable[float] = UNSET
26
-
31
+
27
32
  @model_serializer(mode="wrap")
28
33
  def serialize_model(self, handler):
29
- optional_fields = ["training_steps", "learning_rate", "weight_decay", "warmup_fraction", "epochs", "fim_ratio"]
30
- nullable_fields = ["training_steps", "weight_decay", "warmup_fraction", "epochs", "fim_ratio"]
34
+ optional_fields = [
35
+ "training_steps",
36
+ "learning_rate",
37
+ "weight_decay",
38
+ "warmup_fraction",
39
+ "epochs",
40
+ "fim_ratio",
41
+ ]
42
+ nullable_fields = [
43
+ "training_steps",
44
+ "weight_decay",
45
+ "warmup_fraction",
46
+ "epochs",
47
+ "fim_ratio",
48
+ ]
31
49
  null_default_fields = []
32
50
 
33
51
  serialized = handler(self)
@@ -37,9 +55,13 @@ class TrainingParameters(BaseModel):
37
55
  for n, f in self.model_fields.items():
38
56
  k = f.alias or n
39
57
  val = serialized.get(k)
58
+ serialized.pop(k, None)
40
59
 
41
60
  optional_nullable = k in optional_fields and k in nullable_fields
42
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
61
+ is_set = (
62
+ self.__pydantic_fields_set__.intersection({n})
63
+ or k in null_default_fields
64
+ ) # pylint: disable=no-member
43
65
 
44
66
  if val is not None and val != UNSET_SENTINEL:
45
67
  m[k] = val
@@ -49,4 +71,3 @@ class TrainingParameters(BaseModel):
49
71
  m[k] = val
50
72
 
51
73
  return m
52
-
@@ -9,7 +9,7 @@ from typing_extensions import NotRequired
9
9
 
10
10
  class TrainingParametersInTypedDict(TypedDict):
11
11
  r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
12
-
12
+
13
13
  training_steps: NotRequired[Nullable[int]]
14
14
  r"""The number of training steps to perform. A training step refers to a single update of the model weights during the fine-tuning process. This update is typically calculated using a batch of samples from the training dataset."""
15
15
  learning_rate: NotRequired[float]
@@ -20,26 +20,44 @@ class TrainingParametersInTypedDict(TypedDict):
20
20
  r"""(Advanced Usage) A parameter that specifies the percentage of the total training steps at which the learning rate warm-up phase ends. During this phase, the learning rate gradually increases from a small value to the initial learning rate, helping to stabilize the training process and improve convergence. Similar to `pct_start` in [mistral-finetune](https://github.com/mistralai/mistral-finetune)"""
21
21
  epochs: NotRequired[Nullable[float]]
22
22
  fim_ratio: NotRequired[Nullable[float]]
23
-
23
+
24
24
 
25
25
  class TrainingParametersIn(BaseModel):
26
26
  r"""The fine-tuning hyperparameter settings used in a fine-tune job."""
27
-
27
+
28
28
  training_steps: OptionalNullable[int] = UNSET
29
29
  r"""The number of training steps to perform. A training step refers to a single update of the model weights during the fine-tuning process. This update is typically calculated using a batch of samples from the training dataset."""
30
+
30
31
  learning_rate: Optional[float] = 0.0001
31
32
  r"""A parameter describing how much to adjust the pre-trained model's weights in response to the estimated error each time the weights are updated during the fine-tuning process."""
33
+
32
34
  weight_decay: OptionalNullable[float] = UNSET
33
35
  r"""(Advanced Usage) Weight decay adds a term to the loss function that is proportional to the sum of the squared weights. This term reduces the magnitude of the weights and prevents them from growing too large."""
36
+
34
37
  warmup_fraction: OptionalNullable[float] = UNSET
35
38
  r"""(Advanced Usage) A parameter that specifies the percentage of the total training steps at which the learning rate warm-up phase ends. During this phase, the learning rate gradually increases from a small value to the initial learning rate, helping to stabilize the training process and improve convergence. Similar to `pct_start` in [mistral-finetune](https://github.com/mistralai/mistral-finetune)"""
39
+
36
40
  epochs: OptionalNullable[float] = UNSET
41
+
37
42
  fim_ratio: OptionalNullable[float] = UNSET
38
-
43
+
39
44
  @model_serializer(mode="wrap")
40
45
  def serialize_model(self, handler):
41
- optional_fields = ["training_steps", "learning_rate", "weight_decay", "warmup_fraction", "epochs", "fim_ratio"]
42
- nullable_fields = ["training_steps", "weight_decay", "warmup_fraction", "epochs", "fim_ratio"]
46
+ optional_fields = [
47
+ "training_steps",
48
+ "learning_rate",
49
+ "weight_decay",
50
+ "warmup_fraction",
51
+ "epochs",
52
+ "fim_ratio",
53
+ ]
54
+ nullable_fields = [
55
+ "training_steps",
56
+ "weight_decay",
57
+ "warmup_fraction",
58
+ "epochs",
59
+ "fim_ratio",
60
+ ]
43
61
  null_default_fields = []
44
62
 
45
63
  serialized = handler(self)
@@ -49,9 +67,13 @@ class TrainingParametersIn(BaseModel):
49
67
  for n, f in self.model_fields.items():
50
68
  k = f.alias or n
51
69
  val = serialized.get(k)
70
+ serialized.pop(k, None)
52
71
 
53
72
  optional_nullable = k in optional_fields and k in nullable_fields
54
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
73
+ is_set = (
74
+ self.__pydantic_fields_set__.intersection({n})
75
+ or k in null_default_fields
76
+ ) # pylint: disable=no-member
55
77
 
56
78
  if val is not None and val != UNSET_SENTINEL:
57
79
  m[k] = val
@@ -61,4 +83,3 @@ class TrainingParametersIn(BaseModel):
61
83
  m[k] = val
62
84
 
63
85
  return m
64
-
@@ -9,13 +9,17 @@ from typing_extensions import Annotated, NotRequired
9
9
 
10
10
  UnarchiveFTModelOutObject = Literal["model"]
11
11
 
12
+
12
13
  class UnarchiveFTModelOutTypedDict(TypedDict):
13
14
  id: str
14
15
  archived: NotRequired[bool]
15
-
16
+
16
17
 
17
18
  class UnarchiveFTModelOut(BaseModel):
18
19
  id: str
20
+
21
+ # fmt: off
19
22
  OBJECT: Annotated[Final[Optional[UnarchiveFTModelOutObject]], pydantic.Field(alias="object")] = "model" # type: ignore
23
+ # fmt: on
24
+
20
25
  archived: Optional[bool] = False
21
-
@@ -10,12 +10,13 @@ from typing_extensions import NotRequired
10
10
  class UpdateFTModelInTypedDict(TypedDict):
11
11
  name: NotRequired[Nullable[str]]
12
12
  description: NotRequired[Nullable[str]]
13
-
13
+
14
14
 
15
15
  class UpdateFTModelIn(BaseModel):
16
16
  name: OptionalNullable[str] = UNSET
17
+
17
18
  description: OptionalNullable[str] = UNSET
18
-
19
+
19
20
  @model_serializer(mode="wrap")
20
21
  def serialize_model(self, handler):
21
22
  optional_fields = ["name", "description"]
@@ -29,9 +30,13 @@ class UpdateFTModelIn(BaseModel):
29
30
  for n, f in self.model_fields.items():
30
31
  k = f.alias or n
31
32
  val = serialized.get(k)
33
+ serialized.pop(k, None)
32
34
 
33
35
  optional_nullable = k in optional_fields and k in nullable_fields
34
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
36
+ is_set = (
37
+ self.__pydantic_fields_set__.intersection({n})
38
+ or k in null_default_fields
39
+ ) # pylint: disable=no-member
35
40
 
36
41
  if val is not None and val != UNSET_SENTINEL:
37
42
  m[k] = val
@@ -41,4 +46,3 @@ class UpdateFTModelIn(BaseModel):
41
46
  m[k] = val
42
47
 
43
48
  return m
44
-
@@ -3,7 +3,14 @@
3
3
  from __future__ import annotations
4
4
  from .sampletype import SampleType
5
5
  from .source import Source
6
- from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL, UnrecognizedStr
6
+ from mistralai.types import (
7
+ BaseModel,
8
+ Nullable,
9
+ OptionalNullable,
10
+ UNSET,
11
+ UNSET_SENTINEL,
12
+ UnrecognizedStr,
13
+ )
7
14
  from mistralai.utils import validate_open_enum
8
15
  import pydantic
9
16
  from pydantic import model_serializer
@@ -15,6 +22,7 @@ from typing_extensions import Annotated, NotRequired
15
22
  Purpose = Union[Literal["fine-tune"], UnrecognizedStr]
16
23
  r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
17
24
 
25
+
18
26
  class UploadFileOutTypedDict(TypedDict):
19
27
  id: str
20
28
  r"""The unique identifier of the file."""
@@ -29,25 +37,35 @@ class UploadFileOutTypedDict(TypedDict):
29
37
  sample_type: SampleType
30
38
  source: Source
31
39
  num_lines: NotRequired[Nullable[int]]
32
-
40
+
33
41
 
34
42
  class UploadFileOut(BaseModel):
35
43
  id: str
36
44
  r"""The unique identifier of the file."""
45
+
37
46
  object: str
38
47
  r"""The object type, which is always \"file\"."""
48
+
39
49
  bytes: int
40
50
  r"""The size of the file, in bytes."""
51
+
41
52
  created_at: int
42
53
  r"""The UNIX timestamp (in seconds) of the event."""
54
+
43
55
  filename: str
44
56
  r"""The name of the uploaded file."""
57
+
45
58
  sample_type: SampleType
59
+
46
60
  source: Source
61
+
62
+ # fmt: off
47
63
  PURPOSE: Annotated[Final[Annotated[Purpose, PlainValidator(validate_open_enum(False))]], pydantic.Field(alias="purpose")] = "fine-tune" # type: ignore
64
+ # fmt: on
48
65
  r"""The intended purpose of the uploaded file. Only accepts fine-tuning (`fine-tune`) for now."""
66
+
49
67
  num_lines: OptionalNullable[int] = UNSET
50
-
68
+
51
69
  @model_serializer(mode="wrap")
52
70
  def serialize_model(self, handler):
53
71
  optional_fields = ["num_lines"]
@@ -61,9 +79,13 @@ class UploadFileOut(BaseModel):
61
79
  for n, f in self.model_fields.items():
62
80
  k = f.alias or n
63
81
  val = serialized.get(k)
82
+ serialized.pop(k, None)
64
83
 
65
84
  optional_nullable = k in optional_fields and k in nullable_fields
66
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
85
+ is_set = (
86
+ self.__pydantic_fields_set__.intersection({n})
87
+ or k in null_default_fields
88
+ ) # pylint: disable=no-member
67
89
 
68
90
  if val is not None and val != UNSET_SENTINEL:
69
91
  m[k] = val
@@ -73,4 +95,3 @@ class UploadFileOut(BaseModel):
73
95
  m[k] = val
74
96
 
75
97
  return m
76
-
@@ -9,10 +9,11 @@ class UsageInfoTypedDict(TypedDict):
9
9
  prompt_tokens: int
10
10
  completion_tokens: int
11
11
  total_tokens: int
12
-
12
+
13
13
 
14
14
  class UsageInfo(BaseModel):
15
15
  prompt_tokens: int
16
+
16
17
  completion_tokens: int
18
+
17
19
  total_tokens: int
18
-
@@ -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 .textchunk import TextChunk, TextChunkTypedDict
4
+ from .contentchunk import ContentChunk, ContentChunkTypedDict
5
5
  from mistralai.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[TextChunkTypedDict]]
10
+ UserMessageContentTypedDict = Union[str, List[ContentChunkTypedDict]]
11
11
 
12
12
 
13
- UserMessageContent = Union[str, List[TextChunk]]
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
-
@@ -15,10 +15,11 @@ class ValidationErrorTypedDict(TypedDict):
15
15
  loc: List[LocTypedDict]
16
16
  msg: str
17
17
  type: str
18
-
18
+
19
19
 
20
20
  class ValidationError(BaseModel):
21
21
  loc: List[Loc]
22
+
22
23
  msg: str
24
+
23
25
  type: str
24
-
@@ -10,6 +10,7 @@ from typing_extensions import Annotated, NotRequired
10
10
 
11
11
  WandbIntegrationType = Literal["wandb"]
12
12
 
13
+
13
14
  class WandbIntegrationTypedDict(TypedDict):
14
15
  project: str
15
16
  r"""The name of the project that the new run will be created under."""
@@ -18,18 +19,24 @@ class WandbIntegrationTypedDict(TypedDict):
18
19
  name: NotRequired[Nullable[str]]
19
20
  r"""A display name to set for the run. If not set, will use the job ID as the name."""
20
21
  run_name: NotRequired[Nullable[str]]
21
-
22
+
22
23
 
23
24
  class WandbIntegration(BaseModel):
24
25
  project: str
25
26
  r"""The name of the project that the new run will be created under."""
27
+
26
28
  api_key: str
27
29
  r"""The WandB API key to use for authentication."""
30
+
31
+ # fmt: off
28
32
  TYPE: Annotated[Final[Optional[WandbIntegrationType]], pydantic.Field(alias="type")] = "wandb" # type: ignore
33
+ # fmt: on
34
+
29
35
  name: OptionalNullable[str] = UNSET
30
36
  r"""A display name to set for the run. If not set, will use the job ID as the name."""
37
+
31
38
  run_name: OptionalNullable[str] = UNSET
32
-
39
+
33
40
  @model_serializer(mode="wrap")
34
41
  def serialize_model(self, handler):
35
42
  optional_fields = ["type", "name", "run_name"]
@@ -43,9 +50,13 @@ class WandbIntegration(BaseModel):
43
50
  for n, f in self.model_fields.items():
44
51
  k = f.alias or n
45
52
  val = serialized.get(k)
53
+ serialized.pop(k, None)
46
54
 
47
55
  optional_nullable = k in optional_fields and k in nullable_fields
48
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
56
+ is_set = (
57
+ self.__pydantic_fields_set__.intersection({n})
58
+ or k in null_default_fields
59
+ ) # pylint: disable=no-member
49
60
 
50
61
  if val is not None and val != UNSET_SENTINEL:
51
62
  m[k] = val
@@ -55,4 +66,3 @@ class WandbIntegration(BaseModel):
55
66
  m[k] = val
56
67
 
57
68
  return m
58
-
@@ -10,22 +10,28 @@ from typing_extensions import Annotated, NotRequired
10
10
 
11
11
  Type = Literal["wandb"]
12
12
 
13
+
13
14
  class WandbIntegrationOutTypedDict(TypedDict):
14
15
  project: str
15
16
  r"""The name of the project that the new run will be created under."""
16
17
  name: NotRequired[Nullable[str]]
17
18
  r"""A display name to set for the run. If not set, will use the job ID as the name."""
18
19
  run_name: NotRequired[Nullable[str]]
19
-
20
+
20
21
 
21
22
  class WandbIntegrationOut(BaseModel):
22
23
  project: str
23
24
  r"""The name of the project that the new run will be created under."""
25
+
26
+ # fmt: off
24
27
  TYPE: Annotated[Final[Optional[Type]], pydantic.Field(alias="type")] = "wandb" # type: ignore
28
+ # fmt: on
29
+
25
30
  name: OptionalNullable[str] = UNSET
26
31
  r"""A display name to set for the run. If not set, will use the job ID as the name."""
32
+
27
33
  run_name: OptionalNullable[str] = UNSET
28
-
34
+
29
35
  @model_serializer(mode="wrap")
30
36
  def serialize_model(self, handler):
31
37
  optional_fields = ["type", "name", "run_name"]
@@ -39,9 +45,13 @@ class WandbIntegrationOut(BaseModel):
39
45
  for n, f in self.model_fields.items():
40
46
  k = f.alias or n
41
47
  val = serialized.get(k)
48
+ serialized.pop(k, None)
42
49
 
43
50
  optional_nullable = k in optional_fields and k in nullable_fields
44
- is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
51
+ is_set = (
52
+ self.__pydantic_fields_set__.intersection({n})
53
+ or k in null_default_fields
54
+ ) # pylint: disable=no-member
45
55
 
46
56
  if val is not None and val != UNSET_SENTINEL:
47
57
  m[k] = val
@@ -51,4 +61,3 @@ class WandbIntegrationOut(BaseModel):
51
61
  m[k] = val
52
62
 
53
63
  return m
54
-