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
{{ message }}
Repository navigation
Commit 08c7956
Browse filesBrowse the repository at this point in the historyBrowse files
* chore: sync generated SDK from upstream @ ed06004b
Generated upstream and copied here. Do not edit in this repository;
changes are overwritten by the next sync.
* chore: drop MIGRATION.md change and connector overlay
* docs(readme): announce voice agents and point the PyPI readme at v3
---------
Co-authored-by: Buildkite CI <engineering@mistral.ai>
Co-authored-by: andreaonofrei01 <andrea.onofrei@mistral.ai>
Copy file name to clipboardExpand all lines: README-PYPI.md
+125-7Lines changed: 125 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
# Mistral Python Client
2
2
3
-
## Migrating from v1
3
+
## New: Voice Agents
4
4
5
-
If you are upgrading from v1 to v2, check the [migration guide](https://github.com/mistralai/client-python/blob/main/MIGRATION.md) for details on breaking changes and how to update your code.
5
+
Build live voice agents with the SDK. `client.audio.sessions.init()` opens a real-time, bidirectional voice session with speech-to-text, text-to-speech and tool calls, and `client.audio.agents` saves agent configurations to reuse across sessions. Install the extra with `pip install "mistralai[voice-agents]"`, then see [Voice Agents](#voice-agents) below and the [voice agents guide](https://github.com/mistralai/client-python/blob/main/src/mistralai/extra/voice_agents/README.md).
6
+
7
+
## Migrating to v3
8
+
9
+
This is v3 of the SDK. If you are upgrading from v2, check the [migration guide](https://github.com/mistralai/client-python/blob/main/MIGRATION.md) for the breaking changes and how to update your code. It also covers upgrading from v1 to v2.
6
10
7
11
## API Key Setup
8
12
@@ -40,13 +44,15 @@ Mistral AI API: Our Chat Completion and Embeddings APIs specification. Create yo
40
44
## Table of Contents
41
45
<!-- $toc-max-depth=2 -->
42
46
*[Mistral Python Client](#mistral-python-client)
43
-
*[Migrating from v1](#migrating-from-v1)
47
+
*[New: Voice Agents](#new-voice-agents)
48
+
*[Migrating to v3](#migrating-to-v3)
44
49
*[API Key Setup](#api-key-setup)
45
50
*[SDK Installation](#sdk-installation)
46
51
*[SDK Example Usage](#sdk-example-usage)
47
52
*[Providers' SDKs Example Usage](#providers-sdks-example-usage)
48
53
*[Available Resources and Operations](#available-resources-and-operations)
*[read](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#read) - Read chunks within a span
721
755
*[grep](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#grep) - Grep for a pattern within a source
722
756
*[get_chunk](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#get_chunk) - Get a single chunk by id
757
+
*[get_index_summary](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#get_index_summary) - Get Managed Index Summary
758
+
*[generate_index_summary](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#generate_index_summary) - Generate a summary field for a managed index
759
+
*[set_index_summary](https://github.com/mistralai/client-python/blob/main/docs/sdks/managedindexes/README.md#set_index_summary) - Set Managed Index Summary
<!-- End Server-sent event streaming [eventstream] -->
936
973
974
+
<!-- Start Json Streaming [jsonl] -->
975
+
## Json Streaming
976
+
977
+
Json Streaming ([jsonl][jsonl-format] / [x-ndjson][x-ndjson]) content type can be used to stream content from certain operations. These operations will expose the stream as [Generator][generator] that
978
+
can be consumed using a simple `for` loop. The loop will
979
+
terminate when the server no longer has any events to send and closes the
980
+
underlying connection.
981
+
982
+
The stream is also a [Context Manager][context-manager] and can be used with the `with` statement and will close the
983
+
underlying connection when the context is exited.
984
+
985
+
```python
986
+
from mistralai.client import Mistral
987
+
import os
988
+
989
+
990
+
with Mistral(
991
+
api_key=os.getenv("MISTRAL_API_KEY", ""),
992
+
) as mistral:
993
+
994
+
res = mistral.beta.rag.managed_indexes.generate_index_summary(language="en", index_name="<value>", force=False)
**Inherit from [`MistralError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/mistralerror.py)**:
1102
-
*[`HTTPValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 165 of 275 methods.*
1103
-
*[`ObservabilityError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 65 of 275 methods.*
1174
+
*[`HTTPValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/httpvalidationerror.py): Validation Error. Status code `422`. Applicable to 178 of 288 methods.*
1175
+
*[`ObservabilityError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/observabilityerror.py): Bad Request - Invalid request parameters or data. Applicable to 65 of 288 methods.*
1104
1176
*[`ResponseValidationError`](https://github.com/mistralai/client-python/blob/main/src/mistralai/client/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
1105
1177
1106
1178
</details>
@@ -1491,6 +1563,52 @@ configure_telemetry(
1491
1563
1492
1564
Runnable examples live in [`examples/mistral/observability`](https://github.com/mistralai/client-python/blob/main/examples/mistral/observability).
1493
1565
1566
+
## Voice Agents
1567
+
1568
+
`client.audio.sessions.init()` opens a live, bidirectional voice session on top of the generated `audio.sessions` REST methods, which stay available for plain session CRUD. Install the extra; system audio also needs PortAudio (`brew install portaudio` on macOS).
1569
+
1570
+
```bash
1571
+
pip install "mistralai[voice-agents]"
1572
+
```
1573
+
1574
+
```python
1575
+
import asyncio
1576
+
1577
+
from mistralai.client import Mistral
1578
+
from mistralai.extra.voice_agents import DefaultAudioInterface, WebSearchTool, function_tool
1579
+
1580
+
1581
+
@function_tool(filler={"text": "Let me check the weather."}, timeout_ms=15000)
`init()` creates the remote session and returns it ready to connect; it does not join the room or open audio. Register callbacks, then call `await session.connect()` or enter `async with session` within the session's join window. `await session.close()` gives the session up without connecting. A missing microphone or a missing extra fails `init()` before any session is created.
1607
+
1608
+
Omit `audio_interface` to drive 48 kHz mono signed 16-bit PCM yourself: register an `audio` callback and call `session.send_audio()` after `connect()`.
1609
+
1610
+
Tool declarations, saved agents and versions, event semantics and migration from the standalone `mistralai-voice-agents` package are covered in [the voice agents guide](https://github.com/mistralai/client-python/blob/main/src/mistralai/extra/voice_agents/README.md). The runnable examples live in [`examples/audio/voice_agents`](https://github.com/mistralai/client-python/blob/main/examples/audio/voice_agents).
0 commit comments