mistralai 1.9.11__py3-none-any.whl → 1.10.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mistralai/_hooks/registration.py +5 -0
- mistralai/_hooks/tracing.py +75 -0
- mistralai/_version.py +2 -2
- mistralai/accesses.py +8 -8
- mistralai/agents.py +29 -17
- mistralai/chat.py +41 -29
- mistralai/classifiers.py +13 -1
- mistralai/conversations.py +294 -62
- mistralai/documents.py +19 -3
- mistralai/embeddings.py +13 -7
- mistralai/extra/README.md +1 -1
- mistralai/extra/mcp/auth.py +10 -11
- mistralai/extra/mcp/base.py +17 -16
- mistralai/extra/mcp/sse.py +13 -15
- mistralai/extra/mcp/stdio.py +5 -6
- mistralai/extra/observability/__init__.py +15 -0
- mistralai/extra/observability/otel.py +372 -0
- mistralai/extra/run/context.py +33 -43
- mistralai/extra/run/result.py +29 -30
- mistralai/extra/run/tools.py +34 -23
- mistralai/extra/struct_chat.py +15 -8
- mistralai/extra/utils/response_format.py +5 -3
- mistralai/files.py +6 -0
- mistralai/fim.py +17 -5
- mistralai/mistral_agents.py +229 -1
- mistralai/mistral_jobs.py +39 -13
- mistralai/models/__init__.py +99 -3
- mistralai/models/agent.py +15 -2
- mistralai/models/agentconversation.py +11 -3
- mistralai/models/agentcreationrequest.py +6 -2
- mistralai/models/agents_api_v1_agents_deleteop.py +16 -0
- mistralai/models/agents_api_v1_agents_getop.py +40 -3
- mistralai/models/agents_api_v1_agents_listop.py +72 -2
- mistralai/models/agents_api_v1_conversations_deleteop.py +18 -0
- mistralai/models/agents_api_v1_conversations_listop.py +39 -2
- mistralai/models/agentscompletionrequest.py +21 -6
- mistralai/models/agentscompletionstreamrequest.py +21 -6
- mistralai/models/agentupdaterequest.py +18 -2
- mistralai/models/audioencoding.py +13 -0
- mistralai/models/audioformat.py +19 -0
- mistralai/models/audiotranscriptionrequest.py +2 -0
- mistralai/models/batchjobin.py +26 -5
- mistralai/models/batchjobout.py +5 -0
- mistralai/models/batchrequest.py +48 -0
- mistralai/models/chatcompletionrequest.py +22 -5
- mistralai/models/chatcompletionstreamrequest.py +22 -5
- mistralai/models/classificationrequest.py +37 -3
- mistralai/models/conversationrequest.py +15 -4
- mistralai/models/conversationrestartrequest.py +50 -2
- mistralai/models/conversationrestartstreamrequest.py +50 -2
- mistralai/models/conversationstreamrequest.py +15 -4
- mistralai/models/documentout.py +26 -10
- mistralai/models/documentupdatein.py +24 -3
- mistralai/models/embeddingrequest.py +19 -11
- mistralai/models/files_api_routes_list_filesop.py +7 -0
- mistralai/models/fimcompletionrequest.py +8 -9
- mistralai/models/fimcompletionstreamrequest.py +8 -9
- mistralai/models/jobs_api_routes_batch_get_batch_jobop.py +40 -3
- mistralai/models/libraries_documents_list_v1op.py +15 -2
- mistralai/models/libraryout.py +10 -7
- mistralai/models/listfilesout.py +35 -4
- mistralai/models/modelcapabilities.py +13 -4
- mistralai/models/modelconversation.py +8 -2
- mistralai/models/ocrpageobject.py +26 -5
- mistralai/models/ocrrequest.py +17 -1
- mistralai/models/ocrtableobject.py +31 -0
- mistralai/models/prediction.py +4 -0
- mistralai/models/requestsource.py +7 -0
- mistralai/models/responseformat.py +4 -2
- mistralai/models/responseformats.py +0 -1
- mistralai/models/sharingdelete.py +36 -5
- mistralai/models/sharingin.py +36 -5
- mistralai/models/sharingout.py +3 -3
- mistralai/models/toolexecutiondeltaevent.py +13 -4
- mistralai/models/toolexecutiondoneevent.py +13 -4
- mistralai/models/toolexecutionentry.py +9 -4
- mistralai/models/toolexecutionstartedevent.py +13 -4
- mistralai/models/toolfilechunk.py +11 -4
- mistralai/models/toolreferencechunk.py +13 -4
- mistralai/models_.py +2 -14
- mistralai/ocr.py +18 -0
- mistralai/transcriptions.py +4 -4
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/METADATA +162 -152
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/RECORD +168 -144
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/WHEEL +1 -1
- mistralai_azure/_version.py +3 -3
- mistralai_azure/basesdk.py +15 -5
- mistralai_azure/chat.py +59 -98
- mistralai_azure/models/__init__.py +50 -3
- mistralai_azure/models/chatcompletionrequest.py +16 -4
- mistralai_azure/models/chatcompletionstreamrequest.py +16 -4
- mistralai_azure/models/httpvalidationerror.py +11 -6
- mistralai_azure/models/mistralazureerror.py +26 -0
- mistralai_azure/models/no_response_error.py +13 -0
- mistralai_azure/models/prediction.py +4 -0
- mistralai_azure/models/responseformat.py +4 -2
- mistralai_azure/models/responseformats.py +0 -1
- mistralai_azure/models/responsevalidationerror.py +25 -0
- mistralai_azure/models/sdkerror.py +30 -14
- mistralai_azure/models/systemmessage.py +7 -3
- mistralai_azure/models/systemmessagecontentchunks.py +21 -0
- mistralai_azure/models/thinkchunk.py +35 -0
- mistralai_azure/ocr.py +15 -36
- mistralai_azure/utils/__init__.py +18 -5
- mistralai_azure/utils/eventstreaming.py +10 -0
- mistralai_azure/utils/serializers.py +3 -2
- mistralai_azure/utils/unmarshal_json_response.py +24 -0
- mistralai_gcp/_hooks/types.py +7 -0
- mistralai_gcp/_version.py +4 -4
- mistralai_gcp/basesdk.py +27 -25
- mistralai_gcp/chat.py +75 -98
- mistralai_gcp/fim.py +39 -74
- mistralai_gcp/httpclient.py +6 -16
- mistralai_gcp/models/__init__.py +321 -116
- mistralai_gcp/models/assistantmessage.py +1 -1
- mistralai_gcp/models/chatcompletionrequest.py +36 -7
- mistralai_gcp/models/chatcompletionresponse.py +6 -6
- mistralai_gcp/models/chatcompletionstreamrequest.py +36 -7
- mistralai_gcp/models/completionresponsestreamchoice.py +1 -1
- mistralai_gcp/models/deltamessage.py +1 -1
- mistralai_gcp/models/fimcompletionrequest.py +3 -9
- mistralai_gcp/models/fimcompletionresponse.py +6 -6
- mistralai_gcp/models/fimcompletionstreamrequest.py +3 -9
- mistralai_gcp/models/httpvalidationerror.py +11 -6
- mistralai_gcp/models/imageurl.py +1 -1
- mistralai_gcp/models/jsonschema.py +1 -1
- mistralai_gcp/models/mistralgcperror.py +26 -0
- mistralai_gcp/models/mistralpromptmode.py +8 -0
- mistralai_gcp/models/no_response_error.py +13 -0
- mistralai_gcp/models/prediction.py +4 -0
- mistralai_gcp/models/responseformat.py +5 -3
- mistralai_gcp/models/responseformats.py +0 -1
- mistralai_gcp/models/responsevalidationerror.py +25 -0
- mistralai_gcp/models/sdkerror.py +30 -14
- mistralai_gcp/models/systemmessage.py +7 -3
- mistralai_gcp/models/systemmessagecontentchunks.py +21 -0
- mistralai_gcp/models/thinkchunk.py +35 -0
- mistralai_gcp/models/toolmessage.py +1 -1
- mistralai_gcp/models/usageinfo.py +71 -8
- mistralai_gcp/models/usermessage.py +1 -1
- mistralai_gcp/sdk.py +12 -10
- mistralai_gcp/sdkconfiguration.py +0 -7
- mistralai_gcp/types/basemodel.py +3 -3
- mistralai_gcp/utils/__init__.py +143 -45
- mistralai_gcp/utils/datetimes.py +23 -0
- mistralai_gcp/utils/enums.py +67 -27
- mistralai_gcp/utils/eventstreaming.py +10 -0
- mistralai_gcp/utils/forms.py +49 -28
- mistralai_gcp/utils/serializers.py +33 -3
- mistralai_gcp/utils/unmarshal_json_response.py +24 -0
- {mistralai-1.9.11.dist-info → mistralai-1.10.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mistralai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.1
|
|
4
4
|
Summary: Python Client SDK for the Mistral AI API.
|
|
5
|
-
|
|
5
|
+
Project-URL: Repository, https://github.com/mistralai/client-python.git
|
|
6
6
|
Author: Mistral
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: eval-type-backport>=0.2.0
|
|
10
|
+
Requires-Dist: httpx>=0.28.1
|
|
11
|
+
Requires-Dist: invoke<3.0.0,>=2.2.0
|
|
12
|
+
Requires-Dist: opentelemetry-api<2.0.0,>=1.33.1
|
|
13
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2.0.0,>=1.37.0
|
|
14
|
+
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.33.1
|
|
15
|
+
Requires-Dist: opentelemetry-semantic-conventions<0.60,>=0.59b0
|
|
16
|
+
Requires-Dist: pydantic>=2.10.3
|
|
17
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
18
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.2
|
|
19
|
+
Requires-Dist: typing-inspection>=0.4.0
|
|
15
20
|
Provides-Extra: agents
|
|
21
|
+
Requires-Dist: authlib<2.0,>=1.5.2; extra == 'agents'
|
|
22
|
+
Requires-Dist: griffe<2.0,>=1.7.3; extra == 'agents'
|
|
23
|
+
Requires-Dist: mcp<2.0,>=1.0; extra == 'agents'
|
|
16
24
|
Provides-Extra: gcp
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist: google-auth (>=2.27.0) ; extra == "gcp"
|
|
20
|
-
Requires-Dist: griffe (>=1.7.3,<2.0) ; extra == "agents"
|
|
21
|
-
Requires-Dist: httpx (>=0.28.1)
|
|
22
|
-
Requires-Dist: invoke (>=2.2.0,<3.0.0)
|
|
23
|
-
Requires-Dist: mcp (>=1.0,<2.0) ; (python_version >= "3.10") and (extra == "agents")
|
|
24
|
-
Requires-Dist: pydantic (>=2.10.3)
|
|
25
|
-
Requires-Dist: python-dateutil (>=2.8.2)
|
|
26
|
-
Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
|
|
27
|
-
Requires-Dist: requests (>=2.32.3) ; extra == "gcp"
|
|
28
|
-
Requires-Dist: typing-inspection (>=0.4.0)
|
|
29
|
-
Project-URL: Repository, https://github.com/mistralai/client-python.git
|
|
25
|
+
Requires-Dist: google-auth>=2.27.0; extra == 'gcp'
|
|
26
|
+
Requires-Dist: requests>=2.32.3; extra == 'gcp'
|
|
30
27
|
Description-Content-Type: text/markdown
|
|
31
28
|
|
|
32
29
|
# Mistral Python Client
|
|
33
30
|
|
|
34
31
|
## Migration warning
|
|
35
32
|
|
|
36
|
-
This documentation is for Mistral AI SDK v1. You can find more details on how to migrate from v0 to v1 [here](
|
|
33
|
+
This documentation is for Mistral AI SDK v1. You can find more details on how to migrate from v0 to v1 [here](MIGRATION.md)
|
|
37
34
|
|
|
38
35
|
## API Key Setup
|
|
39
36
|
|
|
@@ -59,25 +56,25 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
|
|
|
59
56
|
<!-- Start Table of Contents [toc] -->
|
|
60
57
|
## Table of Contents
|
|
61
58
|
<!-- $toc-max-depth=2 -->
|
|
62
|
-
* [Mistral Python Client](
|
|
63
|
-
* [Migration warning](
|
|
64
|
-
* [API Key Setup](
|
|
65
|
-
* [SDK Installation](
|
|
66
|
-
* [SDK Example Usage](
|
|
67
|
-
* [Providers' SDKs Example Usage](
|
|
68
|
-
* [Available Resources and Operations](
|
|
69
|
-
* [Server-sent event streaming](
|
|
70
|
-
* [File uploads](
|
|
71
|
-
* [Retries](
|
|
72
|
-
* [Error Handling](
|
|
73
|
-
* [Server Selection](
|
|
74
|
-
* [Custom HTTP Client](
|
|
75
|
-
* [Authentication](
|
|
76
|
-
* [Resource Management](
|
|
77
|
-
* [Debugging](
|
|
78
|
-
* [IDE Support](
|
|
79
|
-
* [Development](
|
|
80
|
-
* [Contributions](
|
|
59
|
+
* [Mistral Python Client](#mistral-python-client)
|
|
60
|
+
* [Migration warning](#migration-warning)
|
|
61
|
+
* [API Key Setup](#api-key-setup)
|
|
62
|
+
* [SDK Installation](#sdk-installation)
|
|
63
|
+
* [SDK Example Usage](#sdk-example-usage)
|
|
64
|
+
* [Providers' SDKs Example Usage](#providers-sdks-example-usage)
|
|
65
|
+
* [Available Resources and Operations](#available-resources-and-operations)
|
|
66
|
+
* [Server-sent event streaming](#server-sent-event-streaming)
|
|
67
|
+
* [File uploads](#file-uploads)
|
|
68
|
+
* [Retries](#retries)
|
|
69
|
+
* [Error Handling](#error-handling)
|
|
70
|
+
* [Server Selection](#server-selection)
|
|
71
|
+
* [Custom HTTP Client](#custom-http-client)
|
|
72
|
+
* [Authentication](#authentication)
|
|
73
|
+
* [Resource Management](#resource-management)
|
|
74
|
+
* [Debugging](#debugging)
|
|
75
|
+
* [IDE Support](#ide-support)
|
|
76
|
+
* [Development](#development)
|
|
77
|
+
* [Contributions](#contributions)
|
|
81
78
|
|
|
82
79
|
<!-- End Table of Contents [toc] -->
|
|
83
80
|
|
|
@@ -156,8 +153,7 @@ installing the package:
|
|
|
156
153
|
pip install "mistralai[agents]"
|
|
157
154
|
```
|
|
158
155
|
|
|
159
|
-
> Note:
|
|
160
|
-
> 3.10.
|
|
156
|
+
> Note: These features require Python 3.10+ (the SDK minimum).
|
|
161
157
|
|
|
162
158
|
<!-- Start SDK Example Usage [usage] -->
|
|
163
159
|
## SDK Example Usage
|
|
@@ -176,12 +172,14 @@ with Mistral(
|
|
|
176
172
|
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
177
173
|
) as mistral:
|
|
178
174
|
|
|
179
|
-
res = mistral.chat.complete(model="mistral-
|
|
175
|
+
res = mistral.chat.complete(model="mistral-large-latest", messages=[
|
|
180
176
|
{
|
|
181
177
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
182
178
|
"role": "user",
|
|
183
179
|
},
|
|
184
|
-
], stream=False
|
|
180
|
+
], stream=False, response_format={
|
|
181
|
+
"type": "text",
|
|
182
|
+
})
|
|
185
183
|
|
|
186
184
|
# Handle response
|
|
187
185
|
print(res)
|
|
@@ -202,12 +200,14 @@ async def main():
|
|
|
202
200
|
api_key=os.getenv("MISTRAL_API_KEY", ""),
|
|
203
201
|
) as mistral:
|
|
204
202
|
|
|
205
|
-
res = await mistral.chat.complete_async(model="mistral-
|
|
203
|
+
res = await mistral.chat.complete_async(model="mistral-large-latest", messages=[
|
|
206
204
|
{
|
|
207
205
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
208
206
|
"role": "user",
|
|
209
207
|
},
|
|
210
|
-
], stream=False
|
|
208
|
+
], stream=False, response_format={
|
|
209
|
+
"type": "text",
|
|
210
|
+
})
|
|
211
211
|
|
|
212
212
|
# Handle response
|
|
213
213
|
print(res)
|
|
@@ -283,7 +283,9 @@ with Mistral(
|
|
|
283
283
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
284
284
|
"role": "user",
|
|
285
285
|
},
|
|
286
|
-
], agent_id="<id>", stream=False
|
|
286
|
+
], agent_id="<id>", stream=False, response_format={
|
|
287
|
+
"type": "text",
|
|
288
|
+
})
|
|
287
289
|
|
|
288
290
|
# Handle response
|
|
289
291
|
print(res)
|
|
@@ -309,7 +311,9 @@ async def main():
|
|
|
309
311
|
"content": "Who is the best French painter? Answer in one short sentence.",
|
|
310
312
|
"role": "user",
|
|
311
313
|
},
|
|
312
|
-
], agent_id="<id>", stream=False
|
|
314
|
+
], agent_id="<id>", stream=False, response_format={
|
|
315
|
+
"type": "text",
|
|
316
|
+
})
|
|
313
317
|
|
|
314
318
|
# Handle response
|
|
315
319
|
print(res)
|
|
@@ -370,7 +374,7 @@ asyncio.run(main())
|
|
|
370
374
|
|
|
371
375
|
### More examples
|
|
372
376
|
|
|
373
|
-
You can run the examples in the `examples/` directory using `
|
|
377
|
+
You can run the examples in the `examples/` directory using `uv run`.
|
|
374
378
|
|
|
375
379
|
|
|
376
380
|
## Providers' SDKs Example Usage
|
|
@@ -382,7 +386,7 @@ You can run the examples in the `examples/` directory using `poetry run` or by e
|
|
|
382
386
|
Before you begin, ensure you have `AZUREAI_ENDPOINT` and an `AZURE_API_KEY`. To obtain these, you will need to deploy Mistral on Azure AI.
|
|
383
387
|
See [instructions for deploying Mistral on Azure AI here](https://docs.mistral.ai/deployment/cloud/azure/).
|
|
384
388
|
|
|
385
|
-
Here's a basic example to get you started. You can also run [the example in the `examples` directory](
|
|
389
|
+
Here's a basic example to get you started. You can also run [the example in the `examples` directory](/examples/azure).
|
|
386
390
|
|
|
387
391
|
```python
|
|
388
392
|
import asyncio
|
|
@@ -410,7 +414,7 @@ async def main() -> None:
|
|
|
410
414
|
|
|
411
415
|
asyncio.run(main())
|
|
412
416
|
```
|
|
413
|
-
The documentation for the Azure SDK is available [here](
|
|
417
|
+
The documentation for the Azure SDK is available [here](packages/mistralai_azure/README.md).
|
|
414
418
|
|
|
415
419
|
### Google Cloud
|
|
416
420
|
|
|
@@ -459,7 +463,7 @@ async def main() -> None:
|
|
|
459
463
|
asyncio.run(main())
|
|
460
464
|
```
|
|
461
465
|
|
|
462
|
-
The documentation for the GCP SDK is available [here](
|
|
466
|
+
The documentation for the GCP SDK is available [here](packages/mistralai_gcp/README.md).
|
|
463
467
|
|
|
464
468
|
|
|
465
469
|
<!-- Start Available Resources and Operations [operations] -->
|
|
@@ -468,134 +472,136 @@ The documentation for the GCP SDK is available [here](https://github.com/mistral
|
|
|
468
472
|
<details open>
|
|
469
473
|
<summary>Available methods</summary>
|
|
470
474
|
|
|
471
|
-
### [agents](
|
|
475
|
+
### [agents](docs/sdks/agents/README.md)
|
|
472
476
|
|
|
473
|
-
* [complete](
|
|
474
|
-
* [stream](
|
|
477
|
+
* [complete](docs/sdks/agents/README.md#complete) - Agents Completion
|
|
478
|
+
* [stream](docs/sdks/agents/README.md#stream) - Stream Agents completion
|
|
475
479
|
|
|
476
|
-
### [audio](
|
|
480
|
+
### [audio](docs/sdks/audio/README.md)
|
|
477
481
|
|
|
478
482
|
|
|
479
|
-
#### [audio.transcriptions](
|
|
483
|
+
#### [audio.transcriptions](docs/sdks/transcriptions/README.md)
|
|
480
484
|
|
|
481
|
-
* [complete](
|
|
482
|
-
* [stream](
|
|
485
|
+
* [complete](docs/sdks/transcriptions/README.md#complete) - Create Transcription
|
|
486
|
+
* [stream](docs/sdks/transcriptions/README.md#stream) - Create Streaming Transcription (SSE)
|
|
483
487
|
|
|
484
|
-
### [batch](
|
|
488
|
+
### [batch](docs/sdks/batch/README.md)
|
|
485
489
|
|
|
486
490
|
|
|
487
|
-
#### [batch.jobs](
|
|
491
|
+
#### [batch.jobs](docs/sdks/mistraljobs/README.md)
|
|
488
492
|
|
|
489
|
-
* [list](
|
|
490
|
-
* [create](
|
|
491
|
-
* [get](
|
|
492
|
-
* [cancel](
|
|
493
|
+
* [list](docs/sdks/mistraljobs/README.md#list) - Get Batch Jobs
|
|
494
|
+
* [create](docs/sdks/mistraljobs/README.md#create) - Create Batch Job
|
|
495
|
+
* [get](docs/sdks/mistraljobs/README.md#get) - Get Batch Job
|
|
496
|
+
* [cancel](docs/sdks/mistraljobs/README.md#cancel) - Cancel Batch Job
|
|
493
497
|
|
|
494
|
-
### [beta](
|
|
498
|
+
### [beta](docs/sdks/beta/README.md)
|
|
495
499
|
|
|
496
500
|
|
|
497
|
-
#### [beta.agents](
|
|
501
|
+
#### [beta.agents](docs/sdks/mistralagents/README.md)
|
|
498
502
|
|
|
499
|
-
* [create](
|
|
500
|
-
* [list](
|
|
501
|
-
* [get](
|
|
502
|
-
* [update](
|
|
503
|
-
* [
|
|
503
|
+
* [create](docs/sdks/mistralagents/README.md#create) - Create a agent that can be used within a conversation.
|
|
504
|
+
* [list](docs/sdks/mistralagents/README.md#list) - List agent entities.
|
|
505
|
+
* [get](docs/sdks/mistralagents/README.md#get) - Retrieve an agent entity.
|
|
506
|
+
* [update](docs/sdks/mistralagents/README.md#update) - Update an agent entity.
|
|
507
|
+
* [delete](docs/sdks/mistralagents/README.md#delete) - Delete an agent entity.
|
|
508
|
+
* [update_version](docs/sdks/mistralagents/README.md#update_version) - Update an agent version.
|
|
504
509
|
|
|
505
|
-
#### [beta.conversations](
|
|
510
|
+
#### [beta.conversations](docs/sdks/conversations/README.md)
|
|
506
511
|
|
|
507
|
-
* [start](
|
|
508
|
-
* [list](
|
|
509
|
-
* [get](
|
|
510
|
-
* [
|
|
511
|
-
* [
|
|
512
|
-
* [
|
|
513
|
-
* [
|
|
514
|
-
* [
|
|
515
|
-
* [
|
|
516
|
-
* [
|
|
512
|
+
* [start](docs/sdks/conversations/README.md#start) - Create a conversation and append entries to it.
|
|
513
|
+
* [list](docs/sdks/conversations/README.md#list) - List all created conversations.
|
|
514
|
+
* [get](docs/sdks/conversations/README.md#get) - Retrieve a conversation information.
|
|
515
|
+
* [delete](docs/sdks/conversations/README.md#delete) - Delete a conversation.
|
|
516
|
+
* [append](docs/sdks/conversations/README.md#append) - Append new entries to an existing conversation.
|
|
517
|
+
* [get_history](docs/sdks/conversations/README.md#get_history) - Retrieve all entries in a conversation.
|
|
518
|
+
* [get_messages](docs/sdks/conversations/README.md#get_messages) - Retrieve all messages in a conversation.
|
|
519
|
+
* [restart](docs/sdks/conversations/README.md#restart) - Restart a conversation starting from a given entry.
|
|
520
|
+
* [start_stream](docs/sdks/conversations/README.md#start_stream) - Create a conversation and append entries to it.
|
|
521
|
+
* [append_stream](docs/sdks/conversations/README.md#append_stream) - Append new entries to an existing conversation.
|
|
522
|
+
* [restart_stream](docs/sdks/conversations/README.md#restart_stream) - Restart a conversation starting from a given entry.
|
|
517
523
|
|
|
518
|
-
#### [beta.libraries](
|
|
524
|
+
#### [beta.libraries](docs/sdks/libraries/README.md)
|
|
519
525
|
|
|
520
|
-
* [list](
|
|
521
|
-
* [create](
|
|
522
|
-
* [get](
|
|
523
|
-
* [delete](
|
|
524
|
-
* [update](
|
|
526
|
+
* [list](docs/sdks/libraries/README.md#list) - List all libraries you have access to.
|
|
527
|
+
* [create](docs/sdks/libraries/README.md#create) - Create a new Library.
|
|
528
|
+
* [get](docs/sdks/libraries/README.md#get) - Detailed information about a specific Library.
|
|
529
|
+
* [delete](docs/sdks/libraries/README.md#delete) - Delete a library and all of it's document.
|
|
530
|
+
* [update](docs/sdks/libraries/README.md#update) - Update a library.
|
|
525
531
|
|
|
526
|
-
#### [beta.libraries.accesses](
|
|
532
|
+
#### [beta.libraries.accesses](docs/sdks/accesses/README.md)
|
|
527
533
|
|
|
528
|
-
* [list](
|
|
529
|
-
* [update_or_create](
|
|
530
|
-
* [delete](
|
|
534
|
+
* [list](docs/sdks/accesses/README.md#list) - List all of the access to this library.
|
|
535
|
+
* [update_or_create](docs/sdks/accesses/README.md#update_or_create) - Create or update an access level.
|
|
536
|
+
* [delete](docs/sdks/accesses/README.md#delete) - Delete an access level.
|
|
531
537
|
|
|
532
|
-
#### [beta.libraries.documents](
|
|
538
|
+
#### [beta.libraries.documents](docs/sdks/documents/README.md)
|
|
533
539
|
|
|
534
|
-
* [list](
|
|
535
|
-
* [upload](
|
|
536
|
-
* [get](
|
|
537
|
-
* [update](
|
|
538
|
-
* [delete](
|
|
539
|
-
* [text_content](
|
|
540
|
-
* [status](
|
|
541
|
-
* [get_signed_url](
|
|
542
|
-
* [extracted_text_signed_url](
|
|
543
|
-
* [reprocess](
|
|
540
|
+
* [list](docs/sdks/documents/README.md#list) - List documents in a given library.
|
|
541
|
+
* [upload](docs/sdks/documents/README.md#upload) - Upload a new document.
|
|
542
|
+
* [get](docs/sdks/documents/README.md#get) - Retrieve the metadata of a specific document.
|
|
543
|
+
* [update](docs/sdks/documents/README.md#update) - Update the metadata of a specific document.
|
|
544
|
+
* [delete](docs/sdks/documents/README.md#delete) - Delete a document.
|
|
545
|
+
* [text_content](docs/sdks/documents/README.md#text_content) - Retrieve the text content of a specific document.
|
|
546
|
+
* [status](docs/sdks/documents/README.md#status) - Retrieve the processing status of a specific document.
|
|
547
|
+
* [get_signed_url](docs/sdks/documents/README.md#get_signed_url) - Retrieve the signed URL of a specific document.
|
|
548
|
+
* [extracted_text_signed_url](docs/sdks/documents/README.md#extracted_text_signed_url) - Retrieve the signed URL of text extracted from a given document.
|
|
549
|
+
* [reprocess](docs/sdks/documents/README.md#reprocess) - Reprocess a document.
|
|
544
550
|
|
|
545
|
-
### [chat](
|
|
551
|
+
### [chat](docs/sdks/chat/README.md)
|
|
546
552
|
|
|
547
|
-
* [complete](
|
|
548
|
-
* [stream](
|
|
553
|
+
* [complete](docs/sdks/chat/README.md#complete) - Chat Completion
|
|
554
|
+
* [stream](docs/sdks/chat/README.md#stream) - Stream chat completion
|
|
549
555
|
|
|
550
|
-
### [classifiers](
|
|
556
|
+
### [classifiers](docs/sdks/classifiers/README.md)
|
|
551
557
|
|
|
552
|
-
* [moderate](
|
|
553
|
-
* [moderate_chat](
|
|
554
|
-
* [classify](
|
|
555
|
-
* [classify_chat](
|
|
558
|
+
* [moderate](docs/sdks/classifiers/README.md#moderate) - Moderations
|
|
559
|
+
* [moderate_chat](docs/sdks/classifiers/README.md#moderate_chat) - Chat Moderations
|
|
560
|
+
* [classify](docs/sdks/classifiers/README.md#classify) - Classifications
|
|
561
|
+
* [classify_chat](docs/sdks/classifiers/README.md#classify_chat) - Chat Classifications
|
|
556
562
|
|
|
557
|
-
### [embeddings](
|
|
563
|
+
### [embeddings](docs/sdks/embeddings/README.md)
|
|
558
564
|
|
|
559
|
-
* [create](
|
|
565
|
+
* [create](docs/sdks/embeddings/README.md#create) - Embeddings
|
|
560
566
|
|
|
561
|
-
### [files](
|
|
567
|
+
### [files](docs/sdks/files/README.md)
|
|
562
568
|
|
|
563
|
-
* [upload](
|
|
564
|
-
* [list](
|
|
565
|
-
* [retrieve](
|
|
566
|
-
* [delete](
|
|
567
|
-
* [download](
|
|
568
|
-
* [get_signed_url](
|
|
569
|
+
* [upload](docs/sdks/files/README.md#upload) - Upload File
|
|
570
|
+
* [list](docs/sdks/files/README.md#list) - List Files
|
|
571
|
+
* [retrieve](docs/sdks/files/README.md#retrieve) - Retrieve File
|
|
572
|
+
* [delete](docs/sdks/files/README.md#delete) - Delete File
|
|
573
|
+
* [download](docs/sdks/files/README.md#download) - Download File
|
|
574
|
+
* [get_signed_url](docs/sdks/files/README.md#get_signed_url) - Get Signed Url
|
|
569
575
|
|
|
570
|
-
### [fim](
|
|
576
|
+
### [fim](docs/sdks/fim/README.md)
|
|
571
577
|
|
|
572
|
-
* [complete](
|
|
573
|
-
* [stream](
|
|
578
|
+
* [complete](docs/sdks/fim/README.md#complete) - Fim Completion
|
|
579
|
+
* [stream](docs/sdks/fim/README.md#stream) - Stream fim completion
|
|
574
580
|
|
|
575
|
-
### [fine_tuning](
|
|
581
|
+
### [fine_tuning](docs/sdks/finetuning/README.md)
|
|
576
582
|
|
|
577
583
|
|
|
578
|
-
#### [fine_tuning.jobs](
|
|
584
|
+
#### [fine_tuning.jobs](docs/sdks/jobs/README.md)
|
|
579
585
|
|
|
580
|
-
* [list](
|
|
581
|
-
* [create](
|
|
582
|
-
* [get](
|
|
583
|
-
* [cancel](
|
|
584
|
-
* [start](
|
|
586
|
+
* [list](docs/sdks/jobs/README.md#list) - Get Fine Tuning Jobs
|
|
587
|
+
* [create](docs/sdks/jobs/README.md#create) - Create Fine Tuning Job
|
|
588
|
+
* [get](docs/sdks/jobs/README.md#get) - Get Fine Tuning Job
|
|
589
|
+
* [cancel](docs/sdks/jobs/README.md#cancel) - Cancel Fine Tuning Job
|
|
590
|
+
* [start](docs/sdks/jobs/README.md#start) - Start Fine Tuning Job
|
|
585
591
|
|
|
586
592
|
|
|
587
|
-
### [models](
|
|
593
|
+
### [models](docs/sdks/models/README.md)
|
|
588
594
|
|
|
589
|
-
* [list](
|
|
590
|
-
* [retrieve](
|
|
591
|
-
* [delete](
|
|
592
|
-
* [update](
|
|
593
|
-
* [archive](
|
|
594
|
-
* [unarchive](
|
|
595
|
+
* [list](docs/sdks/models/README.md#list) - List Models
|
|
596
|
+
* [retrieve](docs/sdks/models/README.md#retrieve) - Retrieve Model
|
|
597
|
+
* [delete](docs/sdks/models/README.md#delete) - Delete Model
|
|
598
|
+
* [update](docs/sdks/models/README.md#update) - Update Fine Tuned Model
|
|
599
|
+
* [archive](docs/sdks/models/README.md#archive) - Archive Fine Tuned Model
|
|
600
|
+
* [unarchive](docs/sdks/models/README.md#unarchive) - Unarchive Fine Tuned Model
|
|
595
601
|
|
|
596
|
-
### [ocr](
|
|
602
|
+
### [ocr](docs/sdks/ocr/README.md)
|
|
597
603
|
|
|
598
|
-
* [process](
|
|
604
|
+
* [process](docs/sdks/ocr/README.md#process) - OCR
|
|
599
605
|
|
|
600
606
|
</details>
|
|
601
607
|
<!-- End Available Resources and Operations [operations] -->
|
|
@@ -628,7 +634,11 @@ with Mistral(
|
|
|
628
634
|
"tool_call_id": "<id>",
|
|
629
635
|
"result": "<value>",
|
|
630
636
|
},
|
|
631
|
-
], stream=True
|
|
637
|
+
], stream=True, completion_args={
|
|
638
|
+
"response_format": {
|
|
639
|
+
"type": "text",
|
|
640
|
+
},
|
|
641
|
+
})
|
|
632
642
|
|
|
633
643
|
with res as event_stream:
|
|
634
644
|
for event in event_stream:
|
|
@@ -719,7 +729,7 @@ with Mistral(
|
|
|
719
729
|
<!-- Start Error Handling [errors] -->
|
|
720
730
|
## Error Handling
|
|
721
731
|
|
|
722
|
-
[`MistralError`](
|
|
732
|
+
[`MistralError`](./src/mistralai/models/mistralerror.py) is the base class for all HTTP error responses. It has the following properties:
|
|
723
733
|
|
|
724
734
|
| Property | Type | Description |
|
|
725
735
|
| ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
|
|
@@ -728,7 +738,7 @@ with Mistral(
|
|
|
728
738
|
| `err.headers` | `httpx.Headers` | HTTP response headers |
|
|
729
739
|
| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
|
|
730
740
|
| `err.raw_response` | `httpx.Response` | Raw HTTP response |
|
|
731
|
-
| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](
|
|
741
|
+
| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
|
|
732
742
|
|
|
733
743
|
### Example
|
|
734
744
|
```python
|
|
@@ -743,7 +753,7 @@ with Mistral(
|
|
|
743
753
|
res = None
|
|
744
754
|
try:
|
|
745
755
|
|
|
746
|
-
res = mistral.models.
|
|
756
|
+
res = mistral.models.retrieve(model_id="ft:open-mistral-7b:587a6b29:20240514:7e773925")
|
|
747
757
|
|
|
748
758
|
# Handle response
|
|
749
759
|
print(res)
|
|
@@ -764,7 +774,7 @@ with Mistral(
|
|
|
764
774
|
|
|
765
775
|
### Error Classes
|
|
766
776
|
**Primary error:**
|
|
767
|
-
* [`MistralError`](
|
|
777
|
+
* [`MistralError`](./src/mistralai/models/mistralerror.py): The base class for HTTP error responses.
|
|
768
778
|
|
|
769
779
|
<details><summary>Less common errors (6)</summary>
|
|
770
780
|
|
|
@@ -776,13 +786,13 @@ with Mistral(
|
|
|
776
786
|
* [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
|
|
777
787
|
|
|
778
788
|
|
|
779
|
-
**Inherit from [`MistralError`](
|
|
780
|
-
* [`HTTPValidationError`](
|
|
781
|
-
* [`ResponseValidationError`](
|
|
789
|
+
**Inherit from [`MistralError`](./src/mistralai/models/mistralerror.py)**:
|
|
790
|
+
* [`HTTPValidationError`](./src/mistralai/models/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 48 of 70 methods.*
|
|
791
|
+
* [`ResponseValidationError`](./src/mistralai/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
|
|
782
792
|
|
|
783
793
|
</details>
|
|
784
794
|
|
|
785
|
-
\* Check [the method documentation](
|
|
795
|
+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
|
|
786
796
|
<!-- End Error Handling [errors] -->
|
|
787
797
|
|
|
788
798
|
<!-- Start Server Selection [server] -->
|