Migrate from Marengo 3.0 to Marengo 3.5
This guide shows how to migrate your embedding calls to Marengo 3.5. It focuses on SDK migrations, but it also includes cURL examples for the capabilities that Marengo 3.5 adds.
Marengo 3.0 continues to work without changes. The platform uses it when you omit the model_name parameter. Migrate when you want the capabilities that Marengo 3.5 adds.
Note
Marengo 3.5 embeddings are not compatible with Marengo 3.0 embeddings. To move to Marengo 3.5, regenerate your embeddings with Marengo 3.5.
Migration steps
Update your Python input classes
Skip this step if you use the Node.js SDK, or if you do not type-check your Python code.
In the Python SDK, the AsyncVideoInputRequest and AsyncAudioInputRequest classes replace VideoInputRequest and AudioInputRequest on the embed.v_2.tasks.create method. The SDK accepts both the old and the new classes, so your existing code continues to work after you upgrade. Update it to clear the type-checker errors.
Before:
After:
Update your synchronous calls
Marengo 3.5 accepts a single input type on the synchronous method: multi_input. Replace the per-type input objects with a single combined input. Provide your text, your media sources, or both.
Marengo 3.0 accepts images as media sources. Marengo 3.5 also accepts video and audio.
Python
Node.js
Set the input_type parameter to multi_input and pass a MultiInputRequest object to the multi_input parameter.
Before:
After:
To embed an image, pass a MultiInputMediaSource object in the media_sources field instead of using the image parameter.
Note
With Marengo 3.5, video and audio can be up to 30 seconds on the synchronous method. For longer files, use the asynchronous method. Your text can be up to 2,000 tokens. Media sources do not count toward this limit, and each media source can be up to 32 MB. Set the auto_truncate parameter to true to truncate text above this limit instead of receiving a 400 error.
Update your asynchronous calls
Set the model to Marengo 3.5. This version also accepts documents and images as input types.
Marengo 3.5 changes two defaults. For video, the embedding_option field defaults to ["visual", "audio"] instead of ["visual", "audio", "transcription"]. For audio, it defaults to ["audio"] instead of ["audio", "transcription"]. The transcription value requires Marengo 3.0. With Marengo 3.5, the audio value includes speech, music, and non-dialog audio.
Marengo 3.5 also changes the structure of the segmentation field. Place your settings in a temporal object. For details, see the Video embeddings guide.
Python
Node.js
In this example, the model name is the only change.
Before:
After:
Regenerate your embeddings
Marengo 3.5 embeddings are not compatible with Marengo 3.0 embeddings. To move to Marengo 3.5, regenerate your embeddings with Marengo 3.5.
Re-embed the same source content with Marengo 3.5. Keep the two sets of embeddings apart until the new set is complete. Then point your application at the new set. For step-by-step instructions, see the Embed content at scale guides.
Use new Marengo 3.5 features
The following examples show each new capability.
Composed queries with video and audio
Combine text with up to 10 media sources into a single embedding. Marengo 3.0 accepts images as media sources. Marengo 3.5 also accepts video and audio. Reference a media source from your text with the <@name> format.
Python
Node.js
cURL
Document embeddings
Create embeddings from a PDF file. Set the embedding_scope field to the local scope for one embedding per page. Documents require the asynchronous method.
Python
Node.js
cURL
Time-based metadata fusion
Fold your own time-aligned text, such as a stats feed, into the fused embedding of the segments it overlaps in time. This capability requires the fused_embedding value in the embedding_type field, and it applies to audio and video on the asynchronous method.
Python
Node.js
cURL
Embedding uncertainty
Set the embedding_uncertainty parameter to true to receive a per-dimension uncertainty vector alongside each embedding. A higher value shows lower confidence in that dimension.
On the synchronous method, set this parameter to true only when your request embeds text only, or media only. On the asynchronous method with audio or video input, exclude the asset scope from the embedding_scope field. For details, see the Embed a query and Embed content at scale guides.
Token usage
Responses from Marengo 3.5 include a new object named usage that shows the token counts for your request.
Automatic truncation
Set the auto_truncate parameter to true to truncate text above the 2,000-token limit instead of receiving a 400 error. When the platform truncates your text, it sets the usage.truncated field to true in the response.