mistralM

Docs

sideBar

Transcription hors ligne

Transcrivez des fichiers audio avec Voxtral, ou discutez d’un contenu audio avec des modèles qui suivent des instructions, avec compatibilité avec le SDK OpenAI.

Avant de commencer

Modèles dotés de capacités audio

Modèles compatibles audio :

  • Voxtral Small (voxtral-small-latest) avec entrée audio pour les cas d’usage de chat.
  • Voxtral Mini Transcribe 2 (voxtral-mini-latest via audio/transcriptions), avec un service efficace dédié uniquement à la transcription.
lightbulb

Pour une transcription plus rapide, nous vous recommandons d’importer vos fichiers audio.

Chat avec audio

Utiliser l’audio avec des modèles qui suivent des instructions

Nos modèles Voxtral peuvent être utilisés pour des cas d’usage de chat avec notre endpoint de complétion de chat.

lightbulb

Avant de continuer, nous vous recommandons de lire la documentation Chat Completions pour en savoir plus sur l’API chat completions et son utilisation.

Pour transmettre un fichier audio local, vous pouvez l’encoder en base64 et le transmettre sous forme de chaîne.

import base64
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-small-latest"

client = Mistral(api_key=api_key)

# Encode the audio file in base64
with open("examples/files/bcn_weather.mp3", "rb") as f:
    content = f.read()
audio_base64 = base64.b64encode(content).decode('utf-8')

chat_response = client.chat.complete(
    model=model,
    messages=[{
        "role": "user",
        "content": [
            {
                "type": "input_audio",
                "input_audio": audio_base64,
            },
            {
                "type": "text",
                "text": "What's in this file?"
            },
        ]
    }],
)
Sortie
{
"id": "d719e752a0f845c895758933ea488cb0",
"created": 1756386611,
"model": "voxtral-small-latest",
"usage": {
  "prompt_audio_seconds": 19,
  "prompt_tokens": 10,
  "total_tokens": 452,
  "completion_tokens": 67
},
"object": "chat.completion",
"choices": [
  {
    "index": 0,
    "finish_reason": "stop",
    "message": {
      "role": "assistant",
      "tool_calls": null,
      "content": "The audio file appears to be a compilation of music or sound effects, as indicated by the repeated, short, and varied sounds. However, without the context of the audio, it's challenging to determine what specific sounds or music are included. If you have more details or the audio itself, I could provide a more accurate analysis."
    }
  }
]
}

Exemples

Vous trouverez ci-dessous quelques-uns des nombreux cas d’usage possibles grâce aux capacités audio de nos modèles.

User

0:00 / 0:00

Assistant

Bien sûr, voici la transcription de ce que vous avez dit :<br /> "Today on July 15th, 2025, Mistral AI is announcing the new Voxtral models."<br /> Et voici le code Python pour générer les n premiers termes de la suite de Fibonacci :

def fibonacci(n):
    if n <= 0:
        return []
    elif n == 1:
        return [0]
    elif n == 2:
        return [0, 1]

fib_sequence = [0, 1]
for i in range(2, n):
    next_value = fib_sequence[-1] + fib_sequence[-2]
    fib_sequence.append(next_value)

return fib_sequence

# Example usage:
n = 10  # Change this value to get the first n digits of the Fibonacci sequence
print(fibonacci(n))

Ce code définit une fonction fibonacci qui prend un entier n et renvoie une liste contenant les n premiers termes de la suite de Fibonacci. Vous pouvez modifier la valeur de n pour obtenir le nombre de termes souhaité.

Transcription

Transcrire n’importe quel audio

La transcription dispose d’un endpoint optimisé dédié et prend actuellement en charge voxtral-mini-latest, qui exécute Voxtral Mini Transcribe 2.

Paramètres<br /> Nous proposons différents réglages et paramètres pour la transcription, comme :

  • timestamp_granularities : permet d’ajouter des horodatages pour savoir non seulement « ce qui » a été dit, mais aussi « quand ». Pour en savoir plus sur les horodatages, consultez cette page.
  • diarize : permet de savoir qui parle.
  • context_bias : fournissez jusqu’à 100 mots ou expressions pour guider le modèle vers l’orthographe correcte de noms, de termes techniques ou d’un vocabulaire métier. Particulièrement utile pour les noms propres ou la terminologie sectorielle que les modèles standard manquent souvent. Le biais de contexte est optimisé pour l’anglais ; la prise en charge des autres langues est expérimentale. Pour en savoir plus sur le biais de contexte, consultez cette page.
  • language : notre service de transcription sert aussi de service de détection de langue. Vous pouvez toutefois définir manuellement la langue de la transcription pour une meilleure précision si la langue de l’audio est déjà connue.

Temps réel : Nous proposons une fonctionnalité de transcription en direct. Pour plus d’informations sur le temps réel, consultez cette page.

