mistralai 1.0.0rc1__py3-none-any.whl → 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. mistralai/agents.py +434 -0
  2. mistralai/basesdk.py +43 -6
  3. mistralai/chat.py +29 -34
  4. mistralai/client.py +1 -1
  5. mistralai/embeddings.py +4 -4
  6. mistralai/files.py +10 -10
  7. mistralai/fim.py +17 -18
  8. mistralai/fine_tuning.py +10 -849
  9. mistralai/jobs.py +844 -0
  10. mistralai/models/__init__.py +6 -4
  11. mistralai/models/agentscompletionrequest.py +96 -0
  12. mistralai/models/agentscompletionstreamrequest.py +92 -0
  13. mistralai/models/assistantmessage.py +4 -9
  14. mistralai/models/chatcompletionchoice.py +4 -15
  15. mistralai/models/chatcompletionrequest.py +25 -30
  16. mistralai/models/chatcompletionstreamrequest.py +25 -30
  17. mistralai/models/completionresponsestreamchoice.py +4 -9
  18. mistralai/models/delete_model_v1_models_model_id_deleteop.py +2 -0
  19. mistralai/models/deltamessage.py +7 -12
  20. mistralai/models/detailedjobout.py +4 -9
  21. mistralai/models/embeddingrequest.py +12 -17
  22. mistralai/models/eventout.py +4 -9
  23. mistralai/models/fileschema.py +4 -9
  24. mistralai/models/fimcompletionrequest.py +19 -24
  25. mistralai/models/fimcompletionstreamrequest.py +19 -24
  26. mistralai/models/ftmodelout.py +4 -9
  27. mistralai/models/functioncall.py +9 -3
  28. mistralai/models/githubrepositoryin.py +4 -9
  29. mistralai/models/githubrepositoryout.py +4 -9
  30. mistralai/models/httpvalidationerror.py +1 -1
  31. mistralai/models/jobin.py +4 -9
  32. mistralai/models/jobmetadataout.py +4 -9
  33. mistralai/models/jobout.py +4 -9
  34. mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +2 -0
  35. mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +1 -59
  36. mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
  37. mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +2 -0
  38. mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +2 -0
  39. mistralai/models/legacyjobmetadataout.py +4 -9
  40. mistralai/models/metricout.py +4 -9
  41. mistralai/models/modelcard.py +4 -9
  42. mistralai/models/retrieve_model_v1_models_model_id_getop.py +2 -0
  43. mistralai/models/retrievefileout.py +4 -9
  44. mistralai/models/security.py +4 -4
  45. mistralai/models/systemmessage.py +6 -6
  46. mistralai/models/toolmessage.py +4 -9
  47. mistralai/models/trainingparameters.py +4 -9
  48. mistralai/models/trainingparametersin.py +4 -9
  49. mistralai/models/updateftmodelin.py +4 -9
  50. mistralai/models/uploadfileout.py +4 -9
  51. mistralai/models/usermessage.py +6 -6
  52. mistralai/models/validationerror.py +6 -6
  53. mistralai/models/wandbintegration.py +4 -9
  54. mistralai/models/wandbintegrationout.py +4 -9
  55. mistralai/models_.py +24 -24
  56. mistralai/sdk.py +14 -6
  57. mistralai/sdkconfiguration.py +5 -4
  58. mistralai/types/basemodel.py +10 -6
  59. mistralai/utils/__init__.py +4 -0
  60. mistralai/utils/eventstreaming.py +8 -9
  61. mistralai/utils/logger.py +16 -0
  62. mistralai/utils/retries.py +2 -2
  63. mistralai/utils/security.py +5 -2
  64. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/METADATA +153 -69
  65. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/RECORD +114 -107
  66. mistralai_azure/basesdk.py +42 -4
  67. mistralai_azure/chat.py +15 -20
  68. mistralai_azure/models/__init__.py +3 -3
  69. mistralai_azure/models/assistantmessage.py +4 -9
  70. mistralai_azure/models/chatcompletionchoice.py +4 -15
  71. mistralai_azure/models/chatcompletionrequest.py +21 -26
  72. mistralai_azure/models/chatcompletionstreamrequest.py +21 -26
  73. mistralai_azure/models/completionresponsestreamchoice.py +4 -9
  74. mistralai_azure/models/deltamessage.py +7 -12
  75. mistralai_azure/models/functioncall.py +9 -3
  76. mistralai_azure/models/httpvalidationerror.py +1 -1
  77. mistralai_azure/models/systemmessage.py +6 -6
  78. mistralai_azure/models/toolmessage.py +4 -9
  79. mistralai_azure/models/usermessage.py +6 -6
  80. mistralai_azure/models/validationerror.py +6 -6
  81. mistralai_azure/sdk.py +7 -2
  82. mistralai_azure/sdkconfiguration.py +5 -4
  83. mistralai_azure/types/basemodel.py +10 -6
  84. mistralai_azure/utils/__init__.py +4 -0
  85. mistralai_azure/utils/eventstreaming.py +8 -9
  86. mistralai_azure/utils/logger.py +16 -0
  87. mistralai_azure/utils/retries.py +2 -2
  88. mistralai_gcp/basesdk.py +42 -4
  89. mistralai_gcp/chat.py +12 -17
  90. mistralai_gcp/fim.py +12 -13
  91. mistralai_gcp/models/__init__.py +3 -3
  92. mistralai_gcp/models/assistantmessage.py +4 -9
  93. mistralai_gcp/models/chatcompletionchoice.py +4 -15
  94. mistralai_gcp/models/chatcompletionrequest.py +23 -28
  95. mistralai_gcp/models/chatcompletionstreamrequest.py +23 -28
  96. mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
  97. mistralai_gcp/models/deltamessage.py +7 -12
  98. mistralai_gcp/models/fimcompletionrequest.py +19 -24
  99. mistralai_gcp/models/fimcompletionstreamrequest.py +19 -24
  100. mistralai_gcp/models/functioncall.py +9 -3
  101. mistralai_gcp/models/httpvalidationerror.py +1 -1
  102. mistralai_gcp/models/systemmessage.py +6 -6
  103. mistralai_gcp/models/toolmessage.py +4 -9
  104. mistralai_gcp/models/usermessage.py +6 -6
  105. mistralai_gcp/models/validationerror.py +6 -6
  106. mistralai_gcp/sdk.py +9 -0
  107. mistralai_gcp/sdkconfiguration.py +5 -4
  108. mistralai_gcp/types/basemodel.py +10 -6
  109. mistralai_gcp/utils/__init__.py +4 -0
  110. mistralai_gcp/utils/eventstreaming.py +8 -9
  111. mistralai_gcp/utils/logger.py +16 -0
  112. mistralai_gcp/utils/retries.py +2 -2
  113. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/LICENSE +0 -0
  114. {mistralai-1.0.0rc1.dist-info → mistralai-1.0.1.dist-info}/WHEEL +0 -0
