Create embeddings for text, image, and audio
This method creates embedings for text, image, and audio content.
Before you create an embedding, ensure that the following prerequisites are met:
Parameters for embeddings:
- Common parameters:
engine_name
: The video understanding engine you want to use. Example: “Marengo-retrieval-2.6”.
- Text embeddings:
text
: Text for which to create an embedding.
- Image embeddings:
Provide one of the following:
image_url
: Publicly accessible URL of your image file.image_file
: Local image file.
- Audio embeddings:
Provide one of the following:
audio_url
: Publicly accessible URL of your audio file.audio_file
: Local audio file.
Notes
- The “Marengo-retrieval-2.6” video understanding engine generates embeddings for all modalities in the same latent space. This shared space enables any-to-any searches across different types of content.
- You can create multiple types of embeddings in a single API call.
- Audio embeddings combine generic sound and human speech in a single embedding. For videos with transcriptions, you can retrieve transcriptions and then create text embeddings from these transcriptions.
Important
The response includes breaking changes that might require updates to your application code. Common changes:
- The
is_success
boolean flag has been removed.
Media-specific changes:
- Text and audio: The embedding vectors are now nested under an array named
segments
.
Headers
Request
The name of the engine you want to use. The following engines are available:
Marengo-retrieval-2.6
The text for which you wish to create an embedding.
<Note title=“Note”>
Text embeddings are limited to 77 tokens. If the text exceeds this limit, the platform truncates it according to the value of the text_truncate
parameter described below.
</Note
Example: “Man with a dog crossing the street”
Specifies how the platform truncates text that exceeds 77 tokens to fit the maximum length allowed for an embedding. This parameter can take one of the following values:
start
: The platform will truncate the start of the provided text.end
: The platform will truncate the end of the provided text.none
: The platform will return an error if the text is longer than the maximum token limit.
Default: end
The publicly accessible URL of the image for which you wish to create an embedding. This parameter is required for image embeddings if image_file
is not provided.
The publicly accessible URL of the audio file for which you wish to creae an emebdding. This parameter is required for audio embeddings if audio_file
is not provided.
Specifies the start time, in seconds, from which the platform generates the audio embeddings. This parameter allows you to skip the initial portion of the audio during processing.
Default: 0
.
Response
A text embedding has successfully been created.