Parmi les différentes méthodes de transmission de l’audio, vous pouvez fournir directement le chemin d’un fichier local pour l’importer et le transcrire, comme suit :

import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

with open("/path/to/file/audio.mp3", "rb") as f:
    transcription_response = client.audio.transcriptions.complete(
        model=model,
        file={
            "content": f,
            "file_name": "audio.mp3",
        },
        ## language="en"
    )
Sortie
{
  "model":"voxtral-mini-latest",
  "text":"This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.",
  "language":"en",
  "segments":[],
  "usage":{
    "prompt_audio_seconds":203,
    "prompt_tokens":4,
    "total_tokens":3264,
    "completion_tokens":635
  }
}

Exemples

Vous trouverez ci-dessous quelques exemples d’utilisation de l’endpoint de transcription audio.

Audio

0:00 / 0:00

Transcription

This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.

Language

English

Transcription avec horodatages

Vous pouvez demander des horodatages pour la transcription en passant le paramètre timestamp_granularities, qui prend actuellement en charge segment et word.<br /> La réponse renvoie l’heure de début et de fin de chaque segment du fichier audio.

pen

timestamp_granularities n’est actuellement pas compatible avec language : utilisez l’un ou l’autre.

import os
from mistralai import Mistral

api_key = os.environ["MISTRAL_API_KEY"]
model = "voxtral-mini-latest"

client = Mistral(api_key=api_key)

transcription_response = client.audio.transcriptions.complete(
    model=model,
    file_url="https://docs.mistral.ai/audio/obama.mp3",
    timestamp_granularities=["segment"] # or "word"
)
Sortie
{
  "model": "voxtral-mini-latest",
  "text": "This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts. All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there's an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as president. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
  "language": null,
  "segments": [
    {
      "text": "This week, I traveled to Chicago to deliver my final farewell address to the nation, following",
      "start": 0.8,
      "end": 6.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "in the tradition of presidents before me.",
      "start": 6.2,
      "end": 9.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It was an opportunity to say thank you.",
      "start": 9.0,
      "end": 11.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American",
      "start": 11.8,
      "end": 17.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "people, in living rooms, in schools, at farms and on factory floors, at diners and on distant",
      "start": 17.6,
      "end": 24.9,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "military outposts.",
      "start": 24.9,
      "end": 26.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "All these conversations are what have kept me honest, kept me inspired, and kept me going.",
      "start": 26.6,
      "end": 32.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Every day, I learned from you.",
      "start": 32.8,
      "end": 35.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "You made me a better President, and you made me a better man.",
      "start": 35.4,
      "end": 39.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people.",
      "start": 39.3,
      "end": 46.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes.",
      "start": 46.1,
      "end": 51.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've hugged cancer survivors who finally know the security of affordable health care.",
      "start": 52.2,
      "end": 56.5,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit.",
      "start": 57.1,
      "end": 65.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen the hopeful faces of young graduates and our newest military officers.",
      "start": 66.5,
      "end": 71.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've mourned with grieving families searching for answers.",
      "start": 71.7,
      "end": 74.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "And I found grace in a Charleston church.",
      "start": 75.2,
      "end": 77.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen our scientists help a paralyzed man regain his sense of touch and our wounded warriors walk again.",
      "start": 78.5,
      "end": 85.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks.",
      "start": 85.9,
      "end": 91.9,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've learned from students who are building robots and curing diseases and who will change the world in ways we can't even imagine.",
      "start": 92.6,
      "end": 99.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "I've seen the youngest of children remind us of our obligations to care for our refugees.",
      "start": 100.1,
      "end": 105.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "to work in peace, and above all, to look out for each other.",
      "start": 106.6,
      "end": 111.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government.",
      "start": 111.6,
      "end": 120.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "But we can't take our democracy for granted.",
      "start": 120.3,
      "end": 123.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "All of us, regardless of party, should throw ourselves into the work of citizenship.",
      "start": 123.4,
      "end": 129.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Not just when there's an election.",
      "start": 129.2,
      "end": 131.2,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Not just when our own narrow interest is at stake.",
      "start": 131.2,
      "end": 134.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "But over the full span of a lifetime.",
      "start": 134.7,
      "end": 138.1,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If you're tired of arguing with strangers on the Internet,",
      "start": 138.1,
      "end": 141.4,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "try to talk with one in real life.",
      "start": 141.4,
      "end": 144.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If something needs fixing,",
      "start": 144.0,
      "end": 146.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "lace up your shoes and do some organizing.",
      "start": 146.0,
      "end": 149.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself.",
      "start": 149.3,
      "end": 156.8,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Our success depends on our participation, regardless of which way the pendulum of power swings.",
      "start": 156.8,
      "end": 165.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It falls on each of us to be guardians of our democracy.",
      "start": 165.3,
      "end": 168.5,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "to embrace the joyous task we've been given to continually try to improve this great nation of ours.",
      "start": 168.5,
      "end": 174.6,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Because for all our outward differences, we all share the same proud title, citizen.",
      "start": 175.4,
      "end": 181.7,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "It has been the honor of my life to serve you as president.",
      "start": 182.7,
      "end": 186.0,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Eight years later, I am even more optimistic about our country's promise,",
      "start": 186.9,
      "end": 190.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "and I look forward to working along your side as a citizen for all my days that remain.",
      "start": 190.3,
      "end": 197.3,
      "speaker_id": null,
      "type": "transcription_segment"
    },
    {
      "text": "Thanks, everybody. God bless you, and God bless the United States of America.",
      "start": 198.5,
      "end": 203.4,
      "speaker_id": null,
      "type": "transcription_segment"
    }
  ],
  "usage": {
    "prompt_audio_seconds": 203,
    "prompt_tokens": 4,
    "total_tokens": 3945,
    "completion_tokens": 1316
  }
}

