Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Whisper transcription support with speech_recognition fallback #326

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AlexZhangji
Copy link

@AlexZhangji AlexZhangji commented Feb 12, 2025

Changes

  • Added OpenAI Whisper support for audio transcription in WavConverter and Mp3Converter
  • Implemented automatic fallback to speech_recognition if Whisper fails or non-OpenAI client passed in.
  • Added audio transcription tests (commented out by default) with a short test.wav.

Usage

from markitdown import MarkItDown
from openai import OpenAI

client = OpenAI()  
md = MarkItDown(llm_client=client)

result = md.convert("audio.wav")  # or "audio.mp3"
print(result.text_content)
# Output: ### Audio Transcript (Whisper):
#         <transcription content in markdown>

@AlexZhangji
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant