For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sample appsIntegrationsDiscordPlaygroundDevEx repo
GuidesSDK ReferenceAPI Reference
GuidesSDK ReferenceAPI Reference
  • Get Started
    • Introduction
    • Quickstart
    • Manage your plan
    • Rate limits
    • Release notes
    • Migration guide
  • Guides
    • Search
    • Analyze videos
    • Segment videos
    • Create embeddings
  • Concepts
    • Models
    • Upload and processing methods
    • Indexes
    • Modalities
    • Multimodal large language models
  • Cloud partner integrations
    • Amazon Bedrock
  • Advanced
    • Organizations
    • Fine-tuning
    • Webhooks
    • Metadata
    • Model context protocol
    • Claude Code Plugin
  • Resources
    • Platform overview
    • Playground
    • TwelveLabs SDKs
    • Frequently asked questions
    • Use cases
    • Sample applications
    • Partner integrations
      • Adobe Premiere Pro Plugin
      • ApertureDB - Semantic video search engine
      • Backblaze B2 - Media management application
      • Chroma - Multimodal RAG: Chat with Videos
      • Databricks - Advanced video understanding
      • LanceDB - Building advanced video understanding applications
      • Langflow - Building smart video agents
      • Milvus - Advanced video search
      • MindsDB - The TwelveLabs handler
      • MongoDB - Semantic video search
      • Oracle - Unleashing Video Intelligence
      • Pinecone - Multimodal RAG
      • Qdrant - Building a semantic video search workflow
      • Snowflake - Multimodal Video Understanding
      • Vespa - Multivector video retrieval
      • VideoDB - Real-time video understanding
      • Voxel51 - Semantic video search plugin
      • Weaviate - Leveraging RAG for Improved Video Processing Times
    • From the community
LogoLogo
Sample appsIntegrationsDiscordPlaygroundDevEx repo
On this page
  • Integration with TwelveLabs
  • Video embeddings
  • Text embeddings
  • Next steps
ResourcesPartner integrations

LanceDB - Building advanced video understanding applications

Was this page helpful?
Previous

Langflow - Building smart video agents

Next
Built with

Summary: This integration allows you to create advanced video understanding and retrieval applications. It combines two key components:

  • TwelveLabs’ Embed API: Generates multimodal embeddings for video content and text.
  • LanceDB: A serverless vector database that stores, indexes, and queries high-dimensional vectors at scale.

Key use cases include:

  • Semantic video search engines
  • Content-based recommendation systems
  • Anomaly detection in video streams.

Description: The process of performing a semantic video search using Twleve Labs and LanceDB involves two main steps:

  1. Use the Embed API to create multimodal embeddings for video content and text queries.
  2. Use the embeddings to perform similarity searches in LanceDB.

Code explanation: Our blog post, Building Advanced Video Understanding ApplicationsL Integrating TwelveLabs Embed API with LanceDB for Multimodal AI, guides you through the process of creating a video search application, from setup to generating video embeddings and querying them efficiently.
Colab Notebook: TwelveLabs-EmbedAPI-LanceDB

Integration with TwelveLabs

This section describes how you can use the TwelveLabs Python SDK to create embeddings for videos and text queries.

Video embeddings

The generate_embedding function takes the URL of a video as a parameter and returns a list of dictionaries, each containing an embedding vector and the associated metadata:

Node.js
1from twelvelabs.models.embed import EmbeddingsTask
2
3def generate_embedding(video_url: str) -> tuple[List[Dict[str, Any]], Any]:
4 """Generate embeddings for a given video URL."""
5 task = twelvelabs_client.embed.task.create(
6 engine_name="Marengo-retrieval-2.7",
7 video_url=video_url
8 )
9
10 def on_task_update(task: EmbeddingsTask):
11 print(f" Status={task.status}")
12
13 task.wait_for_done(sleep_interval=2, callback=on_task_update)
14 task_result = twelvelabs_client.embed.task.retrieve(task.id)
15
16 embeddings = [{
17 'embedding': v.embedding.float,
18 'start_offset_sec': v.start_offset_sec,
19 'end_offset_sec': v.end_offset_sec,
20 'embedding_scope': v.embedding_scope
21 } for v in task_result.video_embeddings]
22
23 return embeddings, task_result

For more details, see the Create video embeddings page.

Text embeddings

The get_text_embedding function generates embeddings for text queries:

Node.js
1def get_text_embedding(text_query: str) -> List[float]:
2 """Generate a text embedding for a given text query."""
3 return twelvelabs_client.embed.text(text_query).embedding.float

For more details, see the Create text embeddings page.

Next steps

After reading this page, you have the following options:

  • Customize and use the example: Use the TwelveLabs-EmbedAPI-LanceDB notebook to understand how the integration works. You can make changes and add more functionalities to suit your specific use case. Some notable examples include:
    • Explore advanced features in LanceDB like hybrid search combining vector and metadata filtering.
    • Implement a continuous user feedback loop to improve your search and recommendation results.
  • Explore further: Try the applications built by the community or our sample applications to get more insights into the TwelveLabs Video Understanding Platform’s diverse capabilities and learn more about integrating the platform into your applications.