mistralai 0.4.2__py3-none-any.whl → 0.5.5a50__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/__init__.py +5 -0
- mistralai/_hooks/__init__.py +5 -0
- mistralai/_hooks/custom_user_agent.py +16 -0
- mistralai/_hooks/deprecation_warning.py +26 -0
- mistralai/_hooks/registration.py +17 -0
- mistralai/_hooks/sdkhooks.py +57 -0
- mistralai/_hooks/types.py +76 -0
- mistralai/async_client.py +5 -413
- mistralai/basesdk.py +216 -0
- mistralai/chat.py +475 -0
- mistralai/client.py +5 -414
- mistralai/embeddings.py +182 -0
- mistralai/files.py +600 -84
- mistralai/fim.py +439 -0
- mistralai/fine_tuning.py +855 -0
- mistralai/httpclient.py +78 -0
- mistralai/models/__init__.py +80 -0
- mistralai/models/archiveftmodelout.py +19 -0
- mistralai/models/assistantmessage.py +58 -0
- mistralai/models/chatcompletionchoice.py +33 -0
- mistralai/models/chatcompletionrequest.py +114 -0
- mistralai/models/chatcompletionresponse.py +27 -0
- mistralai/models/chatcompletionstreamrequest.py +112 -0
- mistralai/models/checkpointout.py +25 -0
- mistralai/models/completionchunk.py +27 -0
- mistralai/models/completionevent.py +15 -0
- mistralai/models/completionresponsestreamchoice.py +53 -0
- mistralai/models/contentchunk.py +17 -0
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +16 -0
- mistralai/models/deletefileout.py +24 -0
- mistralai/models/deletemodelout.py +25 -0
- mistralai/models/deltamessage.py +52 -0
- mistralai/models/detailedjobout.py +96 -0
- mistralai/models/embeddingrequest.py +66 -0
- mistralai/models/embeddingresponse.py +24 -0
- mistralai/models/embeddingresponsedata.py +19 -0
- mistralai/models/eventout.py +55 -0
- mistralai/models/files_api_routes_delete_fileop.py +16 -0
- mistralai/models/files_api_routes_retrieve_fileop.py +16 -0
- mistralai/models/files_api_routes_upload_fileop.py +51 -0
- mistralai/models/fileschema.py +76 -0
- mistralai/models/fimcompletionrequest.py +99 -0
- mistralai/models/fimcompletionresponse.py +27 -0
- mistralai/models/fimcompletionstreamrequest.py +97 -0
- mistralai/models/finetuneablemodel.py +8 -0
- mistralai/models/ftmodelcapabilitiesout.py +21 -0
- mistralai/models/ftmodelout.py +70 -0
- mistralai/models/function.py +19 -0
- mistralai/models/functioncall.py +16 -0
- mistralai/models/githubrepositoryin.py +57 -0
- mistralai/models/githubrepositoryout.py +57 -0
- mistralai/models/httpvalidationerror.py +23 -0
- mistralai/models/jobin.py +78 -0
- mistralai/models/jobmetadataout.py +59 -0
- mistralai/models/jobout.py +112 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_cancel_fine_tuning_jobop.py +18 -0
- mistralai/models/jobs_api_routes_fine_tuning_create_fine_tuning_jobop.py +73 -0
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobop.py +18 -0
- mistralai/models/jobs_api_routes_fine_tuning_get_fine_tuning_jobsop.py +86 -0
- mistralai/models/jobs_api_routes_fine_tuning_start_fine_tuning_jobop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop.py +16 -0
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +19 -0
- mistralai/models/jobsout.py +20 -0
- mistralai/models/legacyjobmetadataout.py +85 -0
- mistralai/models/listfilesout.py +17 -0
- mistralai/models/metricout.py +55 -0
- mistralai/models/modelcapabilities.py +21 -0
- mistralai/models/modelcard.py +71 -0
- mistralai/models/modellist.py +18 -0
- mistralai/models/responseformat.py +18 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +16 -0
- mistralai/models/retrievefileout.py +76 -0
- mistralai/models/sampletype.py +7 -0
- mistralai/models/sdkerror.py +22 -0
- mistralai/models/security.py +16 -0
- mistralai/models/source.py +7 -0
- mistralai/models/systemmessage.py +26 -0
- mistralai/models/textchunk.py +17 -0
- mistralai/models/tool.py +18 -0
- mistralai/models/toolcall.py +20 -0
- mistralai/models/toolmessage.py +55 -0
- mistralai/models/trainingfile.py +17 -0
- mistralai/models/trainingparameters.py +53 -0
- mistralai/models/trainingparametersin.py +61 -0
- mistralai/models/unarchiveftmodelout.py +19 -0
- mistralai/models/updateftmodelin.py +49 -0
- mistralai/models/uploadfileout.py +76 -0
- mistralai/models/usageinfo.py +18 -0
- mistralai/models/usermessage.py +26 -0
- mistralai/models/validationerror.py +24 -0
- mistralai/models/wandbintegration.py +61 -0
- mistralai/models/wandbintegrationout.py +57 -0
- mistralai/models_.py +928 -0
- mistralai/py.typed +1 -0
- mistralai/sdk.py +111 -0
- mistralai/sdkconfiguration.py +53 -0
- mistralai/types/__init__.py +21 -0
- mistralai/types/basemodel.py +35 -0
- mistralai/utils/__init__.py +82 -0
- mistralai/utils/annotations.py +19 -0
- mistralai/utils/enums.py +34 -0
- mistralai/utils/eventstreaming.py +179 -0
- mistralai/utils/forms.py +207 -0
- mistralai/utils/headers.py +136 -0
- mistralai/utils/metadata.py +118 -0
- mistralai/utils/queryparams.py +203 -0
- mistralai/utils/requestbodies.py +66 -0
- mistralai/utils/retries.py +216 -0
- mistralai/utils/security.py +182 -0
- mistralai/utils/serializers.py +181 -0
- mistralai/utils/url.py +150 -0
- mistralai/utils/values.py +128 -0
- {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/LICENSE +1 -1
- mistralai-0.5.5a50.dist-info/METADATA +626 -0
- mistralai-0.5.5a50.dist-info/RECORD +228 -0
- mistralai_azure/__init__.py +5 -0
- mistralai_azure/_hooks/__init__.py +5 -0
- mistralai_azure/_hooks/custom_user_agent.py +16 -0
- mistralai_azure/_hooks/registration.py +15 -0
- mistralai_azure/_hooks/sdkhooks.py +57 -0
- mistralai_azure/_hooks/types.py +76 -0
- mistralai_azure/basesdk.py +215 -0
- mistralai_azure/chat.py +475 -0
- mistralai_azure/httpclient.py +78 -0
- mistralai_azure/models/__init__.py +28 -0
- mistralai_azure/models/assistantmessage.py +58 -0
- mistralai_azure/models/chatcompletionchoice.py +33 -0
- mistralai_azure/models/chatcompletionrequest.py +114 -0
- mistralai_azure/models/chatcompletionresponse.py +27 -0
- mistralai_azure/models/chatcompletionstreamrequest.py +112 -0
- mistralai_azure/models/completionchunk.py +27 -0
- mistralai_azure/models/completionevent.py +15 -0
- mistralai_azure/models/completionresponsestreamchoice.py +53 -0
- mistralai_azure/models/contentchunk.py +17 -0
- mistralai_azure/models/deltamessage.py +52 -0
- mistralai_azure/models/function.py +19 -0
- mistralai_azure/models/functioncall.py +16 -0
- mistralai_azure/models/httpvalidationerror.py +23 -0
- mistralai_azure/models/responseformat.py +18 -0
- mistralai_azure/models/sdkerror.py +22 -0
- mistralai_azure/models/security.py +16 -0
- mistralai_azure/models/systemmessage.py +26 -0
- mistralai_azure/models/textchunk.py +17 -0
- mistralai_azure/models/tool.py +18 -0
- mistralai_azure/models/toolcall.py +20 -0
- mistralai_azure/models/toolmessage.py +55 -0
- mistralai_azure/models/usageinfo.py +18 -0
- mistralai_azure/models/usermessage.py +26 -0
- mistralai_azure/models/validationerror.py +24 -0
- mistralai_azure/py.typed +1 -0
- mistralai_azure/sdk.py +102 -0
- mistralai_azure/sdkconfiguration.py +53 -0
- mistralai_azure/types/__init__.py +21 -0
- mistralai_azure/types/basemodel.py +35 -0
- mistralai_azure/utils/__init__.py +80 -0
- mistralai_azure/utils/annotations.py +19 -0
- mistralai_azure/utils/enums.py +34 -0
- mistralai_azure/utils/eventstreaming.py +179 -0
- mistralai_azure/utils/forms.py +207 -0
- mistralai_azure/utils/headers.py +136 -0
- mistralai_azure/utils/metadata.py +118 -0
- mistralai_azure/utils/queryparams.py +203 -0
- mistralai_azure/utils/requestbodies.py +66 -0
- mistralai_azure/utils/retries.py +216 -0
- mistralai_azure/utils/security.py +168 -0
- mistralai_azure/utils/serializers.py +181 -0
- mistralai_azure/utils/url.py +150 -0
- mistralai_azure/utils/values.py +128 -0
- mistralai_gcp/__init__.py +5 -0
- mistralai_gcp/_hooks/__init__.py +5 -0
- mistralai_gcp/_hooks/custom_user_agent.py +16 -0
- mistralai_gcp/_hooks/registration.py +15 -0
- mistralai_gcp/_hooks/sdkhooks.py +57 -0
- mistralai_gcp/_hooks/types.py +76 -0
- mistralai_gcp/basesdk.py +215 -0
- mistralai_gcp/chat.py +463 -0
- mistralai_gcp/fim.py +439 -0
- mistralai_gcp/httpclient.py +78 -0
- mistralai_gcp/models/__init__.py +31 -0
- mistralai_gcp/models/assistantmessage.py +58 -0
- mistralai_gcp/models/chatcompletionchoice.py +33 -0
- mistralai_gcp/models/chatcompletionrequest.py +110 -0
- mistralai_gcp/models/chatcompletionresponse.py +27 -0
- mistralai_gcp/models/chatcompletionstreamrequest.py +108 -0
- mistralai_gcp/models/completionchunk.py +27 -0
- mistralai_gcp/models/completionevent.py +15 -0
- mistralai_gcp/models/completionresponsestreamchoice.py +53 -0
- mistralai_gcp/models/contentchunk.py +17 -0
- mistralai_gcp/models/deltamessage.py +52 -0
- mistralai_gcp/models/fimcompletionrequest.py +99 -0
- mistralai_gcp/models/fimcompletionresponse.py +27 -0
- mistralai_gcp/models/fimcompletionstreamrequest.py +97 -0
- mistralai_gcp/models/function.py +19 -0
- mistralai_gcp/models/functioncall.py +16 -0
- mistralai_gcp/models/httpvalidationerror.py +23 -0
- mistralai_gcp/models/responseformat.py +18 -0
- mistralai_gcp/models/sdkerror.py +22 -0
- mistralai_gcp/models/security.py +16 -0
- mistralai_gcp/models/systemmessage.py +26 -0
- mistralai_gcp/models/textchunk.py +17 -0
- mistralai_gcp/models/tool.py +18 -0
- mistralai_gcp/models/toolcall.py +20 -0
- mistralai_gcp/models/toolmessage.py +55 -0
- mistralai_gcp/models/usageinfo.py +18 -0
- mistralai_gcp/models/usermessage.py +26 -0
- mistralai_gcp/models/validationerror.py +24 -0
- mistralai_gcp/py.typed +1 -0
- mistralai_gcp/sdk.py +165 -0
- mistralai_gcp/sdkconfiguration.py +53 -0
- mistralai_gcp/types/__init__.py +21 -0
- mistralai_gcp/types/basemodel.py +35 -0
- mistralai_gcp/utils/__init__.py +80 -0
- mistralai_gcp/utils/annotations.py +19 -0
- mistralai_gcp/utils/enums.py +34 -0
- mistralai_gcp/utils/eventstreaming.py +179 -0
- mistralai_gcp/utils/forms.py +207 -0
- mistralai_gcp/utils/headers.py +136 -0
- mistralai_gcp/utils/metadata.py +118 -0
- mistralai_gcp/utils/queryparams.py +203 -0
- mistralai_gcp/utils/requestbodies.py +66 -0
- mistralai_gcp/utils/retries.py +216 -0
- mistralai_gcp/utils/security.py +168 -0
- mistralai_gcp/utils/serializers.py +181 -0
- mistralai_gcp/utils/url.py +150 -0
- mistralai_gcp/utils/values.py +128 -0
- py.typed +1 -0
- mistralai/client_base.py +0 -211
- mistralai/constants.py +0 -5
- mistralai/exceptions.py +0 -54
- mistralai/jobs.py +0 -172
- mistralai/models/chat_completion.py +0 -93
- mistralai/models/common.py +0 -9
- mistralai/models/embeddings.py +0 -19
- mistralai/models/files.py +0 -23
- mistralai/models/jobs.py +0 -100
- mistralai/models/models.py +0 -39
- mistralai-0.4.2.dist-info/METADATA +0 -82
- mistralai-0.4.2.dist-info/RECORD +0 -20
- {mistralai-0.4.2.dist-info → mistralai-0.5.5a50.dist-info}/WHEEL +0 -0
mistralai/httpclient.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
# pyright: reportReturnType = false
|
|
4
|
+
from typing_extensions import Protocol, runtime_checkable
|
|
5
|
+
import httpx
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@runtime_checkable
|
|
10
|
+
class HttpClient(Protocol):
|
|
11
|
+
def send(
|
|
12
|
+
self,
|
|
13
|
+
request: httpx.Request,
|
|
14
|
+
*,
|
|
15
|
+
stream: bool = False,
|
|
16
|
+
auth: Union[
|
|
17
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
18
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
19
|
+
follow_redirects: Union[
|
|
20
|
+
bool, httpx._client.UseClientDefault
|
|
21
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
22
|
+
) -> httpx.Response:
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
def build_request(
|
|
26
|
+
self,
|
|
27
|
+
method: str,
|
|
28
|
+
url: httpx._types.URLTypes,
|
|
29
|
+
*,
|
|
30
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
31
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
32
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
33
|
+
json: Optional[Any] = None,
|
|
34
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
35
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
36
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
37
|
+
timeout: Union[
|
|
38
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
39
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
40
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
41
|
+
) -> httpx.Request:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@runtime_checkable
|
|
46
|
+
class AsyncHttpClient(Protocol):
|
|
47
|
+
async def send(
|
|
48
|
+
self,
|
|
49
|
+
request: httpx.Request,
|
|
50
|
+
*,
|
|
51
|
+
stream: bool = False,
|
|
52
|
+
auth: Union[
|
|
53
|
+
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
|
|
54
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
55
|
+
follow_redirects: Union[
|
|
56
|
+
bool, httpx._client.UseClientDefault
|
|
57
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
58
|
+
) -> httpx.Response:
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
def build_request(
|
|
62
|
+
self,
|
|
63
|
+
method: str,
|
|
64
|
+
url: httpx._types.URLTypes,
|
|
65
|
+
*,
|
|
66
|
+
content: Optional[httpx._types.RequestContent] = None,
|
|
67
|
+
data: Optional[httpx._types.RequestData] = None,
|
|
68
|
+
files: Optional[httpx._types.RequestFiles] = None,
|
|
69
|
+
json: Optional[Any] = None,
|
|
70
|
+
params: Optional[httpx._types.QueryParamTypes] = None,
|
|
71
|
+
headers: Optional[httpx._types.HeaderTypes] = None,
|
|
72
|
+
cookies: Optional[httpx._types.CookieTypes] = None,
|
|
73
|
+
timeout: Union[
|
|
74
|
+
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
|
|
75
|
+
] = httpx.USE_CLIENT_DEFAULT,
|
|
76
|
+
extensions: Optional[httpx._types.RequestExtensions] = None,
|
|
77
|
+
) -> httpx.Request:
|
|
78
|
+
pass
|
mistralai/models/__init__.py
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .archiveftmodelout import ArchiveFTModelOut, ArchiveFTModelOutTypedDict
|
|
4
|
+
from .assistantmessage import AssistantMessage, AssistantMessageRole, AssistantMessageTypedDict
|
|
5
|
+
from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict, FinishReason, Message, MessageTypedDict
|
|
6
|
+
from .chatcompletionrequest import ChatCompletionRequest, ChatCompletionRequestTypedDict, Messages, MessagesTypedDict, Stop, StopTypedDict, ToolChoice
|
|
7
|
+
from .chatcompletionresponse import ChatCompletionResponse, ChatCompletionResponseTypedDict
|
|
8
|
+
from .chatcompletionstreamrequest import ChatCompletionStreamRequest, ChatCompletionStreamRequestMessages, ChatCompletionStreamRequestMessagesTypedDict, ChatCompletionStreamRequestStop, ChatCompletionStreamRequestStopTypedDict, ChatCompletionStreamRequestToolChoice, ChatCompletionStreamRequestTypedDict
|
|
9
|
+
from .checkpointout import CheckpointOut, CheckpointOutTypedDict
|
|
10
|
+
from .completionchunk import CompletionChunk, CompletionChunkTypedDict
|
|
11
|
+
from .completionevent import CompletionEvent, CompletionEventTypedDict
|
|
12
|
+
from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceFinishReason, CompletionResponseStreamChoiceTypedDict
|
|
13
|
+
from .contentchunk import ContentChunk, ContentChunkTypedDict
|
|
14
|
+
from .delete_model_v1_models_model_id_deleteop import DeleteModelV1ModelsModelIDDeleteRequest, DeleteModelV1ModelsModelIDDeleteRequestTypedDict
|
|
15
|
+
from .deletefileout import DeleteFileOut, DeleteFileOutTypedDict
|
|
16
|
+
from .deletemodelout import DeleteModelOut, DeleteModelOutTypedDict
|
|
17
|
+
from .deltamessage import DeltaMessage, DeltaMessageTypedDict
|
|
18
|
+
from .detailedjobout import DetailedJobOut, DetailedJobOutStatus, DetailedJobOutTypedDict
|
|
19
|
+
from .embeddingrequest import EmbeddingRequest, EmbeddingRequestTypedDict, Inputs, InputsTypedDict
|
|
20
|
+
from .embeddingresponse import EmbeddingResponse, EmbeddingResponseTypedDict
|
|
21
|
+
from .embeddingresponsedata import EmbeddingResponseData, EmbeddingResponseDataTypedDict
|
|
22
|
+
from .eventout import EventOut, EventOutTypedDict
|
|
23
|
+
from .files_api_routes_delete_fileop import FilesAPIRoutesDeleteFileRequest, FilesAPIRoutesDeleteFileRequestTypedDict
|
|
24
|
+
from .files_api_routes_retrieve_fileop import FilesAPIRoutesRetrieveFileRequest, FilesAPIRoutesRetrieveFileRequestTypedDict
|
|
25
|
+
from .files_api_routes_upload_fileop import File, FileTypedDict, FilesAPIRoutesUploadFileMultiPartBodyParams, FilesAPIRoutesUploadFileMultiPartBodyParamsTypedDict
|
|
26
|
+
from .fileschema import FileSchema, FileSchemaTypedDict
|
|
27
|
+
from .fimcompletionrequest import FIMCompletionRequest, FIMCompletionRequestStop, FIMCompletionRequestStopTypedDict, FIMCompletionRequestTypedDict
|
|
28
|
+
from .fimcompletionresponse import FIMCompletionResponse, FIMCompletionResponseTypedDict
|
|
29
|
+
from .fimcompletionstreamrequest import FIMCompletionStreamRequest, FIMCompletionStreamRequestStop, FIMCompletionStreamRequestStopTypedDict, FIMCompletionStreamRequestTypedDict
|
|
30
|
+
from .finetuneablemodel import FineTuneableModel
|
|
31
|
+
from .ftmodelcapabilitiesout import FTModelCapabilitiesOut, FTModelCapabilitiesOutTypedDict
|
|
32
|
+
from .ftmodelout import FTModelOut, FTModelOutTypedDict
|
|
33
|
+
from .function import Function, FunctionTypedDict
|
|
34
|
+
from .functioncall import FunctionCall, FunctionCallTypedDict
|
|
35
|
+
from .githubrepositoryin import GithubRepositoryIn, GithubRepositoryInTypedDict
|
|
36
|
+
from .githubrepositoryout import GithubRepositoryOut, GithubRepositoryOutTypedDict
|
|
37
|
+
from .httpvalidationerror import HTTPValidationError, HTTPValidationErrorData
|
|
38
|
+
from .jobin import JobIn, JobInTypedDict
|
|
39
|
+
from .jobmetadataout import JobMetadataOut, JobMetadataOutTypedDict
|
|
40
|
+
from .jobout import JobOut, JobOutTypedDict, Status
|
|
41
|
+
from .jobs_api_routes_fine_tuning_archive_fine_tuned_modelop import JobsAPIRoutesFineTuningArchiveFineTunedModelRequest, JobsAPIRoutesFineTuningArchiveFineTunedModelRequestTypedDict
|
|
42
|
+
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
|
|
44
|
+
from .jobs_api_routes_fine_tuning_get_fine_tuning_jobop import JobsAPIRoutesFineTuningGetFineTuningJobRequest, JobsAPIRoutesFineTuningGetFineTuningJobRequestTypedDict
|
|
45
|
+
from .jobs_api_routes_fine_tuning_get_fine_tuning_jobsop import JobsAPIRoutesFineTuningGetFineTuningJobsRequest, JobsAPIRoutesFineTuningGetFineTuningJobsRequestTypedDict, QueryParamStatus
|
|
46
|
+
from .jobs_api_routes_fine_tuning_start_fine_tuning_jobop import JobsAPIRoutesFineTuningStartFineTuningJobRequest, JobsAPIRoutesFineTuningStartFineTuningJobRequestTypedDict
|
|
47
|
+
from .jobs_api_routes_fine_tuning_unarchive_fine_tuned_modelop import JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequest, JobsAPIRoutesFineTuningUnarchiveFineTunedModelRequestTypedDict
|
|
48
|
+
from .jobs_api_routes_fine_tuning_update_fine_tuned_modelop import JobsAPIRoutesFineTuningUpdateFineTunedModelRequest, JobsAPIRoutesFineTuningUpdateFineTunedModelRequestTypedDict
|
|
49
|
+
from .jobsout import JobsOut, JobsOutTypedDict
|
|
50
|
+
from .legacyjobmetadataout import LegacyJobMetadataOut, LegacyJobMetadataOutTypedDict
|
|
51
|
+
from .listfilesout import ListFilesOut, ListFilesOutTypedDict
|
|
52
|
+
from .metricout import MetricOut, MetricOutTypedDict
|
|
53
|
+
from .modelcapabilities import ModelCapabilities, ModelCapabilitiesTypedDict
|
|
54
|
+
from .modelcard import ModelCard, ModelCardTypedDict
|
|
55
|
+
from .modellist import ModelList, ModelListTypedDict
|
|
56
|
+
from .responseformat import ResponseFormat, ResponseFormatTypedDict, ResponseFormats
|
|
57
|
+
from .retrieve_model_v1_models_model_id_getop import RetrieveModelV1ModelsModelIDGetRequest, RetrieveModelV1ModelsModelIDGetRequestTypedDict
|
|
58
|
+
from .retrievefileout import RetrieveFileOut, RetrieveFileOutTypedDict
|
|
59
|
+
from .sampletype import SampleType
|
|
60
|
+
from .sdkerror import SDKError
|
|
61
|
+
from .security import Security, SecurityTypedDict
|
|
62
|
+
from .source import Source
|
|
63
|
+
from .systemmessage import Content, ContentTypedDict, Role, SystemMessage, SystemMessageTypedDict
|
|
64
|
+
from .textchunk import TextChunk, TextChunkTypedDict
|
|
65
|
+
from .tool import Tool, ToolTypedDict
|
|
66
|
+
from .toolcall import ToolCall, ToolCallTypedDict
|
|
67
|
+
from .toolmessage import ToolMessage, ToolMessageRole, ToolMessageTypedDict
|
|
68
|
+
from .trainingfile import TrainingFile, TrainingFileTypedDict
|
|
69
|
+
from .trainingparameters import TrainingParameters, TrainingParametersTypedDict
|
|
70
|
+
from .trainingparametersin import TrainingParametersIn, TrainingParametersInTypedDict
|
|
71
|
+
from .unarchiveftmodelout import UnarchiveFTModelOut, UnarchiveFTModelOutTypedDict
|
|
72
|
+
from .updateftmodelin import UpdateFTModelIn, UpdateFTModelInTypedDict
|
|
73
|
+
from .uploadfileout import UploadFileOut, UploadFileOutTypedDict
|
|
74
|
+
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
75
|
+
from .usermessage import UserMessage, UserMessageContent, UserMessageContentTypedDict, UserMessageRole, UserMessageTypedDict
|
|
76
|
+
from .validationerror import Loc, LocTypedDict, ValidationError, ValidationErrorTypedDict
|
|
77
|
+
from .wandbintegration import WandbIntegration, WandbIntegrationTypedDict
|
|
78
|
+
from .wandbintegrationout import WandbIntegrationOut, WandbIntegrationOutTypedDict
|
|
79
|
+
|
|
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"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from mistralai.types import BaseModel
|
|
5
|
+
import pydantic
|
|
6
|
+
from typing import Final, Optional, TypedDict
|
|
7
|
+
from typing_extensions import Annotated, NotRequired
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ArchiveFTModelOutTypedDict(TypedDict):
|
|
11
|
+
id: str
|
|
12
|
+
archived: NotRequired[bool]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ArchiveFTModelOut(BaseModel):
|
|
16
|
+
id: str
|
|
17
|
+
OBJECT: Annotated[Final[Optional[str]], pydantic.Field(alias="object")] = "model" # type: ignore
|
|
18
|
+
archived: Optional[bool] = True
|
|
19
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .toolcall import ToolCall, ToolCallTypedDict
|
|
5
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
6
|
+
from pydantic import model_serializer
|
|
7
|
+
from typing import List, Literal, Optional, TypedDict
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
AssistantMessageRole = Literal["assistant"]
|
|
12
|
+
|
|
13
|
+
class AssistantMessageTypedDict(TypedDict):
|
|
14
|
+
content: NotRequired[Nullable[str]]
|
|
15
|
+
tool_calls: NotRequired[Nullable[List[ToolCallTypedDict]]]
|
|
16
|
+
prefix: NotRequired[bool]
|
|
17
|
+
r"""Set this to `true` when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message."""
|
|
18
|
+
role: NotRequired[AssistantMessageRole]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AssistantMessage(BaseModel):
|
|
22
|
+
content: OptionalNullable[str] = UNSET
|
|
23
|
+
tool_calls: OptionalNullable[List[ToolCall]] = UNSET
|
|
24
|
+
prefix: Optional[bool] = False
|
|
25
|
+
r"""Set this to `true` when adding an assistant message as prefix to condition the model response. The role of the prefix message is to force the model to start its answer by the content of the message."""
|
|
26
|
+
role: Optional[AssistantMessageRole] = "assistant"
|
|
27
|
+
|
|
28
|
+
@model_serializer(mode="wrap")
|
|
29
|
+
def serialize_model(self, handler):
|
|
30
|
+
optional_fields = ["content", "tool_calls", "prefix", "role"]
|
|
31
|
+
nullable_fields = ["content", "tool_calls"]
|
|
32
|
+
null_default_fields = []
|
|
33
|
+
|
|
34
|
+
serialized = handler(self)
|
|
35
|
+
|
|
36
|
+
m = {}
|
|
37
|
+
|
|
38
|
+
for n, f in self.model_fields.items():
|
|
39
|
+
k = f.alias or n
|
|
40
|
+
val = serialized.get(k)
|
|
41
|
+
|
|
42
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
43
|
+
m[k] = val
|
|
44
|
+
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
|
+
)
|
|
54
|
+
):
|
|
55
|
+
m[k] = val
|
|
56
|
+
|
|
57
|
+
return m
|
|
58
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
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 .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
6
|
+
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
7
|
+
from .usermessage import UserMessage, UserMessageTypedDict
|
|
8
|
+
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
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
FinishReason = Literal["stop", "length", "model_length", "error", "tool_calls"]
|
|
16
|
+
|
|
17
|
+
class ChatCompletionChoiceTypedDict(TypedDict):
|
|
18
|
+
index: int
|
|
19
|
+
finish_reason: FinishReason
|
|
20
|
+
message: NotRequired[MessageTypedDict]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ChatCompletionChoice(BaseModel):
|
|
24
|
+
index: int
|
|
25
|
+
finish_reason: FinishReason
|
|
26
|
+
message: Optional[Message] = None
|
|
27
|
+
|
|
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
|
+
|
|
@@ -0,0 +1,114 @@
|
|
|
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 .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
7
|
+
from .tool import Tool, ToolTypedDict
|
|
8
|
+
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
9
|
+
from .usermessage import UserMessage, UserMessageTypedDict
|
|
10
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
11
|
+
from mistralai.utils import get_discriminator
|
|
12
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
13
|
+
from typing import List, Literal, Optional, TypedDict, Union
|
|
14
|
+
from typing_extensions import Annotated, NotRequired
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
ToolChoice = Literal["auto", "none", "any"]
|
|
18
|
+
|
|
19
|
+
class ChatCompletionRequestTypedDict(TypedDict):
|
|
20
|
+
messages: List[MessagesTypedDict]
|
|
21
|
+
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
|
+
temperature: NotRequired[float]
|
|
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
|
+
top_p: NotRequired[float]
|
|
27
|
+
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."""
|
|
28
|
+
max_tokens: NotRequired[Nullable[int]]
|
|
29
|
+
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."""
|
|
30
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
31
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
32
|
+
stream: NotRequired[bool]
|
|
33
|
+
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."""
|
|
34
|
+
stop: NotRequired[StopTypedDict]
|
|
35
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
36
|
+
random_seed: NotRequired[Nullable[int]]
|
|
37
|
+
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
38
|
+
response_format: NotRequired[ResponseFormatTypedDict]
|
|
39
|
+
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
40
|
+
safe_prompt: NotRequired[bool]
|
|
41
|
+
r"""Whether to inject a safety prompt before all conversations."""
|
|
42
|
+
tool_choice: NotRequired[ToolChoice]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class ChatCompletionRequest(BaseModel):
|
|
46
|
+
messages: List[Messages]
|
|
47
|
+
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
|
+
temperature: Optional[float] = 0.7
|
|
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
|
+
top_p: Optional[float] = 1
|
|
53
|
+
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."""
|
|
54
|
+
max_tokens: OptionalNullable[int] = UNSET
|
|
55
|
+
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."""
|
|
56
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
57
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
58
|
+
stream: Optional[bool] = False
|
|
59
|
+
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."""
|
|
60
|
+
stop: Optional[Stop] = 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
|
+
response_format: Optional[ResponseFormat] = None
|
|
65
|
+
tools: OptionalNullable[List[Tool]] = UNSET
|
|
66
|
+
safe_prompt: Optional[bool] = False
|
|
67
|
+
r"""Whether to inject a safety prompt before all conversations."""
|
|
68
|
+
tool_choice: Optional[ToolChoice] = "auto"
|
|
69
|
+
|
|
70
|
+
@model_serializer(mode="wrap")
|
|
71
|
+
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"]
|
|
73
|
+
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
|
|
74
|
+
null_default_fields = []
|
|
75
|
+
|
|
76
|
+
serialized = handler(self)
|
|
77
|
+
|
|
78
|
+
m = {}
|
|
79
|
+
|
|
80
|
+
for n, f in self.model_fields.items():
|
|
81
|
+
k = f.alias or n
|
|
82
|
+
val = serialized.get(k)
|
|
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
|
|
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
|
+
)
|
|
96
|
+
):
|
|
97
|
+
m[k] = val
|
|
98
|
+
|
|
99
|
+
return m
|
|
100
|
+
|
|
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
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .chatcompletionchoice import ChatCompletionChoice, ChatCompletionChoiceTypedDict
|
|
5
|
+
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from typing import List, Optional, TypedDict
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ChatCompletionResponseTypedDict(TypedDict):
|
|
12
|
+
id: str
|
|
13
|
+
object: str
|
|
14
|
+
model: str
|
|
15
|
+
usage: UsageInfoTypedDict
|
|
16
|
+
created: NotRequired[int]
|
|
17
|
+
choices: NotRequired[List[ChatCompletionChoiceTypedDict]]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ChatCompletionResponse(BaseModel):
|
|
21
|
+
id: str
|
|
22
|
+
object: str
|
|
23
|
+
model: str
|
|
24
|
+
usage: UsageInfo
|
|
25
|
+
created: Optional[int] = None
|
|
26
|
+
choices: Optional[List[ChatCompletionChoice]] = None
|
|
27
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
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 .systemmessage import SystemMessage, SystemMessageTypedDict
|
|
7
|
+
from .tool import Tool, ToolTypedDict
|
|
8
|
+
from .toolmessage import ToolMessage, ToolMessageTypedDict
|
|
9
|
+
from .usermessage import UserMessage, UserMessageTypedDict
|
|
10
|
+
from mistralai.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
|
|
11
|
+
from mistralai.utils import get_discriminator
|
|
12
|
+
from pydantic import Discriminator, Tag, model_serializer
|
|
13
|
+
from typing import List, Literal, Optional, TypedDict, Union
|
|
14
|
+
from typing_extensions import Annotated, NotRequired
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
ChatCompletionStreamRequestToolChoice = Literal["auto", "none", "any"]
|
|
18
|
+
|
|
19
|
+
class ChatCompletionStreamRequestTypedDict(TypedDict):
|
|
20
|
+
messages: List[ChatCompletionStreamRequestMessagesTypedDict]
|
|
21
|
+
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
|
+
temperature: NotRequired[float]
|
|
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
|
+
top_p: NotRequired[float]
|
|
27
|
+
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."""
|
|
28
|
+
max_tokens: NotRequired[Nullable[int]]
|
|
29
|
+
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."""
|
|
30
|
+
min_tokens: NotRequired[Nullable[int]]
|
|
31
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
32
|
+
stream: NotRequired[bool]
|
|
33
|
+
stop: NotRequired[ChatCompletionStreamRequestStopTypedDict]
|
|
34
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
35
|
+
random_seed: NotRequired[Nullable[int]]
|
|
36
|
+
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
37
|
+
response_format: NotRequired[ResponseFormatTypedDict]
|
|
38
|
+
tools: NotRequired[Nullable[List[ToolTypedDict]]]
|
|
39
|
+
safe_prompt: NotRequired[bool]
|
|
40
|
+
r"""Whether to inject a safety prompt before all conversations."""
|
|
41
|
+
tool_choice: NotRequired[ChatCompletionStreamRequestToolChoice]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ChatCompletionStreamRequest(BaseModel):
|
|
45
|
+
messages: List[ChatCompletionStreamRequestMessages]
|
|
46
|
+
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
|
+
temperature: Optional[float] = 0.7
|
|
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
|
+
top_p: Optional[float] = 1
|
|
52
|
+
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."""
|
|
53
|
+
max_tokens: OptionalNullable[int] = UNSET
|
|
54
|
+
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."""
|
|
55
|
+
min_tokens: OptionalNullable[int] = UNSET
|
|
56
|
+
r"""The minimum number of tokens to generate in the completion."""
|
|
57
|
+
stream: Optional[bool] = True
|
|
58
|
+
stop: Optional[ChatCompletionStreamRequestStop] = None
|
|
59
|
+
r"""Stop generation if this token is detected. Or if one of these tokens is detected when providing an array"""
|
|
60
|
+
random_seed: OptionalNullable[int] = UNSET
|
|
61
|
+
r"""The seed to use for random sampling. If set, different calls will generate deterministic results."""
|
|
62
|
+
response_format: Optional[ResponseFormat] = None
|
|
63
|
+
tools: OptionalNullable[List[Tool]] = UNSET
|
|
64
|
+
safe_prompt: Optional[bool] = False
|
|
65
|
+
r"""Whether to inject a safety prompt before all conversations."""
|
|
66
|
+
tool_choice: Optional[ChatCompletionStreamRequestToolChoice] = "auto"
|
|
67
|
+
|
|
68
|
+
@model_serializer(mode="wrap")
|
|
69
|
+
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"]
|
|
71
|
+
nullable_fields = ["model", "max_tokens", "min_tokens", "random_seed", "tools"]
|
|
72
|
+
null_default_fields = []
|
|
73
|
+
|
|
74
|
+
serialized = handler(self)
|
|
75
|
+
|
|
76
|
+
m = {}
|
|
77
|
+
|
|
78
|
+
for n, f in self.model_fields.items():
|
|
79
|
+
k = f.alias or n
|
|
80
|
+
val = serialized.get(k)
|
|
81
|
+
|
|
82
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
83
|
+
m[k] = val
|
|
84
|
+
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
|
+
)
|
|
94
|
+
):
|
|
95
|
+
m[k] = val
|
|
96
|
+
|
|
97
|
+
return m
|
|
98
|
+
|
|
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
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .metricout import MetricOut, MetricOutTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CheckpointOutTypedDict(TypedDict):
|
|
10
|
+
metrics: MetricOutTypedDict
|
|
11
|
+
r"""Metrics at the step number during the fine-tuning job. Use these metrics to assess if the training is going smoothly (loss should decrease, token accuracy should increase)."""
|
|
12
|
+
step_number: int
|
|
13
|
+
r"""The step number that the checkpoint was created at."""
|
|
14
|
+
created_at: int
|
|
15
|
+
r"""The UNIX timestamp (in seconds) for when the checkpoint was created."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CheckpointOut(BaseModel):
|
|
19
|
+
metrics: MetricOut
|
|
20
|
+
r"""Metrics at the step number during the fine-tuning job. Use these metrics to assess if the training is going smoothly (loss should decrease, token accuracy should increase)."""
|
|
21
|
+
step_number: int
|
|
22
|
+
r"""The step number that the checkpoint was created at."""
|
|
23
|
+
created_at: int
|
|
24
|
+
r"""The UNIX timestamp (in seconds) for when the checkpoint was created."""
|
|
25
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .completionresponsestreamchoice import CompletionResponseStreamChoice, CompletionResponseStreamChoiceTypedDict
|
|
5
|
+
from .usageinfo import UsageInfo, UsageInfoTypedDict
|
|
6
|
+
from mistralai.types import BaseModel
|
|
7
|
+
from typing import List, Optional, TypedDict
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CompletionChunkTypedDict(TypedDict):
|
|
12
|
+
id: str
|
|
13
|
+
model: str
|
|
14
|
+
choices: List[CompletionResponseStreamChoiceTypedDict]
|
|
15
|
+
object: NotRequired[str]
|
|
16
|
+
created: NotRequired[int]
|
|
17
|
+
usage: NotRequired[UsageInfoTypedDict]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CompletionChunk(BaseModel):
|
|
21
|
+
id: str
|
|
22
|
+
model: str
|
|
23
|
+
choices: List[CompletionResponseStreamChoice]
|
|
24
|
+
object: Optional[str] = None
|
|
25
|
+
created: Optional[int] = None
|
|
26
|
+
usage: Optional[UsageInfo] = None
|
|
27
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .completionchunk import CompletionChunk, CompletionChunkTypedDict
|
|
5
|
+
from mistralai.types import BaseModel
|
|
6
|
+
from typing import TypedDict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class CompletionEventTypedDict(TypedDict):
|
|
10
|
+
data: CompletionChunkTypedDict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CompletionEvent(BaseModel):
|
|
14
|
+
data: CompletionChunk
|
|
15
|
+
|