mistralai 1.0.0rc2__py3-none-any.whl → 1.0.2__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 (87) hide show
  1. mistralai/agents.py +33 -33
  2. mistralai/chat.py +4 -4
  3. mistralai/client.py +1 -1
  4. mistralai/jobs.py +24 -34
  5. mistralai/models/__init__.py +22 -22
  6. mistralai/models/agentscompletionrequest.py +14 -14
  7. mistralai/models/agentscompletionstreamrequest.py +41 -39
  8. mistralai/models/archiveftmodelout.py +4 -2
  9. mistralai/models/chatcompletionchoice.py +3 -4
  10. mistralai/models/chatcompletionrequest.py +16 -16
  11. mistralai/models/chatcompletionstreamrequest.py +16 -16
  12. mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
  13. mistralai/models/deltamessage.py +6 -6
  14. mistralai/models/detailedjobout.py +19 -5
  15. mistralai/models/embeddingrequest.py +8 -8
  16. mistralai/models/files_api_routes_upload_fileop.py +7 -4
  17. mistralai/models/fileschema.py +8 -3
  18. mistralai/models/fimcompletionrequest.py +8 -8
  19. mistralai/models/fimcompletionstreamrequest.py +8 -8
  20. mistralai/models/ftmodelout.py +4 -2
  21. mistralai/models/functioncall.py +9 -3
  22. mistralai/models/githubrepositoryin.py +4 -2
  23. mistralai/models/githubrepositoryout.py +4 -2
  24. mistralai/models/jobin.py +16 -4
  25. mistralai/models/jobout.py +20 -5
  26. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
  27. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +1 -54
  28. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
  29. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
  30. mistralai/models/jobsout.py +4 -2
  31. mistralai/models/legacyjobmetadataout.py +4 -2
  32. mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
  33. mistralai/models/retrievefileout.py +8 -3
  34. mistralai/models/systemmessage.py +6 -6
  35. mistralai/models/tool.py +9 -5
  36. mistralai/models/toolcall.py +8 -4
  37. mistralai/models/trainingparameters.py +6 -2
  38. mistralai/models/trainingparametersin.py +10 -2
  39. mistralai/models/unarchiveftmodelout.py +4 -2
  40. mistralai/models/uploadfileout.py +8 -3
  41. mistralai/models/usermessage.py +6 -6
  42. mistralai/models/validationerror.py +6 -6
  43. mistralai/models/wandbintegration.py +4 -2
  44. mistralai/models/wandbintegrationout.py +4 -2
  45. mistralai/models_.py +10 -10
  46. mistralai/sdk.py +2 -2
  47. mistralai/sdkconfiguration.py +3 -3
  48. mistralai/utils/__init__.py +2 -2
  49. mistralai/utils/forms.py +10 -9
  50. mistralai/utils/headers.py +8 -8
  51. mistralai/utils/logger.py +8 -0
  52. mistralai/utils/queryparams.py +16 -14
  53. mistralai/utils/serializers.py +17 -8
  54. mistralai/utils/url.py +13 -8
  55. mistralai/utils/values.py +6 -0
  56. mistralai/version.py +7 -0
  57. {mistralai-1.0.0rc2.dist-info → mistralai-1.0.2.dist-info}/METADATA +40 -18
  58. {mistralai-1.0.0rc2.dist-info → mistralai-1.0.2.dist-info}/RECORD +87 -86
  59. mistralai_azure/models/__init__.py +4 -4
  60. mistralai_azure/models/chatcompletionchoice.py +3 -4
  61. mistralai_azure/models/chatcompletionrequest.py +14 -14
  62. mistralai_azure/models/chatcompletionstreamrequest.py +14 -14
  63. mistralai_azure/models/deltamessage.py +6 -6
  64. mistralai_azure/models/functioncall.py +9 -3
  65. mistralai_azure/models/systemmessage.py +6 -6
  66. mistralai_azure/models/tool.py +9 -5
  67. mistralai_azure/models/toolcall.py +8 -4
  68. mistralai_azure/models/usermessage.py +6 -6
  69. mistralai_azure/models/validationerror.py +6 -6
  70. mistralai_azure/sdkconfiguration.py +3 -3
  71. mistralai_gcp/chat.py +4 -4
  72. mistralai_gcp/models/__init__.py +4 -4
  73. mistralai_gcp/models/chatcompletionchoice.py +3 -4
  74. mistralai_gcp/models/chatcompletionrequest.py +16 -16
  75. mistralai_gcp/models/chatcompletionstreamrequest.py +16 -16
  76. mistralai_gcp/models/deltamessage.py +6 -6
  77. mistralai_gcp/models/fimcompletionrequest.py +8 -8
  78. mistralai_gcp/models/fimcompletionstreamrequest.py +8 -8
  79. mistralai_gcp/models/functioncall.py +9 -3
  80. mistralai_gcp/models/systemmessage.py +6 -6
  81. mistralai_gcp/models/tool.py +9 -5
  82. mistralai_gcp/models/toolcall.py +8 -4
  83. mistralai_gcp/models/usermessage.py +6 -6
  84. mistralai_gcp/models/validationerror.py +6 -6
  85. mistralai_gcp/sdkconfiguration.py +3 -3
  86. {mistralai-1.0.0rc2.dist-info → mistralai-1.0.2.dist-info}/LICENSE +0 -0
  87. {mistralai-1.0.0rc2.dist-info → mistralai-1.0.2.dist-info}/WHEEL +0 -0
mistralai/agents.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from .basesdk import BaseSDK
4
4
  from mistralai import models, utils
5
5
  from mistralai._hooks import HookContext
6
- from mistralai.types import Nullable, OptionalNullable, UNSET
6
+ from mistralai.types import OptionalNullable, UNSET
7
7
  from mistralai.utils import eventstreaming, get_security_from_env
8
8
  from typing import Any, AsyncGenerator, Generator, List, Optional, Union
9
9
 
@@ -27,7 +27,7 @@ class Agents(BaseSDK):
27
27
  server_url: Optional[str] = None,
28
28
  timeout_ms: Optional[int] = None,
29
29
  ) -> Optional[models.ChatCompletionResponse]:
30
- r"""Chat Completion
30
+ r"""Agents Completion
31
31
 
32
32
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
33
33
  :param agent_id: The ID of the agent to use for this completion.
@@ -131,7 +131,7 @@ class Agents(BaseSDK):
131
131
  server_url: Optional[str] = None,
132
132
  timeout_ms: Optional[int] = None,
133
133
  ) -> Optional[models.ChatCompletionResponse]:
