mistralai 1.5.2__py3-none-any.whl → 1.6.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 (80) hide show
  1. mistralai/_hooks/types.py +15 -3
  2. mistralai/_version.py +3 -3
  3. mistralai/agents.py +44 -12
  4. mistralai/basesdk.py +8 -0
  5. mistralai/chat.py +44 -12
  6. mistralai/classifiers.py +36 -16
  7. mistralai/embeddings.py +16 -6
  8. mistralai/files.py +36 -0
  9. mistralai/fim.py +32 -12
  10. mistralai/httpclient.py +4 -2
  11. mistralai/jobs.py +30 -0
  12. mistralai/mistral_jobs.py +24 -0
  13. mistralai/models/agentscompletionrequest.py +4 -0
  14. mistralai/models/agentscompletionstreamrequest.py +4 -0
  15. mistralai/models/chatcompletionrequest.py +4 -0
  16. mistralai/models/chatcompletionstreamrequest.py +4 -0
  17. mistralai/models/function.py +2 -2
  18. mistralai/models/jsonschema.py +1 -1
  19. mistralai/models_.py +66 -18
  20. mistralai/ocr.py +16 -6
  21. mistralai/sdk.py +19 -3
  22. mistralai/sdkconfiguration.py +4 -2
  23. mistralai/utils/__init__.py +2 -0
  24. mistralai/utils/serializers.py +10 -6
  25. mistralai/utils/values.py +4 -1
  26. {mistralai-1.5.2.dist-info → mistralai-1.6.0.dist-info}/METADATA +63 -16
  27. {mistralai-1.5.2.dist-info → mistralai-1.6.0.dist-info}/RECORD +80 -72
  28. mistralai_azure/__init__.py +10 -1
  29. mistralai_azure/_hooks/types.py +15 -3
  30. mistralai_azure/_version.py +4 -1
  31. mistralai_azure/basesdk.py +8 -0
  32. mistralai_azure/chat.py +100 -20
  33. mistralai_azure/httpclient.py +52 -0
  34. mistralai_azure/models/__init__.py +22 -0
  35. mistralai_azure/models/assistantmessage.py +2 -0
  36. mistralai_azure/models/chatcompletionrequest.py +12 -10
  37. mistralai_azure/models/chatcompletionstreamrequest.py +12 -10
  38. mistralai_azure/models/contentchunk.py +6 -2
  39. mistralai_azure/models/function.py +4 -1
  40. mistralai_azure/models/imageurl.py +53 -0
  41. mistralai_azure/models/imageurlchunk.py +33 -0
  42. mistralai_azure/models/jsonschema.py +61 -0
  43. mistralai_azure/models/prediction.py +25 -0
  44. mistralai_azure/models/responseformat.py +42 -1
  45. mistralai_azure/models/responseformats.py +1 -1
  46. mistralai_azure/models/toolcall.py +3 -0
  47. mistralai_azure/sdk.py +56 -14
  48. mistralai_azure/sdkconfiguration.py +14 -6
  49. mistralai_azure/utils/__init__.py +2 -0
  50. mistralai_azure/utils/serializers.py +10 -6
  51. mistralai_azure/utils/values.py +4 -1
  52. mistralai_gcp/__init__.py +10 -1
  53. mistralai_gcp/_hooks/types.py +15 -3
  54. mistralai_gcp/_version.py +4 -1
  55. mistralai_gcp/basesdk.py +8 -0
  56. mistralai_gcp/chat.py +101 -21
  57. mistralai_gcp/fim.py +61 -21
  58. mistralai_gcp/httpclient.py +52 -0
  59. mistralai_gcp/models/__init__.py +22 -0
  60. mistralai_gcp/models/assistantmessage.py +2 -0
  61. mistralai_gcp/models/chatcompletionrequest.py +12 -10
  62. mistralai_gcp/models/chatcompletionstreamrequest.py +12 -10
  63. mistralai_gcp/models/contentchunk.py +6 -2
  64. mistralai_gcp/models/fimcompletionrequest.py +2 -3
  65. mistralai_gcp/models/fimcompletionstreamrequest.py +2 -3
  66. mistralai_gcp/models/function.py +4 -1
  67. mistralai_gcp/models/imageurl.py +53 -0
  68. mistralai_gcp/models/imageurlchunk.py +33 -0
  69. mistralai_gcp/models/jsonschema.py +61 -0
  70. mistralai_gcp/models/prediction.py +25 -0
  71. mistralai_gcp/models/responseformat.py +42 -1
  72. mistralai_gcp/models/responseformats.py +1 -1
  73. mistralai_gcp/models/toolcall.py +3 -0
  74. mistralai_gcp/sdk.py +63 -19
  75. mistralai_gcp/sdkconfiguration.py +14 -6
  76. mistralai_gcp/utils/__init__.py +2 -0
  77. mistralai_gcp/utils/serializers.py +10 -6
  78. mistralai_gcp/utils/values.py +4 -1
  79. {mistralai-1.5.2.dist-info → mistralai-1.6.0.dist-info}/LICENSE +0 -0
  80. {mistralai-1.5.2.dist-info → mistralai-1.6.0.dist-info}/WHEEL +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .prediction import Prediction, PredictionTypedDict
