Text embeddings
This guide shows how you can create text embeddings using the Marengo video understanding model. For a list of available versions, complete specifications and input requirements for each version, see the Marengo page.
The Marengo video understanding model generates embeddings for all modalities in the same latent space. This shared space enables any-to-any searches across different types of content.
For details on how your usage is measured and billed, see the Pricing page.
Key concepts
This section explains the key concepts and terminology used in this guide:
- Embedding: Vector representation of your content.
Workflow
To create text embeddings, you provide text directly to the platform. The platform processes text synchronously, and the embeddings are available immediately.
Prerequisites
-
To use the platform, you need an API key:
-
Depending on the programming language you are using, install the TwelveLabs SDK by entering one of the following commands:
Complete example
Copy and paste the code below, replacing the placeholders surrounded by <> with your values.
Code explanation
Python
Node.js
Import the SDK and initialize the client
Create a client instance to interact with the TwelveLabs Video Understanding Platform.
Function call: You call the constructor of the TwelveLabs class.
Parameters:
api_key: The API key to authenticate your requests to the platform.
Return value: An object of type TwelveLabs configured for making API calls.
Create text embeddings
Function call: You call the embed.v_2.create function.
Parameters:
input_type: The type of content. Set this parameter totext.model_name: The model you want to use. This example usesmarengo3.0.text: ATextInputRequestobject containing the following properties:input_text: The text for which you wish to create an embedding.
Return value: An object of type EmbeddingSuccessResponse containing a field named data, which is a list of embedding objects. Each embedding object includes the following fields:
embedding: An array of floats representing the embedding vector.embedding_option: The type of embedding generated.