134
- r"""Chat Completion
134
+ r"""Agents Completion
135
135
 
136
136
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
137
137
  :param agent_id: The ID of the agent to use for this completion.
@@ -221,16 +221,16 @@ class Agents(BaseSDK):
221
221
 
222
222
  def stream(
223
223
  self, *,
224
- model: Nullable[str],
225
- prompt: str,
226
- temperature: Optional[float] = 0.7,
227
- top_p: Optional[float] = 1,
224
+ messages: Union[List[models.AgentsCompletionStreamRequestMessages], List[models.AgentsCompletionStreamRequestMessagesTypedDict]],
225
+ agent_id: str,
228
226
  max_tokens: OptionalNullable[int] = UNSET,
229
227
  min_tokens: OptionalNullable[int] = UNSET,
230
228
  stream: Optional[bool] = True,
231
229
  stop: Optional[Union[models.AgentsCompletionStreamRequestStop, models.AgentsCompletionStreamRequestStopTypedDict]] = None,
232
230
  random_seed: OptionalNullable[int] = UNSET,
233
- suffix: OptionalNullable[str] = UNSET,
231
+ response_format: Optional[Union[models.ResponseFormat, models.ResponseFormatTypedDict]] = None,
232
+ tools: OptionalNullable[Union[List[models.Tool], List[models.ToolTypedDict]]] = UNSET,
233
+ tool_choice: Optional[models.AgentsCompletionStreamRequestToolChoice] = "auto",
234
234
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
235
235
  server_url: Optional[str] = None,
236
236
  timeout_ms: Optional[int] = None,
@@ -239,16 +239,16 @@ class Agents(BaseSDK):
239
239
 
240
240
  Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
241
241
 
242
- :param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
243
- :param prompt: The text/code to complete.
244
- :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
245
- :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
242
+ :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
243
+ :param agent_id: The ID of the agent to use for this completion.
246
244
  :param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
247
245
  :param min_tokens: The minimum number of tokens to generate in the completion.
248
246
  :param stream:
249
247
  :param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
250
248
  :param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
251
- :param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
249
+ :param response_format:
250
+ :param tools:
251
+ :param tool_choice:
252
252
  :param retries: Override the default retry configuration for this method
253
253
  :param server_url: Override the default server URL for this method
254
254
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -262,16 +262,16 @@ class Agents(BaseSDK):
262
262
  base_url = server_url
263
263
 
264
264
  request = models.AgentsCompletionStreamRequest(
265
- model=model,
266
- temperature=temperature,
267
- top_p=top_p,
268
265
  max_tokens=max_tokens,
269
266
  min_tokens=min_tokens,
270
267
  stream=stream,
271
268
  stop=stop,
272
269
  random_seed=random_seed,
273
- prompt=prompt,
274
- suffix=suffix,
270
+ messages=utils.get_pydantic_model(messages, List[models.AgentsCompletionStreamRequestMessages]),
271
+ response_format=utils.get_pydantic_model(response_format, Optional[models.ResponseFormat]),
272
+ tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]),
273
+ tool_choice=tool_choice,
274
+ agent_id=agent_id,
275
275
  )
276
276
 