Biais de contexte

Fournissez jusqu’à 100 mots ou expressions pour guider le modèle vers l’orthographe correcte de noms, de termes techniques ou d’un vocabulaire métier. Particulièrement utile pour les noms propres ou la terminologie sectorielle que les modèles standard manquent souvent. Le biais de contexte est optimisé pour l’anglais ; la prise en charge des autres langues est expérimentale.

# Not available in the V1 SDK (mistralai 1.x).
# This feature requires the V2 SDK: pip install "mistralai>=2", then use the V2 tab.
# Migration guide: https://docs.mistral.ai/resources/migration-guides
Sortie
{
    "model":"voxtral-mini-latest",
    "text":"This week, I traveled to Chicago to deliver my final farewell_address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, My conversations with you, the American_people, in living rooms, in schools, at farms, and on factory floors, at diners, and on distant military outposts, all these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better president, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer_survivors who finally know the security of affordable_health_care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American-spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers, and I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded_warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees, to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work_of_citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy, to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title, citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise, and I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you, and God bless the United States of America.",
    "language":null,
    "segments":[],
    "usage":
        {
            "prompt_audio_seconds":203,
            "prompt_tokens":70,
            "total_tokens":716,
            "completion_tokens":646,
            "request_count":1,
            "num_cached_tokens":0
        },
        "type":"transcription.done"
}

Compatibilité avec le SDK OpenAI

L’endpoint de transcription de Mistral suit la même structure de requête que l’API de transcription audio d’OpenAI. Vous pouvez utiliser le SDK OpenAI en le faisant pointer vers l’URL de base de Mistral et en changeant le nom du modèle.

exclamationMark

Nous ne recommandons pas d’utiliser le SDK OpenAI sur le long terme. Cette couche de compatibilité vise les tests rapides et le prototypage. En production, nous recommandons d’utiliser le SDK Mistral pour bénéficier de toutes les fonctionnalités.

Tableau de compatibilité

Feature

Compatible avec le SDK OpenAI

Transcription de base (file)Yes
Spécification de la langue (language)Yes
Granularité des horodatages (timestamp_granularities)Yes
Streaming (stream)Yes
Diarisation (diarize)Oui, avec extra_body
Biais de contexte (context_bias)Oui, avec extra_body
Entrée par URL audio (file_url)Non (non pris en charge)

Examples

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MISTRAL_API_KEY"],
    base_url="https://api.mistral.ai/v1",
)

with open("/path/to/file/audio.mp3", "rb") as f:
    transcription = client.audio.transcriptions.create(
        model="voxtral-mini-latest",
        file=f,
        extra_body={"diarize": True, "context_bias": ["bias1", "bias2"]}
    )

print(transcription.text)
pen

Le SDK OpenAI ne prend pas en charge nativement les paramètres propres à Mistral (diarize, context_bias). Utilisez le SDK Mistral pour ces fonctionnalités, ou transmettez-les via le paramètre extra_body.

FAQ

La durée maximale dépend de l’endpoint utilisé ; les limites actuelles sont les suivantes :

lightbulb

Voici quelques conseils si vous devez traiter des fichiers audio plus longs :

  • Divisez l’audio en segments plus courts : transcrivez chaque segment séparément. Sachez toutefois que cela peut entraîner une perte de contexte, des difficultés à découper l’audio aux pauses naturelles (par exemple en milieu de phrase) et la nécessité de combiner les transcriptions ensuite.
  • Augmentez la vitesse de lecture : envoyez le fichier à un rythme plus rapide en accélérant l’audio. Gardez à l’esprit que cela peut dégrader la qualité audio et nécessiter d’ajuster les horodatages de la transcription pour les aligner sur le fichier audio d’origine.