0

Audio fact-checking agent

A demo which checks an audio stream for factual assertions, checking each against a source of truth. Click Start, talk, and enjoy!

Example · مثال

Content

Audio fact-checking agent

A demo which checks an audio stream for factual assertions, checking each against a source of truth. Click Start, talk, and enjoy!

We use Mistral's real-time transcription API, plus its chat and embeddings APIs. We capture microphone audio continuously via an AudioWorklet, streaming it to our little server in 200ms chunks over a WebSocket.

Setup

Requires uv. Dependencies install automatically on first run, or install them up front with:

uv sync

To complete this cookbook, you'll need a Mistral API key. In Studio, navigate to the API keys section and create a new API key.

Create a .env at the root of your project and add your Mistral API key:

MISTRAL_API_KEY=your-mistral-api-key

Run

This command starts both your Python server and your web server:

uv run server.py

Then open http://127.0.0.1:8000, click Start, and allow microphone access when your browser asks.

How it works

  • web/audio-processor.js runs on the browser's own audio thread, capturing raw microphone samples as they arrive.
  • web/app.js buffers those into 200ms chunks and streams them to the server over a WebSocket, then renders whatever JSON messages come back.
  • server.py forwards the audio to Mistral's real-time transcription API, splits the growing transcript into sentences, and checks each one that looks like a factual claim against FACTS - pushing the live transcript and each verdict back to the browser as JSON as soon as it's ready.
  • The FACTS list at the top of server.py is our source of truth.

Source and license

Source
Mistral Cookbook
Original
mistralai/cookbook/mistral/audio/realtime-fact-checker
License
MIT