Create image embeddings
This guide shows how you can create image embeddings.
The following table lists the available models for generating text embeddings and their key characteristics:
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.
To create an embedding for an image, you must specify at least the following parameters:
model_name
: The name of the video understanding model you want to use.image_url
orimage_file
: The publicly accessible URL of your image file or the path of your image file. You must provide at least one of these parameters. If you specify both in the same request, theimage_url
parameter takes precedence.
The response is an object containing the following fields:
model_name
: The name of the engine the platform has used to create this embedding.image_embedding
: An object that contains the embedding and additional information.
For a description of each field in the request and response, see the Create embeddings for text, image, and audio page.
Prerequisites
- You’re familiar with the concepts that are described on the Platform overview page.
- You have an API key. To retrieve your API key, navigate to the API Key page and log in with your credentials. Then, select the Copy icon to the right of your API key to copy it to your clipboard.
- The images you wish to use must meet the following requirements:
- Format: JPEG and PNG.
- Dimension: Must be at least 128 x 128 pixels.
- Size: Must not exceed 5MB.
Example
The example code below creates an image embedding. Ensure you replace the placeholders surrounded by <>
with your values.