- complete - Speech
Speech
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.audio.speech.complete(input="<value>", stream=False, additional_properties={
})
with res as event_stream:
for event in event_stream:
# handle event
print(event, flush=True)| Parameter | Type | Required | Description |
|---|---|---|---|
input |
str | ✔️ | Text to generate a speech from |
model |
OptionalNullable[str] | ➖ | N/A |
metadata |
OptionalNullable[models.MetadataDict] | ➖ | N/A |
stream |
Optional[bool] | ➖ | N/A |
voice_id |
OptionalNullable[str] | ➖ | The preset or custom voice to use for generating the speech. |
ref_audio |
OptionalNullable[str] | ➖ | The audio reference for generating the speech. |
response_format |
Optional[models.SpeechOutputFormat] | ➖ | N/A |
additional_properties |
Dict[str, Any] | ➖ | N/A |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. |
models.SpeechV1AudioSpeechPostResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |