mistralai 0.4.2__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/agents.py +434 -0
- mistralai/async_client.py +5 -413
- mistralai/basesdk.py +253 -0
- mistralai/chat.py +470 -0
- mistralai/client.py +5 -414
- mistralai/embeddings.py +182 -0
- mistralai/files.py +600 -84
- mistralai/fim.py +438 -0
- mistralai/fine_tuning.py +16 -0
- mistralai/httpclient.py +78 -0
- mistralai/jobs.py +822 -150
- mistralai/models/__init__.py +82 -0
- mistralai/models/agentscompletionrequest.py +96 -0
- mistralai/models/agentscompletionstreamrequest.py +92 -0
- mistralai/models/archiveftmodelout.py +19 -0
- mistralai/models/assistantmessage.py +53 -0
- mistralai/models/chatcompletionchoice.py +22 -0
- mistralai/models/chatcompletionrequest.py +109 -0
- mistralai/models/chatcompletionresponse.py +27 -0
- mistralai/models/chatcompletionstreamrequest.py +107 -0
- mistralai/models/checkpointout.py +25 -0
- mistralai/models/completionchunk.py +27 -0
- mistralai/models/completionevent.py +15 -0
- mistralai/models/completionresponsestreamchoice.py +48 -0
- mistralai/models/contentchunk.py +17 -0
- mistralai/models/delete_model_v1_models_model_id_deleteop.py +18 -0
- mistralai/models/deletefileout.py +24 -0
- mistralai/models/deletemodelout.py +25 -0
- mistralai/models/deltamessage.py +47 -0
- mistralai/models/detailedjobout.py +91 -0
- mistralai/models/embeddingrequest.py +61 -0
- mistralai/models/embeddingresponse.py +24 -0
- mistralai/models/embeddingresponsedata.py +19 -0
- mistralai/models/eventout.py +50 -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 +71 -0
- mistralai/models/fimcompletionrequest.py +94 -0
- mistralai/models/fimcompletionresponse.py +27 -0
- mistralai/models/fimcompletionstreamrequest.py +92 -0
- mistralai/models/finetuneablemodel.py +8 -0
- mistralai/models/ftmodelcapabilitiesout.py +21 -0
- mistralai/models/ftmodelout.py +65 -0
- mistralai/models/function.py +19 -0
- mistralai/models/functioncall.py +22 -0
- mistralai/models/githubrepositoryin.py +52 -0
- mistralai/models/githubrepositoryout.py +52 -0
- mistralai/models/httpvalidationerror.py +23 -0
- mistralai/models/jobin.py +73 -0
- mistralai/models/jobmetadataout.py +54 -0
- mistralai/models/jobout.py +107 -0
- mistralai/models/jobs_api_routes_fine_tuning_archive_fine_tuned_modelop.py +18 -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 +15 -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 +81 -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 +18 -0
- mistralai/models/jobs_api_routes_fine_tuning_update_fine_tuned_modelop.py +21 -0
- mistralai/models/jobsout.py +20 -0
- mistralai/models/legacyjobmetadataout.py +80 -0
- mistralai/models/listfilesout.py +17 -0
- mistralai/models/metricout.py +50 -0
- mistralai/models/modelcapabilities.py +21 -0
- mistralai/models/modelcard.py +66 -0
- mistralai/models/modellist.py +18 -0
- mistralai/models/responseformat.py +18 -0
- mistralai/models/retrieve_model_v1_models_model_id_getop.py +18 -0
- mistralai/models/retrievefileout.py +71 -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 +50 -0
- mistralai/models/trainingfile.py +17 -0
- mistralai/models/trainingparameters.py +48 -0
- mistralai/models/trainingparametersin.py +56 -0
- mistralai/models/unarchiveftmodelout.py +19 -0
- mistralai/models/updateftmodelin.py +44 -0
- mistralai/models/uploadfileout.py +71 -0
- mistralai/models/usageinfo.py +18 -0
- mistralai/models/usermessage.py +26 -0
- mistralai/models/validationerror.py +24 -0
- mistralai/models/wandbintegration.py +56 -0
- mistralai/models/wandbintegrationout.py +52 -0
- mistralai/models_.py +928 -0
- mistralai/py.typed +1 -0
- mistralai/sdk.py +119 -0
- mistralai/sdkconfiguration.py +54 -0
- mistralai/types/__init__.py +21 -0
- mistralai/types/basemodel.py +39 -0
- mistralai/utils/__init__.py +86 -0
- mistralai/utils/annotations.py +19 -0
- mistralai/utils/enums.py +34 -0
- mistralai/utils/eventstreaming.py +178 -0
- mistralai/utils/forms.py +207 -0
- mistralai/utils/headers.py +136 -0
- mistralai/utils/logger.py +16 -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 +185 -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-1.0.0.dist-info}/LICENSE +1 -1
- mistralai-1.0.0.dist-info/METADATA +695 -0
- mistralai-1.0.0.dist-info/RECORD +235 -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 +253 -0
- mistralai_azure/chat.py +470 -0
- mistralai_azure/httpclient.py +78 -0
- mistralai_azure/models/__init__.py +28 -0
- mistralai_azure/models/assistantmessage.py +53 -0
- mistralai_azure/models/chatcompletionchoice.py +22 -0
- mistralai_azure/models/chatcompletionrequest.py +109 -0
- mistralai_azure/models/chatcompletionresponse.py +27 -0
- mistralai_azure/models/chatcompletionstreamrequest.py +107 -0
- mistralai_azure/models/completionchunk.py +27 -0
- mistralai_azure/models/completionevent.py +15 -0
- mistralai_azure/models/completionresponsestreamchoice.py +48 -0
- mistralai_azure/models/contentchunk.py +17 -0
- mistralai_azure/models/deltamessage.py +47 -0
- mistralai_azure/models/function.py +19 -0
- mistralai_azure/models/functioncall.py +22 -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 +50 -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 +107 -0
- mistralai_azure/sdkconfiguration.py +54 -0
- mistralai_azure/types/__init__.py +21 -0
- mistralai_azure/types/basemodel.py +39 -0
- mistralai_azure/utils/__init__.py +84 -0
- mistralai_azure/utils/annotations.py +19 -0
- mistralai_azure/utils/enums.py +34 -0
- mistralai_azure/utils/eventstreaming.py +178 -0
- mistralai_azure/utils/forms.py +207 -0
- mistralai_azure/utils/headers.py +136 -0
- mistralai_azure/utils/logger.py +16 -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 +253 -0
- mistralai_gcp/chat.py +458 -0
- mistralai_gcp/fim.py +438 -0
- mistralai_gcp/httpclient.py +78 -0
- mistralai_gcp/models/__init__.py +31 -0
- mistralai_gcp/models/assistantmessage.py +53 -0
- mistralai_gcp/models/chatcompletionchoice.py +22 -0
- mistralai_gcp/models/chatcompletionrequest.py +105 -0
- mistralai_gcp/models/chatcompletionresponse.py +27 -0
- mistralai_gcp/models/chatcompletionstreamrequest.py +103 -0
- mistralai_gcp/models/completionchunk.py +27 -0
- mistralai_gcp/models/completionevent.py +15 -0
- mistralai_gcp/models/completionresponsestreamchoice.py +48 -0
- mistralai_gcp/models/contentchunk.py +17 -0
- mistralai_gcp/models/deltamessage.py +47 -0
- mistralai_gcp/models/fimcompletionrequest.py +94 -0
- mistralai_gcp/models/fimcompletionresponse.py +27 -0
- mistralai_gcp/models/fimcompletionstreamrequest.py +92 -0
- mistralai_gcp/models/function.py +19 -0
- mistralai_gcp/models/functioncall.py +22 -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 +50 -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 +174 -0
- mistralai_gcp/sdkconfiguration.py +54 -0
- mistralai_gcp/types/__init__.py +21 -0
- mistralai_gcp/types/basemodel.py +39 -0
- mistralai_gcp/utils/__init__.py +84 -0
- mistralai_gcp/utils/annotations.py +19 -0
- mistralai_gcp/utils/enums.py +34 -0
- mistralai_gcp/utils/eventstreaming.py +178 -0
- mistralai_gcp/utils/forms.py +207 -0
- mistralai_gcp/utils/headers.py +136 -0
- mistralai_gcp/utils/logger.py +16 -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/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-1.0.0.dist-info}/WHEEL +0 -0
mistralai/exceptions.py
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Any, Dict, Optional
|
|
4
|
-
|
|
5
|
-
from httpx import Response
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class MistralException(Exception):
|
|
9
|
-
"""Base Exception class, returned when nothing more specific applies"""
|
|
10
|
-
|
|
11
|
-
def __init__(self, message: Optional[str] = None) -> None:
|
|
12
|
-
super(MistralException, self).__init__(message)
|
|
13
|
-
|
|
14
|
-
self.message = message
|
|
15
|
-
|
|
16
|
-
def __str__(self) -> str:
|
|
17
|
-
msg = self.message or "<empty message>"
|
|
18
|
-
return msg
|
|
19
|
-
|
|
20
|
-
def __repr__(self) -> str:
|
|
21
|
-
return f"{self.__class__.__name__}(message={str(self)})"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class MistralAPIException(MistralException):
|
|
25
|
-
"""Returned when the API responds with an error message"""
|
|
26
|
-
|
|
27
|
-
def __init__(
|
|
28
|
-
self,
|
|
29
|
-
message: Optional[str] = None,
|
|
30
|
-
http_status: Optional[int] = None,
|
|
31
|
-
headers: Optional[Dict[str, Any]] = None,
|
|
32
|
-
) -> None:
|
|
33
|
-
super().__init__(message)
|
|
34
|
-
self.http_status = http_status
|
|
35
|
-
self.headers = headers or {}
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def from_response(cls, response: Response, message: Optional[str] = None) -> MistralAPIException:
|
|
39
|
-
return cls(
|
|
40
|
-
message=message or response.text,
|
|
41
|
-
http_status=response.status_code,
|
|
42
|
-
headers=dict(response.headers),
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
def __repr__(self) -> str:
|
|
46
|
-
return f"{self.__class__.__name__}(message={str(self)}, http_status={self.http_status})"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class MistralAPIStatusException(MistralAPIException):
|
|
50
|
-
"""Returned when we receive a non-200 response from the API that we should retry"""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class MistralConnectionException(MistralException):
|
|
54
|
-
"""Returned when the SDK can not reach the API server for any reason"""
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
from typing import List, Optional
|
|
3
|
-
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
|
|
6
|
-
from mistralai.models.common import UsageInfo
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Function(BaseModel):
|
|
10
|
-
name: str
|
|
11
|
-
description: str
|
|
12
|
-
parameters: dict
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ToolType(str, Enum):
|
|
16
|
-
function = "function"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class FunctionCall(BaseModel):
|
|
20
|
-
name: str
|
|
21
|
-
arguments: str
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class ToolCall(BaseModel):
|
|
25
|
-
id: str = "null"
|
|
26
|
-
type: ToolType = ToolType.function
|
|
27
|
-
function: FunctionCall
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class ResponseFormats(str, Enum):
|
|
31
|
-
text: str = "text"
|
|
32
|
-
json_object: str = "json_object"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class ToolChoice(str, Enum):
|
|
36
|
-
auto: str = "auto"
|
|
37
|
-
any: str = "any"
|
|
38
|
-
none: str = "none"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class ResponseFormat(BaseModel):
|
|
42
|
-
type: ResponseFormats = ResponseFormats.text
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class ChatMessage(BaseModel):
|
|
46
|
-
role: str
|
|
47
|
-
content: str
|
|
48
|
-
name: Optional[str] = None
|
|
49
|
-
tool_calls: Optional[List[ToolCall]] = None
|
|
50
|
-
tool_call_id: Optional[str] = None
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class DeltaMessage(BaseModel):
|
|
54
|
-
role: Optional[str] = None
|
|
55
|
-
content: Optional[str] = None
|
|
56
|
-
tool_calls: Optional[List[ToolCall]] = None
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class FinishReason(str, Enum):
|
|
60
|
-
stop = "stop"
|
|
61
|
-
length = "length"
|
|
62
|
-
error = "error"
|
|
63
|
-
tool_calls = "tool_calls"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
class ChatCompletionResponseStreamChoice(BaseModel):
|
|
67
|
-
index: int
|
|
68
|
-
delta: DeltaMessage
|
|
69
|
-
finish_reason: Optional[FinishReason]
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class ChatCompletionStreamResponse(BaseModel):
|
|
73
|
-
id: str
|
|
74
|
-
model: str
|
|
75
|
-
choices: List[ChatCompletionResponseStreamChoice]
|
|
76
|
-
created: Optional[int] = None
|
|
77
|
-
object: Optional[str] = None
|
|
78
|
-
usage: Optional[UsageInfo] = None
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
class ChatCompletionResponseChoice(BaseModel):
|
|
82
|
-
index: int
|
|
83
|
-
message: ChatMessage
|
|
84
|
-
finish_reason: Optional[FinishReason]
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class ChatCompletionResponse(BaseModel):
|
|
88
|
-
id: str
|
|
89
|
-
object: str
|
|
90
|
-
created: int
|
|
91
|
-
model: str
|
|
92
|
-
choices: List[ChatCompletionResponseChoice]
|
|
93
|
-
usage: UsageInfo
|
mistralai/models/common.py
DELETED
mistralai/models/embeddings.py
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from mistralai.models.common import UsageInfo
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class EmbeddingObject(BaseModel):
|
|
9
|
-
object: str
|
|
10
|
-
embedding: List[float]
|
|
11
|
-
index: int
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class EmbeddingResponse(BaseModel):
|
|
15
|
-
id: str
|
|
16
|
-
object: str
|
|
17
|
-
data: List[EmbeddingObject]
|
|
18
|
-
model: str
|
|
19
|
-
usage: UsageInfo
|
mistralai/models/files.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from typing import Literal, Optional
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class FileObject(BaseModel):
|
|
7
|
-
id: str
|
|
8
|
-
object: str
|
|
9
|
-
bytes: int
|
|
10
|
-
created_at: int
|
|
11
|
-
filename: str
|
|
12
|
-
purpose: Optional[Literal["fine-tune"]] = "fine-tune"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class FileDeleted(BaseModel):
|
|
16
|
-
id: str
|
|
17
|
-
object: str
|
|
18
|
-
deleted: bool
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class Files(BaseModel):
|
|
22
|
-
data: list[FileObject]
|
|
23
|
-
object: Literal["list"]
|
mistralai/models/jobs.py
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
from typing import Annotated, List, Literal, Optional, Union
|
|
3
|
-
|
|
4
|
-
from pydantic import BaseModel, Field
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class TrainingParameters(BaseModel):
|
|
8
|
-
training_steps: int = Field(1800, le=10000, ge=1)
|
|
9
|
-
learning_rate: float = Field(1.0e-4, le=1, ge=1.0e-8)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class WandbIntegration(BaseModel):
|
|
13
|
-
type: Literal["wandb"] = "wandb"
|
|
14
|
-
project: str
|
|
15
|
-
name: Union[str, None] = None
|
|
16
|
-
run_name: Union[str, None] = None
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class WandbIntegrationIn(WandbIntegration):
|
|
20
|
-
api_key: str
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Integration = Annotated[Union[WandbIntegration], Field(discriminator="type")]
|
|
24
|
-
IntegrationIn = Annotated[Union[WandbIntegrationIn], Field(discriminator="type")]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class JobMetadata(BaseModel):
|
|
28
|
-
object: Literal["job.metadata"] = "job.metadata"
|
|
29
|
-
training_steps: int
|
|
30
|
-
train_tokens_per_step: int
|
|
31
|
-
data_tokens: int
|
|
32
|
-
train_tokens: int
|
|
33
|
-
epochs: float
|
|
34
|
-
expected_duration_seconds: Optional[int]
|
|
35
|
-
cost: Optional[float] = None
|
|
36
|
-
cost_currency: Optional[str] = None
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class Job(BaseModel):
|
|
40
|
-
id: str
|
|
41
|
-
hyperparameters: TrainingParameters
|
|
42
|
-
fine_tuned_model: Union[str, None]
|
|
43
|
-
model: str
|
|
44
|
-
status: Literal[
|
|
45
|
-
"QUEUED",
|
|
46
|
-
"STARTED",
|
|
47
|
-
"RUNNING",
|
|
48
|
-
"FAILED",
|
|
49
|
-
"SUCCESS",
|
|
50
|
-
"CANCELLED",
|
|
51
|
-
"CANCELLATION_REQUESTED",
|
|
52
|
-
]
|
|
53
|
-
job_type: str
|
|
54
|
-
created_at: int
|
|
55
|
-
modified_at: int
|
|
56
|
-
training_files: list[str]
|
|
57
|
-
validation_files: Union[list[str], None] = []
|
|
58
|
-
object: Literal["job"]
|
|
59
|
-
integrations: List[Integration] = []
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class Event(BaseModel):
|
|
63
|
-
name: str
|
|
64
|
-
data: Union[dict, None] = None
|
|
65
|
-
created_at: int
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
class Metric(BaseModel):
|
|
69
|
-
train_loss: Union[float, None] = None
|
|
70
|
-
valid_loss: Union[float, None] = None
|
|
71
|
-
valid_mean_token_accuracy: Union[float, None] = None
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class Checkpoint(BaseModel):
|
|
75
|
-
metrics: Metric
|
|
76
|
-
step_number: int
|
|
77
|
-
created_at: int
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class JobQueryFilter(BaseModel):
|
|
81
|
-
page: int = 0
|
|
82
|
-
page_size: int = 100
|
|
83
|
-
model: Optional[str] = None
|
|
84
|
-
created_after: Optional[datetime] = None
|
|
85
|
-
created_by_me: Optional[bool] = None
|
|
86
|
-
status: Optional[str] = None
|
|
87
|
-
wandb_project: Optional[str] = None
|
|
88
|
-
wandb_name: Optional[str] = None
|
|
89
|
-
suffix: Optional[str] = None
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class DetailedJob(Job):
|
|
93
|
-
events: list[Event] = []
|
|
94
|
-
checkpoints: list[Checkpoint] = []
|
|
95
|
-
estimated_start_time: Optional[int] = None
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
class Jobs(BaseModel):
|
|
99
|
-
data: list[Job] = []
|
|
100
|
-
object: Literal["list"]
|
mistralai/models/models.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ModelPermission(BaseModel):
|
|
7
|
-
id: str
|
|
8
|
-
object: str
|
|
9
|
-
created: int
|
|
10
|
-
allow_create_engine: Optional[bool] = False
|
|
11
|
-
allow_sampling: bool = True
|
|
12
|
-
allow_logprobs: bool = True
|
|
13
|
-
allow_search_indices: Optional[bool] = False
|
|
14
|
-
allow_view: bool = True
|
|
15
|
-
allow_fine_tuning: bool = False
|
|
16
|
-
organization: str = "*"
|
|
17
|
-
group: Optional[str] = None
|
|
18
|
-
is_blocking: Optional[bool] = False
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class ModelCard(BaseModel):
|
|
22
|
-
id: str
|
|
23
|
-
object: str
|
|
24
|
-
created: int
|
|
25
|
-
owned_by: str
|
|
26
|
-
root: Optional[str] = None
|
|
27
|
-
parent: Optional[str] = None
|
|
28
|
-
permission: List[ModelPermission] = []
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class ModelList(BaseModel):
|
|
32
|
-
object: str
|
|
33
|
-
data: List[ModelCard]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class ModelDeleted(BaseModel):
|
|
37
|
-
id: str
|
|
38
|
-
object: str
|
|
39
|
-
deleted: bool
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: mistralai
|
|
3
|
-
Version: 0.4.2
|
|
4
|
-
Summary:
|
|
5
|
-
License: Apache 2.0 License
|
|
6
|
-
Author: Bam4d
|
|
7
|
-
Author-email: bam4d@mistral.ai
|
|
8
|
-
Requires-Python: >=3.9,<4.0
|
|
9
|
-
Classifier: License :: Other/Proprietary License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Requires-Dist: httpx (>=0.25,<1)
|
|
16
|
-
Requires-Dist: orjson (>=3.9.10,<3.11)
|
|
17
|
-
Requires-Dist: pydantic (>=2.5.2,<3)
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
|
-
# Mistral Python Client
|
|
21
|
-
|
|
22
|
-
This client is inspired from [cohere-python](https://github.com/cohere-ai/cohere-python)
|
|
23
|
-
|
|
24
|
-
You can use the Mistral Python client to interact with the Mistral AI API.
|
|
25
|
-
|
|
26
|
-
## Installing
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
pip install mistralai
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### From Source
|
|
33
|
-
|
|
34
|
-
This client uses `poetry` as a dependency and virtual environment manager.
|
|
35
|
-
|
|
36
|
-
You can install poetry with
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pip install poetry
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`poetry` will set up a virtual environment and install dependencies with the following command:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
poetry install
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Run examples
|
|
49
|
-
|
|
50
|
-
You can run the examples in the `examples/` directory using `poetry run` or by entering the virtual environment using `poetry shell`.
|
|
51
|
-
|
|
52
|
-
### API Key Setup
|
|
53
|
-
|
|
54
|
-
Running the examples requires a Mistral AI API key.
|
|
55
|
-
|
|
56
|
-
1. Get your own Mistral API Key: <https://docs.mistral.ai/#api-access>
|
|
57
|
-
2. Set your Mistral API Key as an environment variable. You only need to do this once.
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# set Mistral API Key (using zsh for example)
|
|
61
|
-
$ echo 'export MISTRAL_API_KEY=[your_key_here]' >> ~/.zshenv
|
|
62
|
-
|
|
63
|
-
# reload the environment (or just quit and open a new terminal)
|
|
64
|
-
$ source ~/.zshenv
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Using poetry run
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
cd examples
|
|
71
|
-
poetry run python chat_no_streaming.py
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Using poetry shell
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
poetry shell
|
|
78
|
-
cd examples
|
|
79
|
-
|
|
80
|
-
>> python chat_no_streaming.py
|
|
81
|
-
```
|
|
82
|
-
|
mistralai-0.4.2.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
mistralai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mistralai/async_client.py,sha256=YgS67borTql5f9VcuMxdDbxxc2v5f74peKu9W-ktS_s,17001
|
|
3
|
-
mistralai/client.py,sha256=kumm79_-9ljrUEpHRQEfLr-sRP5r0bwLnySSsVVdk5M,16741
|
|
4
|
-
mistralai/client_base.py,sha256=obzi3F1VBHN9JwSIJPp_hYlryeVHOGxO3-osJVRRelM,7209
|
|
5
|
-
mistralai/constants.py,sha256=AtACPXuky6_0srsDP4AcpeFa2PyH96RSQxPSUM3rORA,154
|
|
6
|
-
mistralai/exceptions.py,sha256=R3pswvZyY5CuSbqhVklgfGPVJoz7T7l2VQKMOXK229A,1652
|
|
7
|
-
mistralai/files.py,sha256=5ZyQaozyOCGE2H2OToMNoNETPi9LIWSACJ4lOrx-DZU,2816
|
|
8
|
-
mistralai/jobs.py,sha256=I1Ko6fS-6l_9RqEtpB_z7p0bw84aJf4CQ_ZrCjoV2lg,6853
|
|
9
|
-
mistralai/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
mistralai/models/chat_completion.py,sha256=Jn8A9SzH7F1rKVjryUKabtYksEeWWegwHretiXujF6E,1859
|
|
11
|
-
mistralai/models/common.py,sha256=zatP4aV_LIEpzj3_igsKkJBICwGhmXG0LX3CdO3kn-o,172
|
|
12
|
-
mistralai/models/embeddings.py,sha256=-VthLQBj6wrq7HXJbGmnkQEEanSemA3MAlaMFh94VBg,331
|
|
13
|
-
mistralai/models/files.py,sha256=74HzLUqrSoGj13TmC0u5sYyE7DUyDPxtL_LSDdKONl8,398
|
|
14
|
-
mistralai/models/jobs.py,sha256=peUAsljxJZfRSFh4vgQ5Scub3a1ma68DpkqCp8qrmks,2413
|
|
15
|
-
mistralai/models/models.py,sha256=q7sZvEYKtaP4x_GGEHE4GUQDsLV_rOt_M_MQkgNems4,823
|
|
16
|
-
mistralai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
mistralai-0.4.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
18
|
-
mistralai-0.4.2.dist-info/METADATA,sha256=HC_8vxzUDo0J6F-Iwmwi5kSP5wWuGFbnsgvxSgPSl-I,1901
|
|
19
|
-
mistralai-0.4.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
20
|
-
mistralai-0.4.2.dist-info/RECORD,,
|
|
File without changes
|