@@ -1,8 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
+ from .agentscompletionrequest import AgentsCompletionRequest, AgentsCompletionRequestMessages, AgentsCompletionRequestMessagesTypedDict, AgentsCompletionRequestStop, AgentsCompletionRequestStopTypedDict, AgentsCompletionRequestToolChoice, AgentsCompletionRequestTypedDict
4
+ from .agentscompletionstreamrequest import AgentsCompletionStreamRequest, AgentsCompletionStreamRequestStop, AgentsCompletionStreamRequestStopTypedDict, AgentsCompletionStreamRequestTypedDict
3
5
  from .archiveftmodelout import ArchiveFTModelOut, ArchiveFTModelOutTypedDict
4
6
  from .assistantmessage import AssistantMessage, AssistantMessageRole, AssistantMessageTypedDict
5
- from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict, FinishReason, Message, MessageTypedDict
7
+ from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict, FinishReason
6
8
  from .chatcompletionrequest import ChatCompletionRequest, ChatCompletionRequestTypedDict, Messages, MessagesTypedDict, Stop, StopTypedDict, ToolChoice
7
9
  from .chatcompletionresponse import ChatCompletionResponse, ChatCompletionResponseTypedDict
8
10
  from .chatcompletionstreamrequest import ChatCompletionStreamRequest, ChatCompletionStreamRequestMessages, ChatCompletionStreamRequestMessagesTypedDict, ChatCompletionStreamRequestStop, ChatCompletionStreamRequestStopTypedDict, ChatCompletionStreamRequestToolChoice, ChatCompletionStreamRequestTypedDict
@@ -31,7 +33,7 @@ from .finetuneablemodel import FineTuneableModel
31
33
  from .ftmodelcapabilitiesout import FTModelCapabilitiesOut, FTModelCapabilitiesOutTypedDict
