Skip to content

feat: add TwelveLabs Pegasus client for whole-video analysis - #70

Open
mohit-twelvelabs wants to merge 1 commit into
byjlw:mainfrom
mohit-twelvelabs:feat/twelvelabs-integration
Open

feat: add TwelveLabs Pegasus client for whole-video analysis#70
mohit-twelvelabs wants to merge 1 commit into
byjlw:mainfrom
mohit-twelvelabs:feat/twelvelabs-integration

Conversation

@mohit-twelvelabs

Copy link
Copy Markdown

Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).

What this adds

An opt-in twelvelabs client backed by Pegasus, TwelveLabs' video understanding model. Pegasus ingests an entire video in a single call and reasons jointly over its visuals, motion, and audio. When this client is selected, the frame-extraction, Whisper transcription, and reconstruction stages are bypassed — Pegasus produces the description directly from the video (a local file or a public URL).

video-analyzer video.mp4 --client twelvelabs --api-key your-key

Why it helps

It collapses the project's three-stage LLM + CV + ASR pipeline into one API call: no local GPU/Ollama, no Whisper download, no frame sampling. This is a fast, low-setup alternative for users who want a high-quality whole-video description, while everything that exists today stays exactly as-is.

Opt-in / non-breaking

  • New client is wired into the registry and config the same way as ollama and openai_api. Defaults are unchanged (ollama remains the default).
  • The twelvelabs SDK is an optional dependency, imported lazily — it's only needed if you actually select this client, with a clear error message if it's missing.
  • Output is written to the same analysis.json shape, so existing tooling/UI keeps working.

How it was tested

  • No-network unit tests for URL/path detection, empty-key handling, and the unsupported per-frame generate() path.
  • A live end-to-end Pegasus test (gated on TWELVELABS_API_KEY, skipped when unset) that analyzes a public sample video and asserts a non-empty description. Verified locally against twelvelabs==1.2.8.
  • Config resolution verified for the new client (key routing, model defaults, missing-block fallback).

You can grab a free API key at https://twelvelabs.io — there's a generous free tier.

Add an opt-in 'twelvelabs' client that analyzes an entire video in a
single Pegasus call, bypassing the frame-extraction, transcription, and
reconstruction stages. Wired into the client registry and config the
same way as the existing ollama and openai_api clients; defaults are
unchanged. The twelvelabs SDK is an optional dependency, imported lazily.

Adds unit tests (no network) and a live Pegasus test gated on
TWELVELABS_API_KEY, plus README setup docs.
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