feat: Add TwelveLabs Pegasus video-to-Markdown converter#2161
Open
mohit-twelvelabs wants to merge 1 commit into
Open
feat: Add TwelveLabs Pegasus video-to-Markdown converter#2161mohit-twelvelabs wants to merge 1 commit into
mohit-twelvelabs wants to merge 1 commit into
Conversation
Adds an opt-in converter that uses the TwelveLabs Pegasus video-understanding model to convert video files (.mp4, .mov, .webm, .mkv, .avi, .m4v) to Markdown. Unlike the speech-only built-in AudioConverter, Pegasus reads the actual frames and audio, so the output can also describe visual scenes and on-screen action. The converter is only registered when a TwelveLabs API key is provided (via the twelvelabs_api_key argument or the TWELVELABS_API_KEY environment variable), so default behavior is unchanged. Adds a --use-twelvelabs CLI flag, the optional [twelvelabs] dependency, README docs, and tests (mocked unit tests plus a live API smoke test gated on TWELVELABS_API_KEY).
|
@mohit-twelvelabs please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).
What this adds
An opt-in
TwelveLabsConverterthat converts video files to Markdown using the TwelveLabs Pegasus video-understanding model.The built-in
AudioConverteronly transcribes speech from a video. Pegasus reads the actual frames and audio, so the resulting Markdown can also describe visual scenes, on-screen action, and structure — not just what's spoken. This fits MarkItDown's goal of turning media into LLM-ready text..mp4,.mov,.webm,.mkv,.avi,.m4v.--use-twelvelabsCLI flag (plus--twelvelabs-model/--twelvelabs-prompt), reading theTWELVELABS_API_KEYenv var.MarkItDown(twelvelabs_api_key="...", twelvelabs_prompt="...").[twelvelabs]; README documented.Why it's opt-in / non-breaking
The converter is only registered when an API key is supplied (via the
twelvelabs_api_keyargument orTWELVELABS_API_KEY), mirroring the existing Document Intelligence / Content Understanding converters. With no key set, nothing changes — all other formats keep using their existing converters, andtwelvelabsis an optional dependency guarded byMissingDependencyException.How it was tested
tests/test_twelvelabs_converter.py: mocked unit tests foraccepts()routing,convert()request wiring (model/prompt/max_tokens/base64 video), stream-position restoration, missing-dependency and missing-key error paths, and registration on/off based on the key. 25 passed, plus a live API smoke test gated onTWELVELABS_API_KEY(skipped in CI).black(pinned 23.7.0) andmypyclean on the new files.You can grab a free API key at https://twelvelabs.io — there's a generous free tier.
Note: this is a first-time contribution to this repo, so the Microsoft CLA bot will likely ask me to sign the CLA — happy to do so.