32
34
  from .ftmodelout import FTModelOut, FTModelOutTypedDict
33
35
  from .function import Function, FunctionTypedDict
34
- from .functioncall import FunctionCall, FunctionCallTypedDict
36
+ from .functioncall import Arguments, ArgumentsTypedDict, FunctionCall, FunctionCallTypedDict
35
37
  from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
36
38
  from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
37
39
  from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
@@ -40,7 +42,7 @@ from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
40
42
  from .jobout import JobOut, JobOutTypedDict, Status
41
43
  from .jobs_api_routes_fine_tuning_archive_fine_tuned_modelop import JobsAPIRoutesFineTuningArchiveFineTunedModelRequest, JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict
42
44
  from .jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop import JobsAPIRoutesFineTuningCancelFineTuningJobRequest, JobsAPIRoutesFineTuningCancelFineTuningJobRequestTypedDict
43
- 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
44
46
  from .jobs_api_routes_fine_tuning_get_fine_tuning_jobop import JobsAPIRoutesFineTuningGetFineTuningJobRequest, JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict
45
47
  from .jobs_api_routes_fine_tuning_get_fine_tuning_jobsop import JobsAPIRoutesFineTuningGetFineTuningJobsRequest, JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict, QueryParamStatus
46
48
  from .jobs_api_routes_fine_tuning_start_fine_tuning_jobop import JobsAPIRoutesFineTuningStartFineTuningJobRequest, JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict
@@ -77,4 +79,4 @@ from .validationerror import Loc, LocTypedDict, ValidationError, ValidationError
77
79
  from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
78
80
  from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
79
81
 