277
277
  req = self.build_request(
@@ -328,16 +328,16 @@ class Agents(BaseSDK):
328
328
 
329
329
  async def stream_async(
330
330
  self, *,
331
- model: Nullable[str],
332
- prompt: str,
333
- temperature: Optional[float] = 0.7,
334
- top_p: Optional[float] = 1,
331
+ messages: Union[List[models.AgentsCompletionStreamRequestMessages], List[models.AgentsCompletionStreamRequestMessagesTypedDict]],
332
+ agent_id: str,
335
333
  max_tokens: OptionalNullable[int] = UNSET,
336
334
  min_tokens: OptionalNullable[int] = UNSET,
337
335
  stream: Optional[bool] = True,
338
336
  stop: Optional[Union[models.AgentsCompletionStreamRequestStop, models.AgentsCompletionStreamRequestStopTypedDict]] = None,
339
337
  random_seed: OptionalNullable[int] = UNSET,
340
- suffix: OptionalNullable[str] = UNSET,
338
+ response_format: Optional[Union[models.ResponseFormat, models.ResponseFormatTypedDict]] = None,
339
+ tools: OptionalNullable[Union[List[models.Tool], List[models.ToolTypedDict]]] = UNSET,
340
+ tool_choice: Optional[models.AgentsCompletionStreamRequestToolChoice] = "auto",
341
341
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
342
342
  server_url: Optional[str] = None,
343
343
  timeout_ms: Optional[int] = None,
@@ -346,16 +346,16 @@ class Agents(BaseSDK):
346
346
 
347
347
  Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
348
348
 
349
- :param model: ID of the model to use. Only compatible for now with: - `codestral-2405` - `codestral-latest`
350
- :param prompt: The text/code to complete.
351
- :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
352
- :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
349
+ :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
350
+ :param agent_id: The ID of the agent to use for this completion.
353
351
  :param max_tokens: The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length.
354
352
  :param min_tokens: The minimum number of tokens to generate in the completion.
355
353
  :param stream:
356
354
  :param stop: Stop generation if this token is detected. Or if one of these tokens is detected when providing an array
357
355
  :param random_seed: The seed to use for random sampling. If set, different calls will generate deterministic results.
358
- :param suffix: Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`.
356
+ :param response_format:
357
+ :param tools:
358
+ :param tool_choice:
359
359
  :param retries: Override the default retry configuration for this method
360
360
  :param server_url: Override the default server URL for this method
361
361
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -369,16 +369,16 @@ class Agents(BaseSDK):
369
369
  base_url = server_url
370
370
 
371
371
  request = models.AgentsCompletionStreamRequest(
372
- model=model,
373
- temperature=temperature,
374
- top_p=top_p,
375
372
  max_tokens=max_tokens,
376
373
  min_tokens=min_tokens,
377
374
  stream=stream,
378
375
  stop=stop,
379
376
  random_seed=random_seed,
380
- prompt=prompt,
381
- suffix=suffix,
377
+ messages=utils.get_pydantic_model(messages, List[models.AgentsCompletionStreamRequestMessages]),
378
+ response_format=utils.get_pydantic_model(response_format, Optional[models.ResponseFormat]),
379
+ tools=utils.get_pydantic_model(tools, OptionalNullable[List[models.Tool]]),
380
+ tool_choice=tool_choice,
381
+ agent_id=agent_id,
382
382
  )
383
383
 
384
384
  req = self.build_request(
mistralai/chat.py CHANGED
@@ -32,7 +32,7 @@ class Chat(BaseSDK):
32
32
  ) -> Optional[models.ChatCompletionResponse]:
33
33
  r"""Chat Completion
34
34
 
35
- :param model: ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions.
35
+ :param model: 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.
36
36
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
37
37
  :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
38
38
  :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
@@ -145,7 +145,7 @@ class Chat(BaseSDK):
145
145
  ) -> Optional[models.ChatCompletionResponse]:
146
146
  r"""Chat Completion
147
147
 
148
- :param model: ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions.
148
+ :param model: 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.
149
149
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
150
150
  :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
151
151
  :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
@@ -260,7 +260,7 @@ class Chat(BaseSDK):
260
260
 
261
261
  Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
262
262
 
263
- :param model: ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions.
263
+ :param model: 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.
264
264
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
265
265
  :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
266
266
  :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
@@ -376,7 +376,7 @@ class Chat(BaseSDK):
376
376
 
377
377
  Mistral AI provides the ability to stream responses back to a client in order to allow partial results for certain requests. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message. Otherwise, the server will hold the request open until the timeout or until completion, with the response containing the full result as JSON.
378
378
 
379
- :param model: ID of the model to use. You can use the [List Available Models](/api#operation/listModels) API to see all of your available models, or see our [Model overview](/models) for model descriptions.
379
+ :param model: 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.
380
380
  :param messages: The prompt(s) to generate completions for, encoded as a list of dict with role and content.
381
381
  :param temperature: What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.
382
382
  :param top_p: Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
mistralai/client.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from typing import Optional
2
2
 
3
- MIGRATION_MESSAGE = "This client is deprecated starting v1.0.0, pin your version to 0.4.2. Or migrate by following this documentation: TODO add link"
3
+ MIGRATION_MESSAGE = "This client is deprecated. To migrate to the new client, please refer to this guide: https://github.com/mistralai/client-python/blob/main/MIGRATION.md. If you need to use this client anyway, pin your version to 0.4.2."
4
4
 
5
5
 
6
6
  class MistralClient:
mistralai/jobs.py CHANGED
@@ -211,12 +211,11 @@ class Jobs(BaseSDK):
211
211
  self, *,
212
212
  model: models.FineTuneableModel,
213
213
  hyperparameters: Union[models.TrainingParametersIn, models.TrainingParametersInTypedDict],
214
- dry_run: OptionalNullable[bool] = UNSET,
215
214
  training_files: Optional[Union[List[models.TrainingFile], List[models.TrainingFileTypedDict]]] = None,
216
215
  validation_files: OptionalNullable[List[str]] = UNSET,
217
216
  suffix: OptionalNullable[str] = UNSET,
218
- integrations: OptionalNullable[Union[List[models.WandbIntegration], List[models.WandbIntegrationTypedDict]]] = UNSET,
219
- repositories: Optional[Union[List[models.GithubRepositoryIn], List[models.GithubRepositoryInTypedDict]]] = None,
217
+ integrations: OptionalNullable[Union[List[models.JobInIntegrations], List[models.JobInIntegrationsTypedDict]]] = UNSET,
218
+ repositories: Optional[Union[List[models.JobInRepositories], List[models.JobInRepositoriesTypedDict]]] = None,
220
219
  auto_start: Optional[bool] = None,
221
220
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
222
221
  server_url: Optional[str] = None,
@@ -228,7 +227,6 @@ class Jobs(BaseSDK):
228
227
 
229
228
  :param model: The name of the model to fine-tune.
230
229
  :param hyperparameters: The fine-tuning hyperparameter settings used in a fine-tune job.
231
- :param dry_run: * If `true` the job is not spawned, instead the query returns a handful of useful metadata for the user to perform sanity checks (see `LegacyJobMetadataOut` response). * Otherwise, the job is started and the query returns the job ID along with some of the input parameters (see `JobOut` response).
232
230
  :param training_files:
233
231
  :param validation_files: A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
234
232
  :param suffix: A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`
@@ -247,18 +245,15 @@ class Jobs(BaseSDK):
247
245
  if server_url is not None:
248
246
  base_url = server_url
249
247
 
250
- request = models.JobsAPIRoutesFineTuningCreateFineTuningJobRequest(
251
- dry_run=dry_run,
252
- job_in=models.JobIn(
253
- model=model,
254
- training_files=utils.get_pydantic_model(training_files, Optional[List[models.TrainingFile]]),
255
- validation_files=validation_files,
256
- hyperparameters=utils.get_pydantic_model(hyperparameters, models.TrainingParametersIn),
257
- suffix=suffix,
258
- integrations=utils.get_pydantic_model(integrations, OptionalNullable[List[models.WandbIntegration]]),
259
- repositories=utils.get_pydantic_model(repositories, Optional[List[models.GithubRepositoryIn]]),
260
- auto_start=auto_start,
261
- ),
248
+ request = models.JobIn(
249
+ model=model,
250
+ training_files=utils.get_pydantic_model(training_files, Optional[List[models.TrainingFile]]),
251
+ validation_files=validation_files,
252
+ hyperparameters=utils.get_pydantic_model(hyperparameters, models.TrainingParametersIn),
253
+ suffix=suffix,
254
+ integrations=utils.get_pydantic_model(integrations, OptionalNullable[List[models.JobInIntegrations]]),
255
+ repositories=utils.get_pydantic_model(repositories, Optional[List[models.JobInRepositories]]),
256
+ auto_start=auto_start,
262
257
  )
263
258
 
264
259
  req = self.build_request(
@@ -273,7 +268,7 @@ class Jobs(BaseSDK):
273
268
  user_agent_header="user-agent",
274
269
  accept_header_value="application/json",
275
270
  security=self.sdk_configuration.security,
276
- get_serialized_body=lambda: utils.serialize_request_body(request.job_in, False, False, "json", models.JobIn),
271
+ get_serialized_body=lambda: utils.serialize_request_body(request, False, False, "json", models.JobIn),
277
272
  timeout_ms=timeout_ms,
278
273
  )
279
274
 
@@ -312,12 +307,11 @@ class Jobs(BaseSDK):
312
307
  self, *,
313
308
  model: models.FineTuneableModel,
314
309
  hyperparameters: Union[models.TrainingParametersIn, models.TrainingParametersInTypedDict],
315
- dry_run: OptionalNullable[bool] = UNSET,
316
310
  training_files: Optional[Union[List[models.TrainingFile], List[models.TrainingFileTypedDict]]] = None,
317
311
  validation_files: OptionalNullable[List[str]] = UNSET,
318
312
  suffix: OptionalNullable[str] = UNSET,
319
- integrations: OptionalNullable[Union[List[models.WandbIntegration], List[models.WandbIntegrationTypedDict]]] = UNSET,
320
- repositories: Optional[Union[List[models.GithubRepositoryIn], List[models.GithubRepositoryInTypedDict]]] = None,
313
+ integrations: OptionalNullable[Union[List[models.JobInIntegrations], List[models.JobInIntegrationsTypedDict]]] = UNSET,
314
+ repositories: Optional[Union[List[models.JobInRepositories], List[models.JobInRepositoriesTypedDict]]] = None,
321
315
  auto_start: Optional[bool] = None,
322
316
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
323
317
  server_url: Optional[str] = None,
@@ -329,7 +323,6 @@ class Jobs(BaseSDK):
329
323
 
330
324
  :param model: The name of the model to fine-tune.
331
325
  :param hyperparameters: The fine-tuning hyperparameter settings used in a fine-tune job.
332
- :param dry_run: * If `true` the job is not spawned, instead the query returns a handful of useful metadata for the user to perform sanity checks (see `LegacyJobMetadataOut` response). * Otherwise, the job is started and the query returns the job ID along with some of the input parameters (see `JobOut` response).
333
326
  :param training_files:
334
327
  :param validation_files: A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
335
328
  :param suffix: A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`
@@ -348,18 +341,15 @@ class Jobs(BaseSDK):
348
341
  if server_url is not None:
349
342
  base_url = server_url
350
343
 
351
- request = models.JobsAPIRoutesFineTuningCreateFineTuningJobRequest(
352
- dry_run=dry_run,
353
- job_in=models.JobIn(
354
- model=model,
355
- training_files=utils.get_pydantic_model(training_files, Optional[List[models.TrainingFile]]),
356
- validation_files=validation_files,
357
- hyperparameters=utils.get_pydantic_model(hyperparameters, models.TrainingParametersIn),
358
- suffix=suffix,
359
- integrations=utils.get_pydantic_model(integrations, OptionalNullable[List[models.WandbIntegration]]),
360
- repositories=utils.get_pydantic_model(repositories, Optional[List[models.GithubRepositoryIn]]),
361
- auto_start=auto_start,
362
- ),
344
+ request = models.JobIn(
345
+ model=model,
346
+ training_files=utils.get_pydantic_model(training_files, Optional[List[models.TrainingFile]]),
347
+ validation_files=validation_files,
348
+ hyperparameters=utils.get_pydantic_model(hyperparameters, models.TrainingParametersIn),
349
+ suffix=suffix,
350
+ integrations=utils.get_pydantic_model(integrations, OptionalNullable[List[models.JobInIntegrations]]),
351
+ repositories=utils.get_pydantic_model(repositories, Optional[List[models.JobInRepositories]]),
352
+ auto_start=auto_start,
363
353
  )
364
354
 
365
355
  req = self.build_request(
@@ -374,7 +364,7 @@ class Jobs(BaseSDK):
374
364
  user_agent_header="user-agent",
375
365
  accept_header_value="application/json",
376
366
  security=self.sdk_configuration.security,
377
- get_serialized_body=lambda: utils.serialize_request_body(request.job_in, False, False, "json", models.JobIn),
367
+ get_serialized_body=lambda: utils.serialize_request_body(request, False, False, "json", models.JobIn),
378
368
  timeout_ms=timeout_ms,
379
369
  )
380
370
 
@@ -1,8 +1,8 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .agentscompletionrequest import AgentsCompletionRequest, AgentsCompletionRequestMessages, AgentsCompletionRequestMessagesTypedDict, AgentsCompletionRequestStop, AgentsCompletionRequestStopTypedDict, AgentsCompletionRequestToolChoice, AgentsCompletionRequestTypedDict
4
- from .agentscompletionstreamrequest import AgentsCompletionStreamRequest, AgentsCompletionStreamRequestStop, AgentsCompletionStreamRequestStopTypedDict, AgentsCompletionStreamRequestTypedDict
5
- from .archiveftmodelout import ArchiveFTModelOut, ArchiveFTModelOutTypedDict
4
+ from .agentscompletionstreamrequest import AgentsCompletionStreamRequest, AgentsCompletionStreamRequestMessages, AgentsCompletionStreamRequestMessagesTypedDict, AgentsCompletionStreamRequestStop, AgentsCompletionStreamRequestStopTypedDict, AgentsCompletionStreamRequestToolChoice, AgentsCompletionStreamRequestTypedDict
5
+ from .archiveftmodelout import ArchiveFTModelOut, ArchiveFTModelOutObject, ArchiveFTModelOutTypedDict
6
6
  from .assistantmessage import AssistantMessage, AssistantMessageRole, AssistantMessageTypedDict
7
7
  from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict, FinishReason
8
8
  from .chatcompletionrequest import ChatCompletionRequest, ChatCompletionRequestTypedDict, Messages, MessagesTypedDict, Stop, StopTypedDict, ToolChoice
@@ -17,39 +17,39 @@ from .delete_model_v1_models_model_id_deleteop import DeleteModelV1ModelsModelID
17
17
  from .deletefileout import DeleteFileOut, DeleteFileOutTypedDict
18
18
  from .deletemodelout import DeleteModelOut, DeleteModelOutTypedDict
19
19
  from .deltamessage import DeltaMessage, DeltaMessageTypedDict
20
- from .detailedjobout import DetailedJobOut, DetailedJobOutStatus, DetailedJobOutTypedDict
20
+ from .detailedjobout import DetailedJobOut, DetailedJobOutIntegrations, DetailedJobOutIntegrationsTypedDict, DetailedJobOutObject, DetailedJobOutRepositories, DetailedJobOutRepositoriesTypedDict, DetailedJobOutStatus, DetailedJobOutTypedDict
21
21
  from .embeddingrequest import EmbeddingRequest, EmbeddingRequestTypedDict, Inputs, InputsTypedDict
22
22
  from .embeddingresponse import EmbeddingResponse, EmbeddingResponseTypedDict
23
23
  from .embeddingresponsedata import EmbeddingResponseData, EmbeddingResponseDataTypedDict
24
24
  from .eventout import EventOut, EventOutTypedDict
25
25
  from .files_api_routes_delete_fileop import FilesAPIRoutesDeleteFileRequest, FilesAPIRoutesDeleteFileRequestTypedDict
26
26
  from .files_api_routes_retrieve_fileop import FilesAPIRoutesRetrieveFileRequest, FilesAPIRoutesRetrieveFileRequestTypedDict
27
- from .files_api_routes_upload_fileop import File, FileTypedDict, FilesAPIRoutesUploadFileMultiPartBodyParams, FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict
28
- from .fileschema import FileSchema, FileSchemaTypedDict
27
+ from .files_api_routes_upload_fileop import File, FileTypedDict, FilesAPIRoutesUploadFileMultiPartBodyParams, FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict, FilesAPIRoutesUploadFilePurpose
28
+ from .fileschema import FileSchema, FileSchemaPurpose, FileSchemaTypedDict
29
29
  from .fimcompletionrequest import FIMCompletionRequest, FIMCompletionRequestStop, FIMCompletionRequestStopTypedDict, FIMCompletionRequestTypedDict
30
30
  from .fimcompletionresponse import FIMCompletionResponse, FIMCompletionResponseTypedDict
31
31
  from .fimcompletionstreamrequest import FIMCompletionStreamRequest, FIMCompletionStreamRequestStop, FIMCompletionStreamRequestStopTypedDict, FIMCompletionStreamRequestTypedDict
32
32
  from .finetuneablemodel import FineTuneableModel
33
33
  from .ftmodelcapabilitiesout import FTModelCapabilitiesOut, FTModelCapabilitiesOutTypedDict
34
- from .ftmodelout import FTModelOut, FTModelOutTypedDict
34
+ from .ftmodelout import FTModelOut, FTModelOutObject, FTModelOutTypedDict
35
35
  from .function import Function, FunctionTypedDict
36
- from .functioncall import FunctionCall, FunctionCallTypedDict
37
- from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
38
- from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
36
+ from .functioncall import Arguments, ArgumentsTypedDict, FunctionCall, FunctionCallTypedDict
37
+ from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInType, GithubRepositoryInTypedDict
38
+ from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutType, GithubRepositoryOutTypedDict
39
39
  from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
40
- from .jobin import JobIn, JobInTypedDict
40
+ from .jobin import JobIn, JobInIntegrations, JobInIntegrationsTypedDict, JobInRepositories, JobInRepositoriesTypedDict, JobInTypedDict
41
41
  from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
42
- from .jobout import JobOut, JobOutTypedDict, Status
42
+ from .jobout import Integrations, IntegrationsTypedDict, JobOut, JobOutTypedDict, Object, Repositories, RepositoriesTypedDict, Status
43
43
  from .jobs_api_routes_fine_tuning_archive_fine_tuned_modelop import JobsAPIRoutesFineTuningArchiveFineTunedModelRequest, JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict
44
44
  from .jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop import JobsAPIRoutesFineTuningCancelFineTuningJobRequest, JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict
45
- from .jobs_api_routes_fine_tuning_create_fine_tuning_jobop import JobsAPIRoutesFineTuningCreateFineTuningJobRequest, JobsAPIRoutesFineTuningCreateFineTuningJobRequestTypedDict, JobsAPIRoutesFineTuningCreateFineTuningJobResponse, JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict
45
+ from .jobs_api_routes_fine_tuning_create_fine_tuning_jobop import JobsAPIRoutesFineTuningCreateFineTuningJobResponse, JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict
46
46
  from .jobs_api_routes_fine_tuning_get_fine_tuning_jobop import JobsAPIRoutesFineTuningGetFineTuningJobRequest, JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict
47
47
  from .jobs_api_routes_fine_tuning_get_fine_tuning_jobsop import JobsAPIRoutesFineTuningGetFineTuningJobsRequest, JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict, QueryParamStatus
48
48
  from .jobs_api_routes_fine_tuning_start_fine_tuning_jobop import JobsAPIRoutesFineTuningStartFineTuningJobRequest, JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict
49
49
  from .jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop import JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest, JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict
50
50
  from .jobs_api_routes_fine_tuning_update_fine_tuned_modelop import JobsAPIRoutesFineTuningUpdateFineTunedModelRequest, JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict
51
- from .jobsout import JobsOut, JobsOutTypedDict
52
- from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
51
+ from .jobsout import JobsOut, JobsOutObject, JobsOutTypedDict
52
+ from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutObject, LegacyJobMetadataOutTypedDict
53
53
  from .listfilesout import ListFilesOut, ListFilesOutTypedDict
54
54
  from .metricout import MetricOut, MetricOutTypedDict
55
55
  from .modelcapabilities import ModelCapabilities, ModelCapabilitiesTypedDict
@@ -57,26 +57,26 @@ from .modelcard import ModelCard, ModelCardTypedDict
57
57
  from .modellist import ModelList, ModelListTypedDict
58
58
  from .responseformat import ResponseFormat, ResponseFormatTypedDict, ResponseFormats
59
59
  from .retrieve_model_v1_models_model_id_getop import RetrieveModelV1ModelsModelIDGetRequest, RetrieveModelV1ModelsModelIDGetRequestTypedDict
60
- from .retrievefileout import RetrieveFileOut, RetrieveFileOutTypedDict
60
+ from .retrievefileout import RetrieveFileOut, RetrieveFileOutPurpose, RetrieveFileOutTypedDict
61
61
  from .sampletype import SampleType
62
62
  from .sdkerror import SDKError
63
63
  from .security import Security, SecurityTypedDict
64
64
  from .source import Source
65
65
  from .systemmessage import Content, ContentTypedDict, Role, SystemMessage, SystemMessageTypedDict
66
66
  from .textchunk import TextChunk, TextChunkTypedDict
67
- from .tool import Tool, ToolTypedDict
68
- from .toolcall import ToolCall, ToolCallTypedDict
67
+ from .tool import Tool, ToolToolTypes, ToolTypedDict
68
+ from .toolcall import ToolCall, ToolCallTypedDict, ToolTypes
69
69
  from .toolmessage import ToolMessage, ToolMessageRole, ToolMessageTypedDict
70
70
  from .trainingfile import TrainingFile, TrainingFileTypedDict
71
71
  from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
72
72
  from .trainingparametersin import TrainingParametersIn, TrainingParametersInTypedDict
73
- from .unarchiveftmodelout import UnarchiveFTModelOut, UnarchiveFTModelOutTypedDict
73
+ from .unarchiveftmodelout import UnarchiveFTModelOut, UnarchiveFTModelOutObject, UnarchiveFTModelOutTypedDict
74
74
  from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
75
- from .uploadfileout import UploadFileOut, UploadFileOutTypedDict
75
+ from .uploadfileout import Purpose, UploadFileOut, UploadFileOutTypedDict
76
76
  from .usageinfo import UsageInfo, UsageInfoTypedDict
77
77
  from .usermessage import UserMessage, UserMessageContent, UserMessageContentTypedDict, UserMessageRole, UserMessageTypedDict
78
78
  from .validationerror import Loc, LocTypedDict, ValidationError, ValidationErrorTypedDict
79
- from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
80
- from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
79
+ from .wandbintegration import WandbIntegration, WandbIntegrationType, WandbIntegrationTypedDict
80
+ from .wandbintegrationout import Type, WandbIntegrationOut, WandbIntegrationOutTypedDict
81
81
 
82
- __all__ = ["AgentsCompletionRequest", "AgentsCompletionRequestMessages", "AgentsCompletionRequestMessagesTypedDict", "AgentsCompletionRequestStop", "AgentsCompletionRequestStopTypedDict", "AgentsCompletionRequestToolChoice", "AgentsCompletionRequestTypedDict", "AgentsCompletionStreamRequest", "AgentsCompletionStreamRequestStop", "AgentsCompletionStreamRequestStopTypedDict", "AgentsCompletionStreamRequestTypedDict", "ArchiveFTModelOut", "ArchiveFTModelOutTypedDict", "AssistantMessage", "AssistantMessageRole", "AssistantMessageTypedDict", "ChatCompletionChoice", "ChatCompletionChoiceTypedDict", "ChatCompletionRequest", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", "ChatCompletionStreamRequest", "ChatCompletionStreamRequestMessages", "ChatCompletionStreamRequestMessagesTypedDict", "ChatCompletionStreamRequestStop", "ChatCompletionStreamRequestStopTypedDict", "ChatCompletionStreamRequestToolChoice", "ChatCompletionStreamRequestTypedDict", "CheckpointOut", "CheckpointOutTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", "CompletionEventTypedDict", "CompletionResponseStreamChoice", "CompletionResponseStreamChoiceFinishReason", "CompletionResponseStreamChoiceTypedDict", "Content", "ContentChunk", "ContentChunkTypedDict", "ContentTypedDict", "DeleteFileOut", "DeleteFileOutTypedDict", "DeleteModelOut", "DeleteModelOutTypedDict", "DeleteModelV1ModelsModelIDDeleteRequest", "DeleteModelV1ModelsModelIDDeleteRequestTypedDict", "DeltaMessage", "DeltaMessageTypedDict", "DetailedJobOut", "DetailedJobOutStatus", "DetailedJobOutTypedDict", "EmbeddingRequest", "EmbeddingRequestTypedDict", "EmbeddingResponse", "EmbeddingResponseData", "EmbeddingResponseDataTypedDict", "EmbeddingResponseTypedDict", "EventOut", "EventOutTypedDict", "FIMCompletionRequest", "FIMCompletionRequestStop", "FIMCompletionRequestStopTypedDict", "FIMCompletionRequestTypedDict", "FIMCompletionResponse", "FIMCompletionResponseTypedDict", "FIMCompletionStreamRequest", "FIMCompletionStreamRequestStop", "FIMCompletionStreamRequestStopTypedDict", "FIMCompletionStreamRequestTypedDict", "FTModelCapabilitiesOut", "FTModelCapabilitiesOutTypedDict", "FTModelOut", "FTModelOutTypedDict", "File", "FileSchema", "FileSchemaTypedDict", "FileTypedDict", "FilesAPIRoutesDeleteFileRequest", "FilesAPIRoutesDeleteFileRequestTypedDict", "FilesAPIRoutesRetrieveFileRequest", "FilesAPIRoutesRetrieveFileRequestTypedDict", "FilesAPIRoutesUploadFileMultiPartBodyParams", "FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict", "FineTuneableModel", "FinishReason", "Function", "FunctionCall", "FunctionCallTypedDict", "FunctionTypedDict", "GithubRepositoryIn", "GithubRepositoryInTypedDict", "GithubRepositoryOut", "GithubRepositoryOutTypedDict", "HTTPValidationError", "HTTPValidationErrorData", "Inputs", "InputsTypedDict", "JobIn", "JobInTypedDict", "JobMetadataOut", "JobMetadataOutTypedDict", "JobOut", "JobOutTypedDict", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningCancelFineTuningJobRequest", "JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningCreateFineTuningJobRequest", "JobsAPIRoutesFineTuningCreateFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningCreateFineTuningJobResponse", "JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobRequest", "JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobsRequest", "JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict", "JobsAPIRoutesFineTuningStartFineTuningJobRequest", "JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequest", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict", "JobsOut", "JobsOutTypedDict", "LegacyJobMetadataOut", "LegacyJobMetadataOutTypedDict", "ListFilesOut", "ListFilesOutTypedDict", "Loc", "LocTypedDict", "Messages", "MessagesTypedDict", "MetricOut", "MetricOutTypedDict", "ModelCapabilities", "ModelCapabilitiesTypedDict", "ModelCard", "ModelCardTypedDict", "ModelList", "ModelListTypedDict", "QueryParamStatus", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", "RetrieveFileOut", "RetrieveFileOutTypedDict", "RetrieveModelV1ModelsModelIDGetRequest", "RetrieveModelV1ModelsModelIDGetRequestTypedDict", "Role", "SDKError", "SampleType", "Security", "SecurityTypedDict", "Source", "Status", "Stop", "StopTypedDict", "SystemMessage", "SystemMessageTypedDict", "TextChunk", "TextChunkTypedDict", "Tool", "ToolCall", "ToolCallTypedDict", "ToolChoice", "ToolMessage", "ToolMessageRole", "ToolMessageTypedDict", "ToolTypedDict", "TrainingFile", "TrainingFileTypedDict", "TrainingParameters", "TrainingParametersIn", "TrainingParametersInTypedDict", "TrainingParametersTypedDict", "UnarchiveFTModelOut", "UnarchiveFTModelOutTypedDict", "UpdateFTModelIn", "UpdateFTModelInTypedDict", "UploadFileOut", "UploadFileOutTypedDict", "UsageInfo", "UsageInfoTypedDict", "UserMessage", "UserMessageContent", "UserMessageContentTypedDict", "UserMessageRole", "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", "WandbIntegration", "WandbIntegrationOut", "WandbIntegrationOutTypedDict", "WandbIntegrationTypedDict"]
82
+ __all__ = ["AgentsCompletionRequest", "AgentsCompletionRequestMessages", "AgentsCompletionRequestMessagesTypedDict", "AgentsCompletionRequestStop", "AgentsCompletionRequestStopTypedDict", "AgentsCompletionRequestToolChoice", "AgentsCompletionRequestTypedDict", "AgentsCompletionStreamRequest", "AgentsCompletionStreamRequestMessages", "AgentsCompletionStreamRequestMessagesTypedDict", "AgentsCompletionStreamRequestStop", "AgentsCompletionStreamRequestStopTypedDict", "AgentsCompletionStreamRequestToolChoice", "AgentsCompletionStreamRequestTypedDict", "ArchiveFTModelOut", "ArchiveFTModelOutObject", "ArchiveFTModelOutTypedDict", "Arguments", "ArgumentsTypedDict", "AssistantMessage", "AssistantMessageRole", "AssistantMessageTypedDict", "ChatCompletionChoice", "ChatCompletionChoiceTypedDict", "ChatCompletionRequest", "ChatCompletionRequestTypedDict", "ChatCompletionResponse", "ChatCompletionResponseTypedDict", "ChatCompletionStreamRequest", "ChatCompletionStreamRequestMessages", "ChatCompletionStreamRequestMessagesTypedDict", "ChatCompletionStreamRequestStop", "ChatCompletionStreamRequestStopTypedDict", "ChatCompletionStreamRequestToolChoice", "ChatCompletionStreamRequestTypedDict", "CheckpointOut", "CheckpointOutTypedDict", "CompletionChunk", "CompletionChunkTypedDict", "CompletionEvent", "CompletionEventTypedDict", "CompletionResponseStreamChoice", "CompletionResponseStreamChoiceFinishReason", "CompletionResponseStreamChoiceTypedDict", "Content", "ContentChunk", "ContentChunkTypedDict", "ContentTypedDict", "DeleteFileOut", "DeleteFileOutTypedDict", "DeleteModelOut", "DeleteModelOutTypedDict", "DeleteModelV1ModelsModelIDDeleteRequest", "DeleteModelV1ModelsModelIDDeleteRequestTypedDict", "DeltaMessage", "DeltaMessageTypedDict", "DetailedJobOut", "DetailedJobOutIntegrations", "DetailedJobOutIntegrationsTypedDict", "DetailedJobOutObject", "DetailedJobOutRepositories", "DetailedJobOutRepositoriesTypedDict", "DetailedJobOutStatus", "DetailedJobOutTypedDict", "EmbeddingRequest", "EmbeddingRequestTypedDict", "EmbeddingResponse", "EmbeddingResponseData", "EmbeddingResponseDataTypedDict", "EmbeddingResponseTypedDict", "EventOut", "EventOutTypedDict", "FIMCompletionRequest", "FIMCompletionRequestStop", "FIMCompletionRequestStopTypedDict", "FIMCompletionRequestTypedDict", "FIMCompletionResponse", "FIMCompletionResponseTypedDict", "FIMCompletionStreamRequest", "FIMCompletionStreamRequestStop", "FIMCompletionStreamRequestStopTypedDict", "FIMCompletionStreamRequestTypedDict", "FTModelCapabilitiesOut", "FTModelCapabilitiesOutTypedDict", "FTModelOut", "FTModelOutObject", "FTModelOutTypedDict", "File", "FileSchema", "FileSchemaPurpose", "FileSchemaTypedDict", "FileTypedDict", "FilesAPIRoutesDeleteFileRequest", "FilesAPIRoutesDeleteFileRequestTypedDict", "FilesAPIRoutesRetrieveFileRequest", "FilesAPIRoutesRetrieveFileRequestTypedDict", "FilesAPIRoutesUploadFileMultiPartBodyParams", "FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict", "FilesAPIRoutesUploadFilePurpose", "FineTuneableModel", "FinishReason", "Function", "FunctionCall", "FunctionCallTypedDict", "FunctionTypedDict", "GithubRepositoryIn", "GithubRepositoryInType", "GithubRepositoryInTypedDict", "GithubRepositoryOut", "GithubRepositoryOutType", "GithubRepositoryOutTypedDict", "HTTPValidationError", "HTTPValidationErrorData", "Inputs", "InputsTypedDict", "Integrations", "IntegrationsTypedDict", "JobIn", "JobInIntegrations", "JobInIntegrationsTypedDict", "JobInRepositories", "JobInRepositoriesTypedDict", "JobInTypedDict", "JobMetadataOut", "JobMetadataOutTypedDict", "JobOut", "JobOutTypedDict", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningCancelFineTuningJobRequest", "JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningCreateFineTuningJobResponse", "JobsAPIRoutesFineTuningCreateFineTuningJobResponseTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobRequest", "JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningGetFineTuningJobsRequest", "JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict", "JobsAPIRoutesFineTuningStartFineTuningJobRequest", "JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest", "JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequest", "JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict", "JobsOut", "JobsOutObject", "JobsOutTypedDict", "LegacyJobMetadataOut", "LegacyJobMetadataOutObject", "LegacyJobMetadataOutTypedDict", "ListFilesOut", "ListFilesOutTypedDict", "Loc", "LocTypedDict", "Messages", "MessagesTypedDict", "MetricOut", "MetricOutTypedDict", "ModelCapabilities", "ModelCapabilitiesTypedDict", "ModelCard", "ModelCardTypedDict", "ModelList", "ModelListTypedDict", "Object", "Purpose", "QueryParamStatus", "Repositories", "RepositoriesTypedDict", "ResponseFormat", "ResponseFormatTypedDict", "ResponseFormats", "RetrieveFileOut", "RetrieveFileOutPurpose", "RetrieveFileOutTypedDict", "RetrieveModelV1ModelsModelIDGetRequest", "RetrieveModelV1ModelsModelIDGetRequestTypedDict", "Role", "SDKError", "SampleType", "Security", "SecurityTypedDict", "Source", "Status", "Stop", "StopTypedDict", "SystemMessage", "SystemMessageTypedDict", "TextChunk", "TextChunkTypedDict", "Tool", "ToolCall", "ToolCallTypedDict", "ToolChoice", "ToolMessage", "ToolMessageRole", "ToolMessageTypedDict", "ToolToolTypes", "ToolTypedDict", "ToolTypes", "TrainingFile", "TrainingFileTypedDict", "TrainingParameters", "TrainingParametersIn", "TrainingParametersInTypedDict", "TrainingParametersTypedDict", "Type", "UnarchiveFTModelOut", "UnarchiveFTModelOutObject", "UnarchiveFTModelOutTypedDict", "UpdateFTModelIn", "UpdateFTModelInTypedDict", "UploadFileOut", "UploadFileOutTypedDict", "UsageInfo", "UsageInfoTypedDict", "UserMessage", "UserMessageContent", "UserMessageContentTypedDict", "UserMessageRole", "UserMessageTypedDict", "ValidationError", "ValidationErrorTypedDict", "WandbIntegration", "WandbIntegrationOut", "WandbIntegrationOutTypedDict", "WandbIntegrationType", "WandbIntegrationTypedDict"]
@@ -13,6 +13,20 @@ from typing import List, Literal, Optional, TypedDict, Union
13
13
  from typing_extensions import Annotated, NotRequired
14
14
 
15
15
 
16
+ AgentsCompletionRequestStopTypedDict = Union[str, List[str]]
17
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
18
+
19
+
20
+ AgentsCompletionRequestStop = Union[str, List[str]]
21
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
22
+
23
+
24
+ AgentsCompletionRequestMessagesTypedDict = Union[UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
25
+
26
+
27
+ AgentsCompletionRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
28
+
29
+
16
30
  AgentsCompletionRequestToolChoice = Literal["auto", "none", "any"]
17
31
 
18
32
  class AgentsCompletionRequestTypedDict(TypedDict):
@@ -80,17 +94,3 @@ class AgentsCompletionRequest(BaseModel):
80
94
 
81
95
  return m
82
96
 
83
-
84
- AgentsCompletionRequestStopTypedDict = Union[str, List[str]]
85
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
86
-
87
-
88
- AgentsCompletionRequestStop = Union[str, List[str]]
89
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
90
-
91
-
92
- AgentsCompletionRequestMessagesTypedDict = Union[UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
93
-
94
-
95
- AgentsCompletionRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
96
-
@@ -1,24 +1,39 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
+ from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
+ from .responseformat import ResponseFormat, ResponseFormatTypedDict
6
+ from .tool import Tool, ToolTypedDict
7
+ from .toolmessage import ToolMessage, ToolMessageTypedDict
8
+ from .usermessage import UserMessage, UserMessageTypedDict
4
9
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
5
- from pydantic import model_serializer
6
- from typing import List, Optional, TypedDict, Union
7
- from typing_extensions import NotRequired
10
+ from mistralai.utils import get_discriminator
11
+ from pydantic import Discriminator, Tag, model_serializer
12
+ from typing import List, Literal, Optional, TypedDict, Union
13
+ from typing_extensions import Annotated, NotRequired
8
14
 
9
15
 
16
+ AgentsCompletionStreamRequestStopTypedDict = Union[str, List[str]]
17
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
18
+
19
+
20
+ AgentsCompletionStreamRequestStop = Union[str, List[str]]
21
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
22
+
23
+
24
+ AgentsCompletionStreamRequestMessagesTypedDict = Union[UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
25
+
26
+
27
+ AgentsCompletionStreamRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
28
+
29
+
30
+ AgentsCompletionStreamRequestToolChoice = Literal["auto", "none", "any"]
31
+
10
32
  class AgentsCompletionStreamRequestTypedDict(TypedDict):
11
- model: Nullable[str]
12
- r"""ID of the model to use. Only compatible for now with:
13
- - `codestral-2405`
14
- - `codestral-latest`
15
- """
16
- prompt: str
17
- r"""The text/code to complete."""
18
- temperature: NotRequired[float]
19
- r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both."""
20
- top_p: NotRequired[float]
21
- r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
33
+ messages: List[AgentsCompletionStreamRequestMessagesTypedDict]
34
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
35
+ agent_id: str
36
+ r"""The ID of the agent to use for this completion."""
22
37
  max_tokens: NotRequired[Nullable[int]]
23
38
  r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
24
39
  min_tokens: NotRequired[Nullable[int]]
@@ -28,22 +43,16 @@ class AgentsCompletionStreamRequestTypedDict(TypedDict):
28
43
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
29
44
  random_seed: NotRequired[Nullable[int]]
30
45
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
31
- suffix: NotRequired[Nullable[str]]
32
- r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
46
+ response_format: NotRequired[ResponseFormatTypedDict]
47
+ tools: NotRequired[Nullable[List[ToolTypedDict]]]
48
+ tool_choice: NotRequired[AgentsCompletionStreamRequestToolChoice]
33
49
 
34
50
 
35
51
  class AgentsCompletionStreamRequest(BaseModel):
36
- model: Nullable[str]
37
- r"""ID of the model to use. Only compatible for now with:
38
- - `codestral-2405`
39
- - `codestral-latest`
40
- """
41
- prompt: str
42
- r"""The text/code to complete."""
43
- temperature: Optional[float] = 0.7
44
- r"""What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both."""
45
- top_p: Optional[float] = 1
46
- r"""Nucleus sampling, where the model considers the results of the tokens with `top_p` probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both."""
52
+ messages: List[AgentsCompletionStreamRequestMessages]
53
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
54
+ agent_id: str
55
+ r"""The ID of the agent to use for this completion."""
47
56
  max_tokens: OptionalNullable[int] = UNSET
48
57
  r"""The maximum number of tokens to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model's context length."""
49
58
  min_tokens: OptionalNullable[int] = UNSET
@@ -53,13 +62,14 @@ class AgentsCompletionStreamRequest(BaseModel):
53
62
  r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
54
63
  random_seed: OptionalNullable[int] = UNSET
55
64
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
56
- suffix: OptionalNullable[str] = UNSET
57
- r"""Optional text/code that adds more context for the model. When given a `prompt` and a `suffix` the model will fill what is between them. When `suffix` is not provided, the model will simply execute completion starting with `prompt`."""
65
+ response_format: Optional[ResponseFormat] = None
66
+ tools: OptionalNullable[List[Tool]] = UNSET
67
+ tool_choice: Optional[AgentsCompletionStreamRequestToolChoice] = "auto"
58
68
 
59
69
  @model_serializer(mode="wrap")
60
70
  def serialize_model(self, handler):
61
- optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "suffix"]
62
- nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
71
+ optional_fields = ["max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice"]
72
+ nullable_fields = ["max_tokens", "min_tokens", "random_seed", "tools"]
63
73
  null_default_fields = []
64
74
 
65
75
  serialized = handler(self)
@@ -82,11 +92,3 @@ class AgentsCompletionStreamRequest(BaseModel):
82
92
 
83
93
  return m
84
94
 
85
-
86
- AgentsCompletionStreamRequestStopTypedDict = Union[str, List[str]]
87
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
88
-
89
-
90
- AgentsCompletionStreamRequestStop = Union[str, List[str]]
91
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
92
-