mistralai 0.5.5a50__py3-none-any.whl → 1.0.0rc2__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.
- mistralai/agents.py +434 -0
- mistralai/basesdk.py +43 -6
- mistralai/chat.py +29 -34
- mistralai/embeddings.py +4 -4
- mistralai/files.py +10 -10
- mistralai/fim.py +17 -18
- mistralai/fine_tuning.py +10 -849
- mistralai/jobs.py +854 -0
- mistralai/models/__init__.py +4 -2
- mistralai/models/agentscompletionrequest.py +96 -0
- mistralai/models/agentscompletionstreamrequest.py +92 -0
- mistralai/models/assistantmessage.py +4 -9
- mistralai/models/chatcompletionchoice.py +4 -15
- mistralai/models/chatcompletionrequest.py +11 -16
- mistralai/models/chatcompletionstreamrequest.py +11 -16
- mistralai/models/completionresponsestreamchoice.py +4 -9
- mistralai/models/deltamessage.py +4 -9
- mistralai/models/detailedjobout.py +4 -9
- mistralai/models/embeddingrequest.py +4 -9
- mistralai/models/eventout.py +4 -9
- mistralai/models/fileschema.py +4 -9
- mistralai/models/fimcompletionrequest.py +11 -16
- mistralai/models/fimcompletionstreamrequest.py +11 -16
- mistralai/models/ftmodelout.py +4 -9
- mistralai/models/githubrepositoryin.py +4 -9
- mistralai/models/githubrepositoryout.py +4 -9
- mistralai/models/httpvalidationerror.py +1 -1
- mistralai/models/jobin.py +4 -9
- mistralai/models/jobmetadataout.py +4 -9
- mistralai/models/jobout.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +4 -9
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +4 -9
- mistralai/models/legacyjobmetadataout.py +4 -9
- mistralai/models/metricout.py +4 -9
- mistralai/models/modelcard.py +4 -9
- mistralai/models/retrievefileout.py +4 -9
- mistralai/models/security.py +4 -4
- mistralai/models/toolmessage.py +4 -9
- mistralai/models/trainingparameters.py +4 -9
- mistralai/models/trainingparametersin.py +4 -9
- mistralai/models/updateftmodelin.py +4 -9
- mistralai/models/uploadfileout.py +4 -9
- mistralai/models/wandbintegration.py +4 -9
- mistralai/models/wandbintegrationout.py +4 -9
- mistralai/models_.py +14 -14
- mistralai/sdk.py +14 -6
- mistralai/sdkconfiguration.py +5 -4
- mistralai/types/basemodel.py +10 -6
- mistralai/utils/__init__.py +4 -0
- mistralai/utils/eventstreaming.py +8 -9
- mistralai/utils/logger.py +16 -0
- mistralai/utils/retries.py +2 -2
- mistralai/utils/security.py +5 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/METADATA +113 -53
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/RECORD +96 -89
- mistralai_azure/basesdk.py +42 -4
- mistralai_azure/chat.py +15 -20
- mistralai_azure/models/__init__.py +2 -2
- mistralai_azure/models/assistantmessage.py +4 -9
- mistralai_azure/models/chatcompletionchoice.py +4 -15
- mistralai_azure/models/chatcompletionrequest.py +7 -12
- mistralai_azure/models/chatcompletionstreamrequest.py +7 -12
- mistralai_azure/models/completionresponsestreamchoice.py +4 -9
- mistralai_azure/models/deltamessage.py +4 -9
- mistralai_azure/models/httpvalidationerror.py +1 -1
- mistralai_azure/models/toolmessage.py +4 -9
- mistralai_azure/sdk.py +7 -2
- mistralai_azure/sdkconfiguration.py +5 -4
- mistralai_azure/types/basemodel.py +10 -6
- mistralai_azure/utils/__init__.py +4 -0
- mistralai_azure/utils/eventstreaming.py +8 -9
- mistralai_azure/utils/logger.py +16 -0
- mistralai_azure/utils/retries.py +2 -2
- mistralai_gcp/basesdk.py +42 -4
- mistralai_gcp/chat.py +12 -17
- mistralai_gcp/fim.py +12 -13
- mistralai_gcp/models/__init__.py +2 -2
- mistralai_gcp/models/assistantmessage.py +4 -9
- mistralai_gcp/models/chatcompletionchoice.py +4 -15
- mistralai_gcp/models/chatcompletionrequest.py +9 -14
- mistralai_gcp/models/chatcompletionstreamrequest.py +9 -14
- mistralai_gcp/models/completionresponsestreamchoice.py +4 -9
- mistralai_gcp/models/deltamessage.py +4 -9
- mistralai_gcp/models/fimcompletionrequest.py +11 -16
- mistralai_gcp/models/fimcompletionstreamrequest.py +11 -16
- mistralai_gcp/models/httpvalidationerror.py +1 -1
- mistralai_gcp/models/toolmessage.py +4 -9
- mistralai_gcp/sdk.py +9 -0
- mistralai_gcp/sdkconfiguration.py +5 -4
- mistralai_gcp/types/basemodel.py +10 -6
- mistralai_gcp/utils/__init__.py +4 -0
- mistralai_gcp/utils/eventstreaming.py +8 -9
- mistralai_gcp/utils/logger.py +16 -0
- mistralai_gcp/utils/retries.py +2 -2
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/LICENSE +0 -0
- {mistralai-0.5.5a50.dist-info → mistralai-1.0.0rc2.dist-info}/WHEEL +0 -0
mistralai/models/__init__.py
CHANGED
|
@@ -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
|
|
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
|
|
@@ -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", "
|
|
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"]
|
|
@@ -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
|
+
AgentsCompletionRequestToolChoice = Literal["auto", "none", "any"]
|
|
17
|
+
|
|
18
|
+
class AgentsCompletionRequestTypedDict(TypedDict):
|
|
19
|
+
messages: List[AgentsCompletionRequestMessagesTypedDict]
|
|
20
|
+
r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
|
|
21
|
+
agent_id: str
|
|
22
|
+
r"""The ID of the agent to use for this completion."""
|
|
23
|
+
max_tokens: NotRequired[Nullable[int]]
|
|
24
|
+
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."""
|
|
25
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
26
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
27
|
+
stream: NotRequired[bool]
|
|
28
|
+
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."""
|
|
29
|
+
stop: NotRequired[AgentsCompletionRequestStopTypedDict]
|
|
30
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
31
|
+
random_seed: NotRequired[Nullable[int]]
|
|
32
|
+
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
33
|
+
response_format: NotRequired[ResponseFormatTypedDict]
|
|
34
|
+
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
35
|
+
tool_choice: NotRequired[AgentsCompletionRequestToolChoice]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class AgentsCompletionRequest(BaseModel):
|
|
39
|
+
messages: List[AgentsCompletionRequestMessages]
|
|
40
|
+
r"""The prompt(s) to generate completions for, encoded as a list of dict with role and content."""
|
|
41
|
+
agent_id: str
|
|
42
|
+
r"""The ID of the agent to use for this completion."""
|
|
43
|
+
max_tokens: OptionalNullable[int] = UNSET
|
|
44
|
+
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."""
|
|
45
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
46
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
47
|
+
stream: Optional[bool] = False
|
|
48
|
+
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."""
|
|
49
|
+
stop: Optional[AgentsCompletionRequestStop] = None
|
|
50
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
51
|
+
random_seed: OptionalNullable[int] = UNSET
|
|
52
|
+
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
53
|
+
response_format: Optional[ResponseFormat] = None
|
|
54
|
+
tools: OptionalNullable[List[Tool]] = UNSET
|
|
55
|
+
tool_choice: Optional[AgentsCompletionRequestToolChoice] = "auto"
|
|
56
|
+
|
|
57
|
+
@model_serializer(mode="wrap")
|
|
58
|
+
def serialize_model(self, handler):
|
|
59
|
+
optional_fields = ["max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice"]
|
|
60
|
+
nullable_fields = ["max_tokens", "min_tokens", "random_seed", "tools"]
|
|
61
|
+
null_default_fields = []
|
|
62
|
+
|
|
63
|
+
serialized = handler(self)
|
|
64
|
+
|
|
65
|
+
m = {}
|
|
66
|
+
|
|
67
|
+
for n, f in self.model_fields.items():
|
|
68
|
+
k = f.alias or n
|
|
69
|
+
val = serialized.get(k)
|
|
70
|
+
|
|
71
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
72
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
73
|
+
|
|
74
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
75
|
+
m[k] = val
|
|
76
|
+
elif val != UNSET_SENTINEL and (
|
|
77
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
78
|
+
):
|
|
79
|
+
m[k] = val
|
|
80
|
+
|
|
81
|
+
return m
|
|
82
|
+
|
|
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
|
+
|
|
@@ -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
|
+
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."""
|
|
22
|
+
max_tokens: NotRequired[Nullable[int]]
|
|
23
|
+
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
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
25
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
26
|
+
stream: NotRequired[bool]
|
|
27
|
+
stop: NotRequired[AgentsCompletionStreamRequestStopTypedDict]
|
|
28
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
29
|
+
random_seed: NotRequired[Nullable[int]]
|
|
30
|
+
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`."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
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."""
|
|
47
|
+
max_tokens: OptionalNullable[int] = UNSET
|
|
48
|
+
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
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
50
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
51
|
+
stream: Optional[bool] = True
|
|
52
|
+
stop: Optional[AgentsCompletionStreamRequestStop] = None
|
|
53
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
54
|
+
random_seed: OptionalNullable[int] = UNSET
|
|
55
|
+
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`."""
|
|
58
|
+
|
|
59
|
+
@model_serializer(mode="wrap")
|
|
60
|
+
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"]
|
|
63
|
+
null_default_fields = []
|
|
64
|
+
|
|
65
|
+
serialized = handler(self)
|
|
66
|
+
|
|
67
|
+
m = {}
|
|
68
|
+
|
|
69
|
+
for n, f in self.model_fields.items():
|
|
70
|
+
k = f.alias or n
|
|
71
|
+
val = serialized.get(k)
|
|
72
|
+
|
|
73
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
74
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
75
|
+
|
|
76
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
77
|
+
m[k] = val
|
|
78
|
+
elif val != UNSET_SENTINEL and (
|
|
79
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
80
|
+
):
|
|
81
|
+
m[k] = val
|
|
82
|
+
|
|
83
|
+
return m
|
|
84
|
+
|
|
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
|
+
|
|
@@ -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
|
|
10
|
-
from
|
|
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[
|
|
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[
|
|
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
|
-
|
|
@@ -17,10 +17,10 @@ from typing_extensions import Annotated, NotRequired
|
|
|
17
17
|
ToolChoice = Literal["auto", "none", "any"]
|
|
18
18
|
|
|
19
19
|
class ChatCompletionRequestTypedDict(TypedDict):
|
|
20
|
+
model: Nullable[str]
|
|
21
|
+
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
22
|
messages: List[MessagesTypedDict]
|
|
21
23
|
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
24
|
temperature: NotRequired[float]
|
|
25
25
|
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
26
|
top_p: NotRequired[float]
|
|
@@ -37,16 +37,16 @@ class ChatCompletionRequestTypedDict(TypedDict):
|
|
|
37
37
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
38
38
|
response_format: NotRequired[ResponseFormatTypedDict]
|
|
39
39
|
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
40
|
+
tool_choice: NotRequired[ToolChoice]
|
|
40
41
|
safe_prompt: NotRequired[bool]
|
|
41
42
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
42
|
-
tool_choice: NotRequired[ToolChoice]
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class ChatCompletionRequest(BaseModel):
|
|
46
|
+
model: Nullable[str]
|
|
47
|
+
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
48
|
messages: List[Messages]
|
|
47
49
|
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
50
|
temperature: Optional[float] = 0.7
|
|
51
51
|
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
52
|
top_p: Optional[float] = 1
|
|
@@ -63,13 +63,13 @@ class ChatCompletionRequest(BaseModel):
|
|
|
63
63
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
64
64
|
response_format: Optional[ResponseFormat] = None
|
|
65
65
|
tools: OptionalNullable[List[Tool]] = UNSET
|
|
66
|
+
tool_choice: Optional[ToolChoice] = "auto"
|
|
66
67
|
safe_prompt: Optional[bool] = False
|
|
67
68
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
68
|
-
tool_choice: Optional[ToolChoice] = "auto"
|
|
69
69
|
|
|
70
70
|
@model_serializer(mode="wrap")
|
|
71
71
|
def serialize_model(self, handler):
|
|
72
|
-
optional_fields = ["
|
|
72
|
+
optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
|
|
73
73
|
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
|
|
74
74
|
null_default_fields = []
|
|
75
75
|
|
|
@@ -81,18 +81,13 @@ class ChatCompletionRequest(BaseModel):
|
|
|
81
81
|
k = f.alias or n
|
|
82
82
|
val = serialized.get(k)
|
|
83
83
|
|
|
84
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
85
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
86
|
+
|
|
84
87
|
if val is not None and val != UNSET_SENTINEL:
|
|
85
88
|
m[k] = val
|
|
86
89
|
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
|
-
)
|
|
90
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
96
91
|
):
|
|
97
92
|
m[k] = val
|
|
98
93
|
|
|
@@ -17,10 +17,10 @@ from typing_extensions import Annotated, NotRequired
|
|
|
17
17
|
ChatCompletionStreamRequestToolChoice = Literal["auto", "none", "any"]
|
|
18
18
|
|
|
19
19
|
class ChatCompletionStreamRequestTypedDict(TypedDict):
|
|
20
|
+
model: Nullable[str]
|
|
21
|
+
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
22
|
messages: List[ChatCompletionStreamRequestMessagesTypedDict]
|
|
21
23
|
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
24
|
temperature: NotRequired[float]
|
|
25
25
|
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
26
|
top_p: NotRequired[float]
|
|
@@ -36,16 +36,16 @@ class ChatCompletionStreamRequestTypedDict(TypedDict):
|
|
|
36
36
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
37
37
|
response_format: NotRequired[ResponseFormatTypedDict]
|
|
38
38
|
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
39
|
+
tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
|
|
39
40
|
safe_prompt: NotRequired[bool]
|
|
40
41
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
41
|
-
tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class ChatCompletionStreamRequest(BaseModel):
|
|
45
|
+
model: Nullable[str]
|
|
46
|
+
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
47
|
messages: List[ChatCompletionStreamRequestMessages]
|
|
46
48
|
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
49
|
temperature: Optional[float] = 0.7
|
|
50
50
|
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
51
|
top_p: Optional[float] = 1
|
|
@@ -61,13 +61,13 @@ class ChatCompletionStreamRequest(BaseModel):
|
|
|
61
61
|
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
62
62
|
response_format: Optional[ResponseFormat] = None
|
|
63
63
|
tools: OptionalNullable[List[Tool]] = UNSET
|
|
64
|
+
tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
|
|
64
65
|
safe_prompt: Optional[bool] = False
|
|
65
66
|
r"""Whether to inject a safety prompt before all conversations."""
|
|
66
|
-
tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
|
|
67
67
|
|
|
68
68
|
@model_serializer(mode="wrap")
|
|
69
69
|
def serialize_model(self, handler):
|
|
70
|
-
optional_fields = ["
|
|
70
|
+
optional_fields = ["temperature", "top_p", "max_tokens", "min_tokens", "stream", "stop", "random_seed", "response_format", "tools", "tool_choice", "safe_prompt"]
|
|
71
71
|
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
|
|
72
72
|
null_default_fields = []
|
|
73
73
|
|
|
@@ -79,18 +79,13 @@ class ChatCompletionStreamRequest(BaseModel):
|
|
|
79
79
|
k = f.alias or n
|
|
80
80
|
val = serialized.get(k)
|
|
81
81
|
|
|
82
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
83
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
84
|
+
|
|
82
85
|
if val is not None and val != UNSET_SENTINEL:
|
|
83
86
|
m[k] = val
|
|
84
87
|
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
|
-
)
|
|
88
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
94
89
|
):
|
|
95
90
|
m[k] = val
|
|
96
91
|
|
|
@@ -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
|
|
mistralai/models/deltamessage.py
CHANGED
|
@@ -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
|
|
|
@@ -39,18 +39,13 @@ class EmbeddingRequest(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
|
|
mistralai/models/eventout.py
CHANGED
|
@@ -36,18 +36,13 @@ class EventOut(BaseModel):
|
|
|
36
36
|
k = f.alias or n
|
|
37
37
|
val = serialized.get(k)
|
|
38
38
|
|
|
39
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
40
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
41
|
+
|
|
39
42
|
if val is not None and val != UNSET_SENTINEL:
|
|
40
43
|
m[k] = val
|
|
41
44
|
elif val != UNSET_SENTINEL and (
|
|
42
|
-
not k in optional_fields
|
|
43
|
-
or (
|
|
44
|
-
k in optional_fields
|
|
45
|
-
and k in nullable_fields
|
|
46
|
-
and (
|
|
47
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
48
|
-
or k in null_default_fields
|
|
49
|
-
) # pylint: disable=no-member
|
|
50
|
-
)
|
|
45
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
51
46
|
):
|
|
52
47
|
m[k] = val
|
|
53
48
|
|
mistralai/models/fileschema.py
CHANGED
|
@@ -57,18 +57,13 @@ class FileSchema(BaseModel):
|
|
|
57
57
|
k = f.alias or n
|
|
58
58
|
val = serialized.get(k)
|
|
59
59
|
|
|
60
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
61
|
+
is_set = (self.__pydantic_fields_set__.intersection({n}) or k in null_default_fields) # pylint: disable=no-member
|
|
62
|
+
|
|
60
63
|
if val is not None and val != UNSET_SENTINEL:
|
|
61
64
|
m[k] = val
|
|
62
65
|
elif val != UNSET_SENTINEL and (
|
|
63
|
-
not k in optional_fields
|
|
64
|
-
or (
|
|
65
|
-
k in optional_fields
|
|
66
|
-
and k in nullable_fields
|
|
67
|
-
and (
|
|
68
|
-
self.__pydantic_fields_set__.intersection({n})
|
|
69
|
-
or k in null_default_fields
|
|
70
|
-
) # pylint: disable=no-member
|
|
71
|
-
)
|
|
66
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
72
67
|
):
|
|
73
68
|
m[k] = val
|
|
74
69
|
|