80
- __all__ = ["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", "Message", "MessageTypedDict", "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", "AgentsCompletionStreamRequestStop", "AgentsCompletionStreamRequestStopTypedDict", "AgentsCompletionStreamRequestTypedDict", "ArchiveFTModelOut", "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", "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", "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"]
@@ -0,0 +1,96 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
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
9
+ from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
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
14
+
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
+
30
+ AgentsCompletionRequestToolChoice = Literal["auto", "none", "any"]
31
+
32
+ class AgentsCompletionRequestTypedDict(TypedDict):
33
+ messages: List[AgentsCompletionRequestMessagesTypedDict]
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."""
37
+ max_tokens: NotRequired[Nullable[int]]
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."""
39
+ min_tokens: NotRequired[Nullable[int]]
40
+ r"""The minimum number of tokens to generate in the completion."""
41
+ stream: NotRequired[bool]
42
+ r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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."""
43
+ stop: NotRequired[AgentsCompletionRequestStopTypedDict]
44
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
45
+ random_seed: NotRequired[Nullable[int]]
46
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
47
+ response_format: NotRequired[ResponseFormatTypedDict]
48
+ tools: NotRequired[Nullable[List[ToolTypedDict]]]
49
+ tool_choice: NotRequired[AgentsCompletionRequestToolChoice]
50
+
51
+
52
+ class AgentsCompletionRequest(BaseModel):
53
+ messages: List[AgentsCompletionRequestMessages]
54
+ r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
55
+ agent_id: str
56
+ r"""The ID of the agent to use for this completion."""
57
+ max_tokens: OptionalNullable[int] = UNSET
58
+ 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."""
59
+ min_tokens: OptionalNullable[int] = UNSET
60
+ r"""The minimum number of tokens to generate in the completion."""
61
+ stream: Optional[bool] = False
62
+ r"""Whether to stream back partial progress. If set, tokens will be sent as data-only server-side 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."""
63
+ stop: Optional[AgentsCompletionRequestStop] = None
64
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
65
+ random_seed: OptionalNullable[int] = UNSET
66
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
67
+ response_format: Optional[ResponseFormat] = None
68
+ tools: OptionalNullable[List[Tool]] = UNSET
69
+ tool_choice: Optional[AgentsCompletionRequestToolChoice] = "auto"
70
+
71
+ @model_serializer(mode="wrap")
72
+ def serialize_model(self, handler):
73
+ optional_fields = ["max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice"]
74
+ nullable_fields = ["max_tokens", "min_tokens", "random_seed", "tools"]
75
+ null_default_fields = []
76
+
77
+ serialized = handler(self)
78
+
79
+ m = {}
80
+
81
+ for n, f in self.model_fields.items():
82
+ k = f.alias or n
83
+ val = serialized.get(k)
84
+
85
+ optional_nullable = k in optional_fields and k in nullable_fields
86
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
87
+
88
+ if val is not None and val != UNSET_SENTINEL:
89
+ m[k] = val
90
+ elif val != UNSET_SENTINEL and (
91
+ not k in optional_fields or (optional_nullable and is_set)
92
+ ):
93
+ m[k] = val
94
+
95
+ return m
96
+
@@ -0,0 +1,92 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ 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
8
+
9
+
10
+ AgentsCompletionStreamRequestStopTypedDict = Union[str, List[str]]
11
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
12
+
13
+
14
+ AgentsCompletionStreamRequestStop = Union[str, List[str]]
15
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
16
+
17
+
18
+ class AgentsCompletionStreamRequestTypedDict(TypedDict):
19
+ model: Nullable[str]
20
+ r"""ID of the model to use. Only compatible for now with:
21
+ - `codestral-2405`
22
+ - `codestral-latest`
23
+ """
24
+ prompt: str
25
+ r"""The text/code to complete."""
26
+ temperature: NotRequired[float]
27
+ 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."""
28
+ top_p: NotRequired[float]
29
+ 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."""
30
+ max_tokens: NotRequired[Nullable[int]]
31
+ 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."""
32
+ min_tokens: NotRequired[Nullable[int]]
33
+ r"""The minimum number of tokens to generate in the completion."""
34
+ stream: NotRequired[bool]
35
+ stop: NotRequired[AgentsCompletionStreamRequestStopTypedDict]
36
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
37
+ random_seed: NotRequired[Nullable[int]]
38
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
39
+ suffix: NotRequired[Nullable[str]]
40
+ 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`."""
41
+
42
+
43
+ class AgentsCompletionStreamRequest(BaseModel):
44
+ model: Nullable[str]
45
+ r"""ID of the model to use. Only compatible for now with:
46
+ - `codestral-2405`
47
+ - `codestral-latest`
48
+ """
49
+ prompt: str
50
+ r"""The text/code to complete."""
51
+ temperature: Optional[float] = 0.7
52
+ 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."""
53
+ top_p: Optional[float] = 1
54
+ 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."""
55
+ max_tokens: OptionalNullable[int] = UNSET
56
+ 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."""
57
+ min_tokens: OptionalNullable[int] = UNSET
58
+ r"""The minimum number of tokens to generate in the completion."""
59
+ stream: Optional[bool] = True
60
+ stop: Optional[AgentsCompletionStreamRequestStop] = None
61
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
62
+ random_seed: OptionalNullable[int] = UNSET
63
+ r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
64
+ suffix: OptionalNullable[str] = UNSET
65
+ 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`."""
66
+
67
+ @model_serializer(mode="wrap")
68
+ def serialize_model(self, handler):
69
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "suffix"]
70
+ nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "suffix"]
71
+ null_default_fields = []
72
+
73
+ serialized = handler(self)
74
+
75
+ m = {}
76
+
77
+ for n, f in self.model_fields.items():
78
+ k = f.alias or n
79
+ val = serialized.get(k)
80
+
81
+ optional_nullable = k in optional_fields and k in nullable_fields
82
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
83
+
84
+ if val is not None and val != UNSET_SENTINEL:
85
+ m[k] = val
86
+ elif val != UNSET_SENTINEL and (
87
+ not k in optional_fields or (optional_nullable and is_set)
88
+ ):
89
+ m[k] = val
90
+
91
+ return m
92
+
@@ -39,18 +39,13 @@ class AssistantMessage(BaseModel):
39
39
  k = f.alias or n
40
40
  val = serialized.get(k)
41
41
 
42
+ optional_nullable = k in optional_fields and k in nullable_fields
43
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
44
+
42
45
  if val is not None and val != UNSET_SENTINEL:
43
46
  m[k] = val
44
47
  elif val != UNSET_SENTINEL and (
45
- not k in optional_fields
46
- or (
47
- k in optional_fields
48
- and k in nullable_fields
49
- and (
50
- self.__pydantic_fields_set__.intersection({n})
51
- or k in null_default_fields
52
- ) # pylint: disable=no-member
53
- )
48
+ not k in optional_fields or (optional_nullable and is_set)
54
49
  ):
55
50
  m[k] = val
56
51
 
@@ -2,14 +2,9 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
5
- from .systemmessage import SystemMessage, SystemMessageTypedDict
6
- from .toolmessage import ToolMessage, ToolMessageTypedDict
7
- from .usermessage import UserMessage, UserMessageTypedDict
8
5
  from mistralai.types import BaseModel
