Skip to content

feat: add opt-in TwelveLabs backend (Marengo search + Pegasus answers)#9

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

feat: add opt-in TwelveLabs backend (Marengo search + Pegasus answers)#9
mohit-twelvelabs wants to merge 1 commit into
video-db:mainfrom
mohit-twelvelabs:feat/twelvelabs-integration

Conversation

@mohit-twelvelabs

Copy link
Copy Markdown

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

This PR adds an opt-in alternative backend for StreamRAG powered by TwelveLabs, so the same GPT/agent can run on TwelveLabs' video-native models:

  • Marengo for retrieval — multimodal (visual + audio) search over your index, powering /search.
  • Pegasus for answers — video understanding generates per-video summaries for /video/{id}.

Why it helps

StreamRAG is a video search agent; TwelveLabs is purpose-built for video understanding and multimodal retrieval. This gives users a second backend option without changing the GPT prompt or openapi.yaml — the provider returns the exact same {compilationVideo, chunks} / {video: {...}} shapes the existing routes return.

Opt-in / non-breaking

  • Activated only when VIDEO_SEARCH_PROVIDER=twelvelabs is set. Unset (the default) keeps the existing VideoDB behavior completely untouched — twelvelabs_provider isn't even imported.
  • New config lives in .env.sample; twelvelabs==1.2.8 added to requirements.txt.

How it was tested

  • python -m unittest test_twelvelabs_provider — unit tests (mocked SDK, no network) verify the VideoDB-compatible response shapes and search/analyze wiring.
  • Live tests (gated on TWELVELABS_API_KEY + TWELVELABS_INDEX_ID, skipped otherwise) were run against the real API: Marengo text embedding (512-dim), Marengo search, and a Pegasus answer all succeed.

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

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