You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create your account on [La Plateforme](https://console.mistral.ai) to get access and read the [docs](https://docs.mistral.ai) to learn how to use it.
26
+
<!-- End Summary [summary] -->
27
+
28
+
<!-- Start Table of Contents [toc] -->
29
+
## Table of Contents
30
+
31
+
*[SDK Installation](#sdk-installation)
32
+
*[IDE Support](#ide-support)
33
+
*[SDK Example Usage](#sdk-example-usage)
34
+
*[Available Resources and Operations](#available-resources-and-operations)
The SDK can be installed with either *pip* or *poetry* package managers.
49
+
50
+
### PIP
51
+
52
+
*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
53
+
26
54
```bash
27
55
pip install mistralai
28
56
```
29
57
30
-
Poetry
58
+
### Poetry
59
+
60
+
*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
61
+
31
62
```bash
32
63
poetry add mistralai
33
64
```
@@ -49,7 +80,6 @@ s = Mistral(
49
80
api_key=os.getenv("MISTRAL_API_KEY", ""),
50
81
)
51
82
52
-
53
83
res = s.chat.complete(model="mistral-small-latest", messages=[
54
84
{
55
85
"content": "Who is the best French painter? Answer in one short sentence.",
@@ -101,10 +131,9 @@ s = Mistral(
101
131
api_key=os.getenv("MISTRAL_API_KEY", ""),
102
132
)
103
133
104
-
105
134
res = s.files.upload(file={
106
-
"file_name": "your_file_here",
107
-
"content": open("<file_path>", "rb"),
135
+
"file_name": "example.file",
136
+
"content": open("example.file", "rb"),
108
137
})
109
138
110
139
if res isnotNone:
@@ -126,8 +155,8 @@ async def main():
126
155
api_key=os.getenv("MISTRAL_API_KEY", ""),
127
156
)
128
157
res =await s.files.upload_async(file={
129
-
"file_name": "your_file_here",
130
-
"content": open("<file_path>", "rb"),
158
+
"file_name": "example.file",
159
+
"content": open("example.file", "rb"),
131
160
})
132
161
if res isnotNone:
133
162
# handle response
@@ -149,11 +178,9 @@ s = Mistral(
149
178
api_key=os.getenv("MISTRAL_API_KEY", ""),
150
179
)
151
180
152
-
153
181
res = s.agents.complete(messages=[
154
182
{
155
-
"content": "Who is the best French painter? Answer in one short sentence.",
156
-
"role": "user",
183
+
"content": "<value>",
157
184
},
158
185
], agent_id="<value>")
159
186
@@ -287,14 +314,22 @@ The documentation for the GCP SDK is available [here](packages/mistralai_gcp/REA
287
314
<!-- Start Available Resources and Operations [operations] -->
288
315
## Available Resources and Operations
289
316
290
-
### [models](docs/sdks/models/README.md)
317
+
<detailsopen>
318
+
<summary>Available methods</summary>
291
319
292
-
*[list](docs/sdks/models/README.md#list) - List Models
293
-
*[retrieve](docs/sdks/models/README.md#retrieve) - Retrieve Model
294
-
*[delete](docs/sdks/models/README.md#delete) - Delete Model
295
-
*[update](docs/sdks/models/README.md#update) - Update Fine Tuned Model
296
-
*[archive](docs/sdks/models/README.md#archive) - Archive Fine Tuned Model
297
-
*[unarchive](docs/sdks/models/README.md#unarchive) - Unarchive Fine Tuned Model
0 commit comments