Overview
Performs speech recognition using Groq’s ultra-fast Whisper API. Groq provides extremely fast inference speeds for Whisper models with high accuracy.Method Signature
Parameters
The audio data to recognize. Must be an
AudioData instance.Groq Whisper model to use:
"whisper-large-v3-turbo"- Faster, optimized model (recommended)"whisper-large-v3"- Full large model for maximum accuracy
Input language as an ISO-639-1 code (e.g.,
"en", "es", "fr", "de").Specifying the language improves accuracy and reduces latency. If not specified, the model will auto-detect.Optional text to guide the model’s style or continue a previous audio segment. The prompt should match the audio language.Useful for:
- Specifying spelling of uncommon words
- Providing context about the audio content
- Maintaining consistency across multiple segments
Format of the response. Default is
"json".Sampling temperature between 0 and 1. Higher values make output more random, lower values make it more focused and deterministic.
Return Value
The transcribed text from the audio.
Exceptions
Raised if the speech is unintelligible or the API returns an empty transcription.
Raised if the API request fails, the API key is invalid, or there is a network error.
Raised if the
groq package is not installed.Setup
Installation
Install the Groq package:API Key
- Visit Groq Console
- Go to API Keys menu
- Generate a new API key
- Set the environment variable:
Examples
Basic Usage
With Specific Language
From Audio File
With Prompt for Context
Using Different Models
Performance
Groq provides exceptionally fast inference speeds:- whisper-large-v3-turbo: Optimized for speed while maintaining high accuracy
- whisper-large-v3: Full model with maximum accuracy
Language Support
Supports 99 languages including:- English (en)
- Spanish (es)
- French (fr)
- German (de)
- Italian (it)
- Portuguese (pt)
- Dutch (nl)
- Russian (ru)
- Chinese (zh)
- Japanese (ja)
- Korean (ko)
- And many more…
Best Practices
Groq requires an API key. The service has generous free tier limits but requires account setup.
Related Methods
recognize_openai()- OpenAI’s official Whisper APIrecognize_whisper()- Local offline Whisper recognitionrecognize_faster_whisper()- Faster local Whisper with CTranslate2