Skip to content

Add MARENGO search mode using TwelveLabs embeddings#9

Open
mohit-twelvelabs wants to merge 1 commit into
RameshAditya:masterfrom
mohit-twelvelabs:feat/twelvelabs-integration
Open

Add MARENGO search mode using TwelveLabs embeddings#9
mohit-twelvelabs wants to merge 1 commit into
RameshAditya:masterfrom
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 MARENGO search mode to Scoper, alongside the existing FUZZY and SEMANTIC modes.

What it adds

  • A new MARENGO mode that ranks a video's captions by cosine similarity of TwelveLabs Marengo multimodal embeddings (512-dim) — both the query and each caption are embedded into a shared space and ranked.
  • Wired into the existing get_timestamp dispatch, the CLI --mode choices (MARENGO/M), and the web GUI algorithm dropdown.
  • README section + an optional twelvelabs entry in requirements.txt.
  • Tests in test_marengo.py: an offline cosine-ranking test (network stubbed) and a live 512-dim embedding test that is skipped unless TWELVELABS_API_KEY is set.

Why it helps

The existing SEMANTIC mode trains Word2Vec on the Brown corpus, so it only "knows" words in that vocabulary and needs a custom dataset for anything else. Marengo embeds the full query/caption text with no model to train, handling out-of-vocabulary words, phrasing, and intent much better — a natural upgrade for the project's semantic-search goal.

Opt-in / non-breaking

The default mode stays FUZZY, and SEMANTIC is untouched. The TwelveLabs client is created lazily on first use, so neither the twelvelabs package nor an API key is required unless someone explicitly selects MARENGO. Existing behaviour and dependencies are unchanged.

How it was tested

  • pytest test_marengo.py — offline ranking test passes; live test passes against the real API (confirmed a real text embedding is a 512-dim vector). With no key set, the live test skips cleanly.
  • Verified the module imports and pyflakes is clean on the changed files.

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

Adds an opt-in MARENGO mode that ranks captions by cosine similarity of
TwelveLabs Marengo (512-dim) text embeddings, alongside the existing
FUZZY and SEMANTIC modes. The TwelveLabs client is created lazily so the
twelvelabs package and TWELVELABS_API_KEY are only required when MARENGO
is selected; FUZZY/SEMANTIC behaviour is unchanged.

Wires the mode into the CLI choices and the web GUI dropdown, documents
it in the README, lists twelvelabs as an optional requirement, and adds
tests (offline cosine-ranking test plus a live test skipped without a key).
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