9
- from mistralai.utils import get_discriminator
10
- from pydantic import Discriminator, Tag
11
- from typing import Literal, Optional, TypedDict, Union
12
- from typing_extensions import Annotated, NotRequired
6
+ from typing import Literal, Optional, TypedDict
7
+ from typing_extensions import NotRequired
13
8
 
14
9
 
15
10
  FinishReason = Literal["stop", "length", "model_length", "error", "tool_calls"]
@@ -17,17 +12,11 @@ FinishReason = Literal["stop", "length", "model_length", "error", "tool_calls"]
17
12
  class ChatCompletionChoiceTypedDict(TypedDict):
18
13
  index: int
19
14
  finish_reason: FinishReason
20
- message: NotRequired[MessageTypedDict]
15
+ message: NotRequired[AssistantMessageTypedDict]
21
16
 
22
17
 
23
18
  class ChatCompletionChoice(BaseModel):
24
19
  index: int
25
20
  finish_reason: FinishReason
26
- message: Optional[Message] = None
21
+ message: Optional[AssistantMessage] = None
27
22
 
28
-
29
- MessageTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
30
-
31
-
32
- Message = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
33
-
@@ -14,13 +14,27 @@ from typing import List, Literal, Optional, TypedDict, Union
14
14
  from typing_extensions import Annotated, NotRequired
15
15
 
16
16
 
17
+ StopTypedDict = Union[str, List[str]]
18
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
19
+
20
+
21
+ Stop = Union[str, List[str]]
22
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
23
+
24
+
25
+ MessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
26
+
27
+
28
+ Messages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
29
+
30
+
17
31
  ToolChoice = Literal["auto", "none", "any"]
18
32
 
19
33
  class ChatCompletionRequestTypedDict(TypedDict):
34
+ model: Nullable[str]
35
+ r"""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."""
20
36
  messages: List[MessagesTypedDict]
21
37
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
22
- model: NotRequired[Nullable[str]]
23
- r"""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."""
24
38
  temperature: NotRequired[float]
25
39
  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."""
26
40
  top_p: NotRequired[float]
@@ -37,16 +51,16 @@ class ChatCompletionRequestTypedDict(TypedDict):
37
51
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
38
52
  response_format: NotRequired[ResponseFormatTypedDict]
39
53
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
54
+ tool_choice: NotRequired[ToolChoice]
40
55
  safe_prompt: NotRequired[bool]
41
56
  r"""Whether to inject a safety prompt before all conversations."""
42
- tool_choice: NotRequired[ToolChoice]
43
57
 
44
58
 
45
59
  class ChatCompletionRequest(BaseModel):
60
+ model: Nullable[str]
61
+ r"""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."""
46
62
  messages: List[Messages]
47
63
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
48
- model: OptionalNullable[str] = UNSET
49
- r"""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."""
50
64
  temperature: Optional[float] = 0.7
51
65
  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."""
52
66
  top_p: Optional[float] = 1
@@ -63,13 +77,13 @@ class ChatCompletionRequest(BaseModel):
63
77
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
64
78
  response_format: Optional[ResponseFormat] = None
65
79
  tools: OptionalNullable[List[Tool]] = UNSET
80
+ tool_choice: Optional[ToolChoice] = "auto"
66
81
  safe_prompt: Optional[bool] = False
67
82
  r"""Whether to inject a safety prompt before all conversations."""
68
- tool_choice: Optional[ToolChoice] = "auto"
69
83
 
70
84
  @model_serializer(mode="wrap")
71
85
  def serialize_model(self, handler):