5
6
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
7
  from .systemmessage import SystemMessage, SystemMessageTypedDict
7
8
  from .tool import Tool, ToolTypedDict
@@ -68,7 +69,7 @@ ChatCompletionRequestToolChoice = TypeAliasType(
68
69
 
69
70
 
70
71
  class ChatCompletionRequestTypedDict(TypedDict):
71
- model: Nullable[str]
72
+ model: str
72
73
  r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
73
74
  messages: List[ChatCompletionRequestMessagesTypedDict]
74
75
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
@@ -93,10 +94,12 @@ class ChatCompletionRequestTypedDict(TypedDict):
93
94
  r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
94
95
  n: NotRequired[Nullable[int]]
95
96
  r"""Number of completions to return for each request, input tokens are only billed once."""
97
+ prediction: NotRequired[PredictionTypedDict]
98
+ parallel_tool_calls: NotRequired[bool]
96
99
 
97
100
 
98
101
  class ChatCompletionRequest(BaseModel):
99
- model: Nullable[str]
102
+ model: str
100
103
  r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
101
104
 
102
105
  messages: List[ChatCompletionRequestMessages]
@@ -135,6 +138,10 @@ class ChatCompletionRequest(BaseModel):
135
138
  n: OptionalNullable[int] = UNSET
136
139
  r"""Number of completions to return for each request, input tokens are only billed once."""
137
140
 
141
+ prediction: Optional[Prediction] = None
142
+
143
+ parallel_tool_calls: Optional[bool] = None
144
+
138
145
  @model_serializer(mode="wrap")
139
146
  def serialize_model(self, handler):
140
147
  optional_fields = [
@@ -150,15 +157,10 @@ class ChatCompletionRequest(BaseModel):
150
157
  "presence_penalty",
151
158
  "frequency_penalty",
152
159
  "n",
160
+ "prediction",
161
+ "parallel_tool_calls",
153
162
  ]
154
- nullable_fields = [
155
- "model",
156
- "temperature",
157
- "max_tokens",
158
- "random_seed",
159
- "tools",
160
- "n",
161
- ]
163
+ nullable_fields = ["temperature", "max_tokens", "random_seed", "tools", "n"]
162
164
  null_default_fields = []
163
165
 
164
166
  serialized = handler(self)
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .prediction import Prediction, PredictionTypedDict
5
6
  from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
7
  from .systemmessage import SystemMessage, SystemMessageTypedDict
7
8
  from .tool import Tool, ToolTypedDict
@@ -64,7 +65,7 @@ ChatCompletionStreamRequestToolChoice = TypeAliasType(
64
65
 
65
66
 
66
67
  class ChatCompletionStreamRequestTypedDict(TypedDict):
67
- model: Nullable[str]
68
+ model: str
68
69
  r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
69
70
  messages: List[MessagesTypedDict]
70
71
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
@@ -88,10 +89,12 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
88
89
  r"""frequency_penalty penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition."""
89
90
  n: NotRequired[Nullable[int]]
90
91
  r"""Number of completions to return for each request, input tokens are only billed once."""
92
+ prediction: NotRequired[PredictionTypedDict]
93
+ parallel_tool_calls: NotRequired[bool]
91
94
 
92
95
 
93
96
  class ChatCompletionStreamRequest(BaseModel):
94
- model: Nullable[str]
97
+ model: str
95
98
  r"""ID of the model to use. You can use the [List Available Models](/api/#tag/models/operation/list_models_v1_models_get) API to see all of your available models, or see our [Model overview](/models) for model descriptions."""
96
99
 
97
100
  messages: List[Messages]
@@ -129,6 +132,10 @@ class ChatCompletionStreamRequest(BaseModel):
129
132
  n: OptionalNullable[int] = UNSET
130
133
  r"""Number of completions to return for each request, input tokens are only billed once."""
131
134
 
135
+ prediction: Optional[Prediction] = None
136
+
137
+ parallel_tool_calls: Optional[bool] = None
138
+
132
139
  @model_serializer(mode="wrap")
133
140
  def serialize_model(self, handler):
134
141
  optional_fields = [
@@ -144,15 +151,10 @@ class ChatCompletionStreamRequest(BaseModel):
144
151
  "presence_penalty",
145
152
  "frequency_penalty",
146
153
  "n",
154
+ "prediction",
155
+ "parallel_tool_calls",
147
156
  ]
148
- nullable_fields = [
149
- "model",
150
- "temperature",
151
- "max_tokens",
152
- "random_seed",
153
- "tools",
154
- "n",
155
- ]
157
+ nullable_fields = ["temperature", "max_tokens", "random_seed", "tools", "n"]
156
158
  null_default_fields = []
157
159
 
158
160
  serialized = handler(self)
@@ -1,6 +1,7 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
+ from .imageurlchunk import ImageURLChunk, ImageURLChunkTypedDict
4
5
  from .referencechunk import ReferenceChunk, ReferenceChunkTypedDict
5
6
  from .textchunk import TextChunk, TextChunkTypedDict
6
7
  from mistralai_gcp.utils import get_discriminator
@@ -10,13 +11,16 @@ from typing_extensions import Annotated, TypeAliasType
10
11
 
11
12
 
12
13
  ContentChunkTypedDict = TypeAliasType(
13
- "ContentChunkTypedDict", Union[TextChunkTypedDict, ReferenceChunkTypedDict]
14
+ "ContentChunkTypedDict",
15
+ Union[TextChunkTypedDict, ImageURLChunkTypedDict, ReferenceChunkTypedDict],
14
16
  )
15
17
 
16
18
 
17
19
  ContentChunk = Annotated[
18
20
  Union[
19
- Annotated[TextChunk, Tag("text")], Annotated[ReferenceChunk, Tag("reference")]
21
+ Annotated[ImageURLChunk, Tag("image_url")],
22
+ Annotated[TextChunk, Tag("text")],
23
+ Annotated[ReferenceChunk, Tag("reference")],
20
24
  ],
21
25
  Discriminator(lambda m: get_discriminator(m, "type", "type")),
22
26
  ]
@@ -26,7 +26,7 @@ r"""Stop generation if this token is detected. Or if one of these tokens is dete
26
26
 
27
27
 
28
28
  class FIMCompletionRequestTypedDict(TypedDict):
29
- model: Nullable[str]
29
+ model: str
30
30
  r"""ID of the model to use. Only compatible for now with:
31
31
  - `codestral-2405`
32
32
  - `codestral-latest`
@@ -52,7 +52,7 @@ class FIMCompletionRequestTypedDict(TypedDict):
52
52
 
53
53
 
54
54
  class FIMCompletionRequest(BaseModel):
55
- model: Nullable[str]
55
+ model: str
56
56
  r"""ID of the model to use. Only compatible for now with:
57
57
  - `codestral-2405`
58
58
  - `codestral-latest`
@@ -98,7 +98,6 @@ class FIMCompletionRequest(BaseModel):
98
98
  "min_tokens",
99
99
  ]
100
100
  nullable_fields = [
101
- "model",
102
101
  "temperature",
103
102
  "max_tokens",
104
103
  "random_seed",
@@ -26,7 +26,7 @@ r"""Stop generation if this token is detected. Or if one of these tokens is dete
26
26
 
27
27
 
28
28
  class FIMCompletionStreamRequestTypedDict(TypedDict):
29
- model: Nullable[str]
29
+ model: str
30
30
  r"""ID of the model to use. Only compatible for now with:
31
31
  - `codestral-2405`
32
32
  - `codestral-latest`
@@ -51,7 +51,7 @@ class FIMCompletionStreamRequestTypedDict(TypedDict):
51
51
 
52
52
 
53
53
  class FIMCompletionStreamRequest(BaseModel):
54
- model: Nullable[str]
54
+ model: str
55
55
  r"""ID of the model to use. Only compatible for now with:
56
56
  - `codestral-2405`
57
57
  - `codestral-latest`
@@ -96,7 +96,6 @@ class FIMCompletionStreamRequest(BaseModel):
96
96
  "min_tokens",
97
97
  ]
98
98
  nullable_fields = [
99
- "model",
100
99
  "temperature",
101
100
  "max_tokens",
102
101
  "random_seed",
@@ -10,6 +10,7 @@ class FunctionTypedDict(TypedDict):
10
10
  name: str
11
11
  parameters: Dict[str, Any]
12
12
  description: NotRequired[str]
13
+ strict: NotRequired[bool]
13
14
 
14
15
 
15
16
  class Function(BaseModel):
@@ -17,4 +18,6 @@ class Function(BaseModel):
17
18
 
18
19
  parameters: Dict[str, Any]
19
20
 
20
- description: Optional[str] = ""
21
+ description: Optional[str] = None
22
+
23
+ strict: Optional[bool] = None
@@ -0,0 +1,53 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai_gcp.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
11
+ from pydantic import model_serializer
12
+ from typing_extensions import NotRequired, TypedDict
13
+
14
+
15
+ class ImageURLTypedDict(TypedDict):
16
+ url: str
17
+ detail: NotRequired[Nullable[str]]
18
+
19
+
20
+ class ImageURL(BaseModel):
21
+ url: str
22
+
23
+ detail: OptionalNullable[str] = UNSET
24
+
25
+ @model_serializer(mode="wrap")
26
+ def serialize_model(self, handler):
27
+ optional_fields = ["detail"]
28
+ nullable_fields = ["detail"]
29
+ null_default_fields = []
30
+
31
+ serialized = handler(self)
32
+
33
+ m = {}
34
+
35
+ for n, f in self.model_fields.items():
36
+ k = f.alias or n
37
+ val = serialized.get(k)
38
+ serialized.pop(k, None)
39
+
40
+ optional_nullable = k in optional_fields and k in nullable_fields
41
+ is_set = (
42
+ self.__pydantic_fields_set__.intersection({n})
43
+ or k in null_default_fields
44
+ ) # pylint: disable=no-member
45
+
46
+ if val is not None and val != UNSET_SENTINEL:
47
+ m[k] = val
48
+ elif val != UNSET_SENTINEL and (
49
+ not k in optional_fields or (optional_nullable and is_set)
50
+ ):
51
+ m[k] = val
52
+
53
+ return m
@@ -0,0 +1,33 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .imageurl import ImageURL, ImageURLTypedDict
5
+ from mistralai_gcp.types import BaseModel
6
+ from typing import Literal, Optional, Union
7
+ from typing_extensions import NotRequired, TypeAliasType, TypedDict
8
+
9
+
10
+ ImageURLChunkImageURLTypedDict = TypeAliasType(
11
+ "ImageURLChunkImageURLTypedDict", Union[ImageURLTypedDict, str]
12
+ )
13
+
14
+
15
+ ImageURLChunkImageURL = TypeAliasType("ImageURLChunkImageURL", Union[ImageURL, str])
16
+
17
+
18
+ ImageURLChunkType = Literal["image_url"]
19
+
20
+
21
+ class ImageURLChunkTypedDict(TypedDict):
22
+ r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
23
+
24
+ image_url: ImageURLChunkImageURLTypedDict
25
+ type: NotRequired[ImageURLChunkType]
26
+
27
+
28
+ class ImageURLChunk(BaseModel):
29
+ r"""{\"type\":\"image_url\",\"image_url\":{\"url\":\"data:image/png;base64,iVBORw0"""
30
+
31
+ image_url: ImageURLChunkImageURL
32
+
33
+ type: Optional[ImageURLChunkType] = "image_url"
@@ -0,0 +1,61 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai_gcp.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
11
+ import pydantic
12
+ from pydantic import model_serializer
13
+ from typing import Any, Dict, Optional
14
+ from typing_extensions import Annotated, NotRequired, TypedDict
15
+
16
+
17
+ class JSONSchemaTypedDict(TypedDict):
18
+ name: str
19
+ schema_definition: Dict[str, Any]
20
+ description: NotRequired[Nullable[str]]
21
+ strict: NotRequired[bool]
22
+
23
+
24
+ class JSONSchema(BaseModel):
25
+ name: str
26
+
27
+ schema_definition: Annotated[Dict[str, Any], pydantic.Field(alias="schema")]
28
+
29
+ description: OptionalNullable[str] = UNSET
30
+
31
+ strict: Optional[bool] = None
32
+
33
+ @model_serializer(mode="wrap")
34
+ def serialize_model(self, handler):
35
+ optional_fields = ["description", "strict"]
36
+ nullable_fields = ["description"]
37
+ null_default_fields = []
38
+
39
+ serialized = handler(self)
40
+
41
+ m = {}
42
+
43
+ for n, f in 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
@@ -0,0 +1,25 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mistralai_gcp.types import BaseModel
5
+ from mistralai_gcp.utils import validate_const
6
+ import pydantic
7
+ from pydantic.functional_validators import AfterValidator
8
+ from typing import Literal, Optional
9
+ from typing_extensions import Annotated, NotRequired, TypedDict
10
+
11
+
12
+ class PredictionTypedDict(TypedDict):
13
+ type: Literal["content"]
14
+ content: NotRequired[str]
15
+
16
+
17
+ class Prediction(BaseModel):
18
+ TYPE: Annotated[
19
+ Annotated[
20
+ Optional[Literal["content"]], AfterValidator(validate_const("content"))
21
+ ],
22
+ pydantic.Field(alias="type"),
23
+ ] = "content"
24
+
25
+ content: Optional[str] = ""
@@ -1,8 +1,16 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
+ from .jsonschema import JSONSchema, JSONSchemaTypedDict
4
5
  from .responseformats import ResponseFormats
5
- from mistralai_gcp.types import BaseModel
6
+ from mistralai_gcp.types import (
7
+ BaseModel,
8
+ Nullable,
9
+ OptionalNullable,
10
+ UNSET,
11
+ UNSET_SENTINEL,
12
+ )
13
+ from pydantic import model_serializer
6
14
  from typing import Optional
7
15
  from typing_extensions import NotRequired, TypedDict
8
16
 
@@ -10,8 +18,41 @@ from typing_extensions import NotRequired, TypedDict
10
18
  class ResponseFormatTypedDict(TypedDict):
11
19
  type: NotRequired[ResponseFormats]
12
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
+ json_schema: NotRequired[Nullable[JSONSchemaTypedDict]]
13
22
 
14
23
 
15
24
  class ResponseFormat(BaseModel):
16
25
  type: Optional[ResponseFormats] = None
17
26
  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."""
27
+
28
+ json_schema: OptionalNullable[JSONSchema] = UNSET
29
+
30
+ @model_serializer(mode="wrap")
31
+ def serialize_model(self, handler):
32
+ optional_fields = ["type", "json_schema"]
33
+ nullable_fields = ["json_schema"]
34
+ null_default_fields = []
35
+
36
+ serialized = handler(self)
37
+
38
+ m = {}
39
+
40
+ for n, f in self.model_fields.items():
41
+ k = f.alias or n
42
+ val = serialized.get(k)
43
+ serialized.pop(k, None)
44
+
45
+ optional_nullable = k in optional_fields and k in nullable_fields
46
+ is_set = (
47
+ self.__pydantic_fields_set__.intersection({n})
48
+ or k in null_default_fields
49
+ ) # pylint: disable=no-member
50
+
51
+ if val is not None and val != UNSET_SENTINEL:
52
+ m[k] = val
53
+ elif val != UNSET_SENTINEL and (
54
+ not k in optional_fields or (optional_nullable and is_set)
55
+ ):
56
+ m[k] = val
57
+
58
+ return m
@@ -4,5 +4,5 @@ from __future__ import annotations
4
4
  from typing import Literal
5
5
 
6
6
 
7
- ResponseFormats = Literal["text", "json_object"]
7
+ ResponseFormats = Literal["text", "json_object", "json_schema"]
8
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."""
@@ -14,6 +14,7 @@ class ToolCallTypedDict(TypedDict):
14
14
  function: FunctionCallTypedDict
15
15
  id: NotRequired[str]
16
16
  type: NotRequired[ToolTypes]
17
+ index: NotRequired[int]
17
18
 
18
19
 
19
20
  class ToolCall(BaseModel):
@@ -24,3 +25,5 @@ class ToolCall(BaseModel):
24
25
  type: Annotated[Optional[ToolTypes], PlainValidator(validate_open_enum(False))] = (
25
26
  None
26
27
  )
28
+
29
+ index: Optional[int] = 0