Create embeddings for text, image, and audio

POST

This method creates embeddings for text, image, and audio content.

Before you create an embedding, ensure that the following prerequisites are met:

Parameters for embeddings:

  • Common parameters:
    • model_name: The video understanding model you want to use. Example: “Marengo-retrieval-2.7”.
  • 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.7” 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.
  • 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.

Request

This endpoint expects a multipart form with multiple files.
model_namestringRequired

The name of the model you want to use. The following models are available:

  • Marengo-retrieval-2.7
textstringOptional

The text for which you wish to create an embedding.

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.

Example: “Man with a dog crossing the street”

text_truncatestringOptionalDefaults to end

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

image_urlstringOptionalformat: "uri"

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.

image_filefileOptional
audio_urlstringOptionalformat: "uri"

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.

audio_filefileOptional
audio_start_offset_secdoubleOptionalDefaults to 0

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.

Audio Embedding Responseobject or null
OR
Image Embedding Responseobject or null
OR
Text Embedding Responseobject or null

Errors

Built with