72
- optional_fields = ["model", "temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "safe_prompt", "tool_choice"]
86
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
73
87
  nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
74
88
  null_default_fields = []
75
89
 
@@ -81,34 +95,15 @@ class ChatCompletionRequest(BaseModel):
81
95
  k = f.alias or n
82
96
  val = serialized.get(k)
83
97
 
98
+ optional_nullable = k in optional_fields and k in nullable_fields
99
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
100
+
84
101
  if val is not None and val != UNSET_SENTINEL:
85
102
  m[k] = val
86
103
  elif val != UNSET_SENTINEL and (
87
- not k in optional_fields
88
- or (
89
- k in optional_fields
90
- and k in nullable_fields
91
- and (
92
- self.__pydantic_fields_set__.intersection({n})
93
- or k in null_default_fields
94
- ) # pylint: disable=no-member
95
- )
104
+ not k in optional_fields or (optional_nullable and is_set)
96
105
  ):
97
106
  m[k] = val
98
107
 
99
108
  return m
100
109
 
101
-
102
- StopTypedDict = Union[str, List[str]]
103
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
104
-
105
-
106
- Stop = Union[str, List[str]]
107
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
108
-
109
-
110
- MessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
111
-
112
-
113
- Messages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
114
-
@@ -14,13 +14,27 @@ from typing import List, Literal, Optional, TypedDict, Union
14
14
  from typing_extensions import Annotated, NotRequired
15
15
 
16
16
 
17
+ ChatCompletionStreamRequestStopTypedDict = Union[str, List[str]]
18
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
19
+
20
+
21
+ ChatCompletionStreamRequestStop = Union[str, List[str]]
22
+ r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
23
+
24
+
25
+ ChatCompletionStreamRequestMessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
26
+
27
+
28
+ ChatCompletionStreamRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
29
+
30
+
17
31
  ChatCompletionStreamRequestToolChoice = Literal["auto", "none", "any"]
18
32
 
19
33
  class ChatCompletionStreamRequestTypedDict(TypedDict):
34
+ model: Nullable[str]
35
+ r"""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."""
20
36
  messages: List[ChatCompletionStreamRequestMessagesTypedDict]
21
37
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
22
- model: NotRequired[Nullable[str]]
23
- r"""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."""
24
38
  temperature: NotRequired[float]
25
39
  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."""
26
40
  top_p: NotRequired[float]
@@ -36,16 +50,16 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
36
50
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
37
51
  response_format: NotRequired[ResponseFormatTypedDict]
38
52
  tools: NotRequired[Nullable[List[ToolTypedDict]]]
53
+ tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
39
54
  safe_prompt: NotRequired[bool]
40
55
  r"""Whether to inject a safety prompt before all conversations."""
41
- tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
42
56
 
43
57
 
44
58
  class ChatCompletionStreamRequest(BaseModel):
59
+ model: Nullable[str]
60
+ r"""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."""
45
61
  messages: List[ChatCompletionStreamRequestMessages]
46
62
  r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
47
- model: OptionalNullable[str] = UNSET
48
- r"""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."""
49
63
  temperature: Optional[float] = 0.7
50
64
  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."""
51
65
  top_p: Optional[float] = 1
@@ -61,13 +75,13 @@ class ChatCompletionStreamRequest(BaseModel):
61
75
  r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
62
76
  response_format: Optional[ResponseFormat] = None
63
77
  tools: OptionalNullable[List[Tool]] = UNSET
78
+ tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
64
79
  safe_prompt: Optional[bool] = False
65
80
  r"""Whether to inject a safety prompt before all conversations."""
66
- tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
67
81
 
68
82
  @model_serializer(mode="wrap")
69
83
  def serialize_model(self, handler):
70
- optional_fields = ["model", "temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "safe_prompt", "tool_choice"]
84
+ optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
71
85
  nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
72
86
  null_default_fields = []
73
87
 
@@ -79,34 +93,15 @@ class ChatCompletionStreamRequest(BaseModel):
79
93
  k = f.alias or n
80
94
  val = serialized.get(k)
81
95
 
96
+ optional_nullable = k in optional_fields and k in nullable_fields
97
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
98
+
82
99
  if val is not None and val != UNSET_SENTINEL:
83
100
  m[k] = val
84
101
  elif val != UNSET_SENTINEL and (
85
- not k in optional_fields
86
- or (
87
- k in optional_fields
88
- and k in nullable_fields
89
- and (
90
- self.__pydantic_fields_set__.intersection({n})
91
- or k in null_default_fields
92
- ) # pylint: disable=no-member
93
- )
102
+ not k in optional_fields or (optional_nullable and is_set)
94
103
  ):
95
104
  m[k] = val
96
105
 
97
106
  return m
98
107
 
99
-
100
- ChatCompletionStreamRequestStopTypedDict = Union[str, List[str]]
101
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
102
-
103
-
104
- ChatCompletionStreamRequestStop = Union[str, List[str]]
105
- r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
106
-
107
-
108
- ChatCompletionStreamRequestMessagesTypedDict = Union[SystemMessageTypedDict, UserMessageTypedDict, AssistantMessageTypedDict, ToolMessageTypedDict]
109
-
110
-
111
- ChatCompletionStreamRequestMessages = Annotated[Union[Annotated[AssistantMessage, Tag("assistant")], Annotated[SystemMessage, Tag("system")], Annotated[ToolMessage, Tag("tool")], Annotated[UserMessage, Tag("user")]], Discriminator(lambda m: get_discriminator(m, "role", "role"))]
112
-
@@ -34,18 +34,13 @@ class CompletionResponseStreamChoice(BaseModel):
34
34
  k = f.alias or n
35
35
  val = serialized.get(k)
36
36
 
37
+ optional_nullable = k in optional_fields and k in nullable_fields
38
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
39
+
37
40
  if val is not None and val != UNSET_SENTINEL:
38
41
  m[k] = val
39
42
  elif val != UNSET_SENTINEL and (
40
- not k in optional_fields
41
- or (
42
- k in optional_fields
43
- and k in nullable_fields
44
- and (
45
- self.__pydantic_fields_set__.intersection({n})
46
- or k in null_default_fields
47
- ) # pylint: disable=no-member
48
- )
43
+ not k in optional_fields or (optional_nullable and is_set)
49
44
  ):
50
45
  m[k] = val
51
46
 
@@ -9,8 +9,10 @@ from typing_extensions import Annotated
9
9
 
10
10
  class DeleteModelV1ModelsModelIDDeleteRequestTypedDict(TypedDict):
11
11
  model_id: str
12
+ r"""The ID of the model to delete."""
12
13
 
13
14
 
14
15
  class DeleteModelV1ModelsModelIDDeleteRequest(BaseModel):
15
16
  model_id: Annotated[str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))]
