Create sync embeddings
The EmbedClient.V2Client class provides methods to create embeddings synchronously for multimodal content, returning embeddings immediately in the response.
Methods
Create sync embeddings
Description: This method synchronously creates embeddings for multimodal content and returns the results immediately in the response.
Use this method to embed a query for retrieving matching content. With Marengo 3.5, audio and video can be up to 30 seconds. With Marengo 3.0, they can be up to 10 minutes. For longer content, use the embed.v_2.tasks.create method instead.
The content this method accepts depends on the model. With Marengo 3.5, this method accepts only the multi_input input type; provide text, images, audio, or video as media sources. With Marengo 3.0, use the individual input types. For the formats, resolutions, file sizes, and duration limits each model accepts, see the input requirements for Marengo 3.5 or Marengo 3.0.
This method is rate-limited. With Marengo 3.5, the platform counts input tokens for each type of content. A request can exceed a limit before you see an error. For details, see Input token limits for embedding.
Function signature and example
Parameters
TextInputRequest
The TextInputRequest class specifies the configuration for processing text content. Required when input_type is text.
ImageInputRequest
The ImageInputRequest class specifies the configuration for processing image content. Required when input_type is image.
TextImageInputRequest
The TextImageInputRequest class specifies the configuration for processing combined text and image content. Required when input_type is text_image.
AudioInputRequest
The AudioInputRequest class specifies the configuration for processing audio content. Required when input_type is audio.
VideoInputRequest
The VideoInputRequest class specifies the configuration for processing video content. Required when input_type is video.
MultiInputRequest
The MultiInputRequest class specifies the configuration for processing text and media sources. Required when input_type is multi_input.
Marengo 3.5 accepts images, video, and audio as media sources. Marengo 3.0 accepts images.
Include text in the input_text field when you combine media sources of different types. For example, a request that combines an image and a video returns a 400 error without text. Media sources of the same type do not require text.
MediaSource
The MediaSource class specifies the source of the media file. Provide exactly one of the following:
MultiInputMediaSource
A class specifying a media source for multi-input embeddings. You must provide exactly one of the url, base_64_string, or asset_id fields. With Marengo 3.5, each media source can be up to 32 MB, whichever of the three fields you use. Audio and video can be up to 30 seconds. Content above either limit returns a 400 error.
AudioSegmentation
The AudioSegmentation class specifies how the platform divides the audio into segments using fixed-length intervals.
AudioSegmentationFixed
The AudioSegmentationFixed class configures fixed-length segmentation for audio.
VideoSegmentation
The VideoSegmentation type specifies how the platform divides the video into segments. Use one of the following:
Fixed segmentation: Divides the video into equal-length segments:
Dynamic segmentation: Divides the video into adaptive segments based on scene changes:
VideoSegmentationFixedFixed
The VideoSegmentationFixedFixed class configures fixed-length segmentation for video.
VideoSegmentationDynamicDynamic
The VideoSegmentationDynamicDynamic class configures dynamic segmentation for video based on scene changes.
Return value
Returns an EmbeddingSuccessResponse object containing the embedding results.
The EmbeddingSuccessResponse class contains the following properties:
The EmbeddingData class contains the following properties:
EmbeddingUsage
The EmbeddingUsage class provides token counts for the request. Only Marengo 3.5 returns this object.
EmbeddingMediaMetadata
The EmbeddingMediaMetadata type provides metadata for the media input. Available for the image, text_image, audio, video, and multi_input input types. The input_type field selects one variant:
Image: Metadata for image embeddings.
Text and image: Metadata for text-image embeddings.
Audio: Metadata for audio embeddings.
Video: Metadata for video embeddings.
Multi-input: Metadata for multi-input embeddings.