17
+ r"""The ID of the model to delete."""
16
18
 
@@ -4,20 +4,20 @@ from __future__ import annotations
4
4
  from .toolcall import ToolCall, ToolCallTypedDict
5
5
  from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
6
  from pydantic import model_serializer
7
- from typing import Optional, TypedDict
7
+ from typing import List, Optional, TypedDict
8
8
  from typing_extensions import NotRequired
9
9
 
10
10
 
11
11
  class DeltaMessageTypedDict(TypedDict):
12
12
  role: NotRequired[str]
13
13
  content: NotRequired[str]
14
- tool_calls: NotRequired[Nullable[ToolCallTypedDict]]
14
+ tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
15
15
 
16
16
 
17
17
  class DeltaMessage(BaseModel):
18
18
  role: Optional[str] = None
19
19
  content: Optional[str] = None
20
- tool_calls: OptionalNullable[ToolCall] = UNSET
20
+ tool_calls: OptionalNullable[List[ToolCall]] = UNSET
21
21
 
22
22
  @model_serializer(mode="wrap")
23
23
  def serialize_model(self, handler):
@@ -33,18 +33,13 @@ class DeltaMessage(BaseModel):
33
33
  k = f.alias or n
34
34
  val = serialized.get(k)
35
35
 
36
+ optional_nullable = k in optional_fields and k in nullable_fields
37
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
38
+
36
39
  if val is not None and val != UNSET_SENTINEL:
37
40
  m[k] = val
38
41
  elif val != UNSET_SENTINEL and (
39
- not k in optional_fields
40
- or (
41
- k in optional_fields
42
- and k in nullable_fields
43
- and (
44
- self.__pydantic_fields_set__.intersection({n})
45
- or k in null_default_fields
46
- ) # pylint: disable=no-member
47
- )
42
+ not k in optional_fields or (optional_nullable and is_set)
48
43
  ):
49
44
  m[k] = val
50
45
 
@@ -77,18 +77,13 @@ class DetailedJobOut(BaseModel):
77
77
  k = f.alias or n
78
78
  val = serialized.get(k)
79
79
 
80
+ optional_nullable = k in optional_fields and k in nullable_fields
81
+ is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
82
+
80
83
  if val is not None and val != UNSET_SENTINEL:
81
84
  m[k] = val
82
85
  elif val != UNSET_SENTINEL and (
83
- not k in optional_fields
84
- or (
85
- k in optional_fields
86
- and k in nullable_fields
87
- and (
88
- self.__pydantic_fields_set__.intersection({n})
89
- or k in null_default_fields
90
- ) # pylint: disable=no-member
91
- )
86
+ not k in optional_fields or (optional_nullable and is_set)
92
87
  ):
93
88
  m[k] = val
94
89