Create async embeddings

The EmbedClient.V2Client.TasksClient class provides methods to create embeddings asynchronously for audio, video, images, and documents.

Creating embeddings asynchronously requires three steps:

  1. Create a task using the create method. The platform returns a task ID.
  2. Poll for the status of the task using the retrieve method. Wait until the status is ready.
  3. Retrieve the embeddings from the response when the status is ready using the retrieve method.

Methods

List embedding tasks

Description: This method returns a list of the async embedding tasks in your account. The platform returns your async embedding tasks sorted by creation date, with the newest at the top of the list.

Notes
  • Embeddings are stored for seven days.
  • When you invoke this method without specifying the started_at and ended_at parameters, the platform returns all the async embedding tasks created within the last seven days.

Function signature and example:

1def list(
2 self,
3 *,
4 started_at: typing.Optional[str] = None,
5 ended_at: typing.Optional[str] = None,
6 status: typing.Optional[str] = None,
7 page: typing.Optional[int] = None,
8 page_limit: typing.Optional[int] = None,
9 request_options: typing.Optional[RequestOptions] = None,
10) -> SyncPager[MediaEmbeddingTask]

Parameters

NameTypeRequiredDescription
started_atstrNoRetrieve the embedding tasks that were created after the specified date and time, expressed in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”).
ended_atstrNoRetrieve the embedding tasks that were created before the specified date and time, expressed in the RFC 3339 format (“YYYY-MM-DDTHH:mm:ssZ”).
statusstrNoFilter the embedding tasks by their current status. Values: processing, ready, or failed.
pageintNoA number that identifies the page to retrieve. Default: 1.
page_limitintNoThe number of items to return on each page. Default: 10. Max: 50.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value

Returns a SyncPager[MediaEmbeddingTask] object that allows you to iterate through the paginated task results.

The SyncPager[T] class contains the following properties and methods:

NameTypeDescription
itemsOptional[List[T]]A list containing the current page of items. Can be None.
has_nextboolIndicates whether there is a next page to load.
get_nextOptional[Callable[[], Optional[SyncPager[T]]]]A callable function that retrieves the next page. Can be None.
responseOptional[BaseHttpResponse]The HTTP response object. Can be None.
next_page()Optional[SyncPager[T]]Calls get_next() if available and returns the next page object.
__iter__()Iterator[T]Allows iteration through all items across all pages using for loops.
iter_pages()Iterator[SyncPager[T]]Allows iteration through page objects themselves.

The MediaEmbeddingTask class contains the following properties:

NameTypeDescription
idOptional[str]The unique identifier of the embedding task.
model_nameOptional[str]The name of the video understanding model the platform used to create the embedding.
statusOptional[str]A string indicating the status of the embedding task. It can take one of the following values: processing, ready or failed.
created_atOptional[datetime]The date and time when the task was created.
updated_atOptional[datetime]The date and time when the task was last updated.
video_embeddingOptional[MediaEmbeddingTaskVideoEmbedding]An object containing the metadata associated with the embedding. See VideoEmbeddingMetadata for details.
audio_embeddingOptional[MediaEmbeddingTaskAudioEmbedding]An object containing the metadata associated with the embedding. See AudioEmbeddingMetadata for details.
document_embeddingOptional[MediaEmbeddingTaskDocumentEmbedding]An object containing the metadata associated with the embedding. Present only for document tasks created with Marengo 3.5. See DocumentEmbeddingMetadata for details.
image_embeddingOptional[MediaEmbeddingTaskImageEmbedding]An object containing the metadata associated with the embedding. Present only for image tasks created with Marengo 3.5. See ImageEmbeddingMetadata for details.

Each of the four objects above wraps a single metadata field. All four metadata classes inherit the following properties:

NameTypeDescription
input_urlOptional[str]The URL of the media file used to generate the embedding. Present if a URL was provided in the request.
input_filenameOptional[str]The name of the media file used to generate the embedding. Present if a file was provided in the request.

VideoEmbeddingMetadata

The VideoEmbeddingMetadata class contains the metadata associated with the embedding.

NameTypeDescription
video_clip_lengthOptional[float]The duration for each clip in seconds, as specified in the request. Note that the platform automatically truncates video segments shorter than 2 seconds. For a 31-second video divided into 6-second segments, the final 1-second segment will be truncated. This truncation only applies to the last segment if it does not meet the minimum length requirement of 2 seconds.
video_embedding_scopeOptional[List[str]]The scope you’ve specified in the request.
video_embedding_optionOptional[List[str]]The embedding_option values used to generate the embedding.
durationOptional[float]The total duration of the video in seconds.

AudioEmbeddingMetadata

The AudioEmbeddingMetadata class contains the metadata associated with the embedding.

NameTypeDescription
audio_embedding_optionOptional[List[str]]The type of the embedding. It can take one of the following values: ["audio"] or ["transcription"].
audio_embedding_scopeOptional[List[str]]The scope you’ve specified in the request.
durationOptional[float]The total duration of the audio in seconds.
start_offset_secOptional[float]The start offset in seconds from the beginning of the audio where processing should begin.
end_offset_secOptional[float]The end offset in seconds from the beginning of the audio where processing should end.

DocumentEmbeddingMetadata

The DocumentEmbeddingMetadata class contains the metadata associated with the embedding. Only Marengo 3.5 returns this object.

NameTypeDescription
document_embedding_optionOptional[List[str]]The embedding_option values used to generate the embedding.
document_embedding_scopeOptional[List[str]]The embedding_scope values used to generate the embedding.

ImageEmbeddingMetadata

The ImageEmbeddingMetadata class contains the metadata associated with the embedding. Only Marengo 3.5 returns this object.

NameTypeDescription
image_embedding_optionOptional[List[str]]The embedding_option values used to generate the embedding. Always ["visual"].
image_embedding_scopeOptional[List[str]]The embedding_scope values used to generate the embedding. Always ["asset"].

API Reference

List async embedding tasks

Create an async embedding task

Description: This method creates embeddings for audio, video, images, and documents asynchronously.

Use this method to embed content at scale, such as long files or the media files you want to make searchable. For a query, or for results you need in the same request, use the Create embeddings class instead.

The content this method accepts depends on the model. Both models embed audio and video. Marengo 3.5 also embeds images and PDF files. For the formats, resolutions, file sizes, and duration limits each model accepts, see the input requirements for Marengo 3.5 or Marengo 3.0.

Notes
  • Creating a task validates only basic metadata and playability, not the full file. A file can pass this check but still fail later during embedding. When you retrieve the results, check the status field. If it is failed, the error.message field contains the reason.
  • This method is rate-limited. With Marengo 3.5, the platform counts input tokens for each type of content. A task can exceed a limit before you see an error. For details, see Input token limits for embedding.
  • Embeddings are stored for seven days.

Function signature and example:

1def create(
2 self,
3 *,
4 input_type: CreateAsyncEmbeddingRequestInputType,
5 model_name: CreateAsyncEmbeddingRequestModelName,
6 embedding_uncertainty: typing.Optional[bool] = OMIT,
7 audio: typing.Optional[AsyncAudioInputRequest] = OMIT,
8 video: typing.Optional[AsyncVideoInputRequest] = OMIT,
9 document: typing.Optional[AsyncDocumentInputRequest] = OMIT,
10 image: typing.Optional[AsyncImageInputRequest] = OMIT,
11 request_options: typing.Optional[RequestOptions] = None,
12) -> TasksCreateResponse

Parameters

NameTypeRequiredDescription
input_typeCreateAsyncEmbeddingRequestInputTypeYesThe type of content for the embeddings. Values:
- audio: An audio file.
- video: A video file.
- document: A PDF file. Requires Marengo 3.5.
- image: An image file. Requires Marengo 3.5.
model_nameCreateAsyncEmbeddingRequestModelNameYesThe embedding model to use.

Values:
- marengo3.5: For details about this version, see the Marengo 3.5 page.
- marengo3.0: For details about this version, see the Marengo 3.0 page.
audioAsyncAudioInputRequestNoAudio input configuration. Required when input_type is audio. See AsyncAudioInputRequest for details.
videoAsyncVideoInputRequestNoVideo input configuration. Required when input_type is video. See AsyncVideoInputRequest for details.
documentAsyncDocumentInputRequestNoDocument input configuration. Required when input_type is document. Requires Marengo 3.5. See AsyncDocumentInputRequest for details.
imageAsyncImageInputRequestNoImage input configuration. Required when input_type is image. Requires Marengo 3.5. See AsyncImageInputRequest for details.
embedding_uncertaintyOptional[bool]NoSet this parameter to True to receive a data[].embedding_uncertainty field in the response, representing a per-dimension uncertainty vector with the same length as the embedding array. A higher value shows lower confidence in that dimension. Requires Marengo 3.5. To use this parameter with audio or video input, exclude the asset scope from the embedding_scope field. For example, set video.embedding_scope to ["clip"]. The field defaults to ["clip", "asset"], so a request that keeps the default returns a 400 error. This restriction does not apply to document and image input.
request_optionsRequestOptionsNoRequest-specific configuration.

AsyncAudioInputRequest

The AsyncAudioInputRequest class specifies the configuration for processing audio content. Required when input_type is audio.

NameTypeRequiredDescription
media_sourceMediaSourceYesSpecifies the source of the audio file. See MediaSource for details.
start_secfloatNoThe start time in seconds for processing the audio file.

Use this parameter to process a portion of the audio file starting from a specific time.

Default: 0 (start from the beginning).
end_secfloatNoThe end time in seconds for processing the audio file.

Use this parameter to process a portion of the audio file ending at a specific time. The end time must be greater than the start time.

Default: End of the audio file
segmentationAsyncAudioInputRequestSegmentationNoSpecifies how the platform divides the audio into segments.

The structure of this object depends on the model version:

- With Marengo 3.5: Place your settings in the temporal object. Both strategies are available: dynamic divides the audio into variable-length segments that follow scene changes, and fixed divides it into equal-length segments. Default: temporal.dynamic, min_duration_sec: 2.
- With Marengo 3.0: Provide the settings directly in this object. Only fixed segmentation is available. Default: fixed, duration_sec: 6.

Using a structure that does not match your model version returns a 400 error.

See AudioSegmentation and AsyncTemporalSegmentation for details.
embedding_optionList[str]NoThe types of embeddings you wish to generate.

Values:
- audio: Generates embeddings based on audio content (sounds, music, effects). With Marengo 3.5, this value includes speech, music, and non-dialog audio.
- transcription: Generates embeddings based on transcribed speech. Requires Marengo 3.0.

You can specify multiple values to generate different types of embeddings for the same audio.

Default: ["audio", "transcription"] for Marengo 3.0; ["audio"] for Marengo 3.5.
embedding_scopeList[str]NoThe scope for which you wish to generate embeddings.

Values:
- clip: Generates one embedding for each segment. Works with both Marengo 3.0 and Marengo 3.5.
- local: Generates one embedding for each segment. Equivalent to clip when using Marengo 3.5.
- asset: Generates one embedding for the entire audio file

You can specify multiple scopes to generate embeddings at different levels.

Default: ["clip", "asset"]
embedding_typeList[str]NoSpecifies how to structure the embedding. Include this parameter only when the embedding_option parameter contains at least two values.

Values:
- separate_embedding: Returns separate embeddings for each modality specified in the embedding_option parameter.
- fused_embedding: Returns a single combined embedding that integrates all modalities into one vector. With Marengo 3.5, this value requires the time_based_metadata field.

Specify both values to receive separate and fused embeddings in the same response.

Default: separate_embedding.
time_based_metadataOptional[List[TimeBasedMetadataEntry]]NoYour own time-aligned text, such as a stats feed or scene descriptions. The platform folds each entry into the fused embedding of the segments it overlaps in time, and it affects only that embedding. Requires the fused_embedding value in the embedding_type field. This field is supported only with Marengo 3.5. See TimeBasedMetadataEntry for details.

AsyncVideoInputRequest

The AsyncVideoInputRequest class specifies the configuration for processing video content. Required when input_type is video.

NameTypeRequiredDescription
media_sourceMediaSourceYesSpecifies the source of the video file. See MediaSource for details.
start_secfloatNoThe start time in seconds for processing the video file.

Use this parameter to process a portion of the video file starting from a specific time.

Default: 0 (start from the beginning)
end_secfloatNoThe end time in seconds for processing the video file.

Use this parameter to process a portion of the video file ending at a specific time. The end time must be greater than the start time.
Default: End of the video file
segmentationAsyncVideoInputRequestSegmentationNoSpecifies how the platform divides the video into segments.

The structure of this object depends on the model version:

- With Marengo 3.5: Place your settings in the temporal object. Both strategies are available: dynamic divides the video into variable-length segments that follow scene changes, and fixed divides it into equal-length segments. Default: temporal.dynamic, min_duration_sec: 2.
- With Marengo 3.0: Provide the settings directly in this object. Default: dynamic, min_duration_sec: 4.

Using a structure that does not match your model version returns a 400 error.

See VideoSegmentation and AsyncTemporalSegmentation for details.
embedding_optionList[str]NoThe types of embeddings to generate for the video.

Values:
- visual: Generates embeddings based on visual content (scenes, objects, actions)
- audio: Generates embeddings based on audio content (sounds, music, effects). With Marengo 3.5, this value includes speech, music, and non-dialog audio.
- transcription: Generates embeddings based on transcribed speech. Requires Marengo 3.0.

You can specify multiple values to generate different types of embeddings for the same video.

Default: ["visual", "audio", "transcription"] for Marengo 3.0; ["visual", "audio"] for Marengo 3.5.
embedding_scopeList[str]NoThe scope for which you wish to generate embeddings.

Values:
- clip: Generates one embedding for each segment. Works with both Marengo 3.0 and Marengo 3.5.
- local: Generates one embedding for each segment. Equivalent to clip when using Marengo 3.5.
- asset: Generates one embedding for the entire video file. Use this scope for videos up to 10-30 seconds to maintain optimal performance.

You can specify multiple scopes to generate embeddings at different levels.

Default: ["clip", "asset"]
embedding_typeList[str]NoSpecifies how to structure the embedding. Include this parameter only when embedding_option contains at least two values.

Values:
- separate_embedding: Returns separate embeddings per modality specified in the embedding_option field
- fused_embedding: Returns a single embedding that combines all modalities into one vector. With Marengo 3.5, this value requires the time_based_metadata field.

Specify both values to receive separate and fused embeddings in the same response.

Default: separate_embedding.
time_based_metadataOptional[List[TimeBasedMetadataEntry]]NoYour own time-aligned text, such as a stats feed or scene descriptions, which you can generate by segmenting a video with Pegasus. The platform folds each entry into the fused embedding of the segments it overlaps in time, and it affects only that embedding. Requires the fused_embedding value in the embedding_type field. This field is supported only with Marengo 3.5. See TimeBasedMetadataEntry for details.

TimeBasedMetadataEntry

One time-aligned metadata entry. The platform folds the text of the entry into the fused embedding of every segment that overlaps the time range of the entry.

Used by the AsyncAudioInputRequest.time_based_metadata and AsyncVideoInputRequest.time_based_metadata fields. Not applicable to the AsyncDocumentInputRequest class. Requires Marengo 3.5.

NameTypeRequiredDescription
startfloatYesThe start time of the entry in seconds, measured from the beginning of the asset. Set the same value in the end field for an event that happens at a single point in time, such as one entry in a stats feed.
endfloatYesThe end time of the entry in seconds, measured from the beginning of the asset.
textstrYesThe text to fold into the fused embedding of the overlapping segments.

AsyncDocumentInputRequest

The AsyncDocumentInputRequest class specifies the configuration for processing documents. Requires Marengo 3.5.

The platform embeds the rendered pages of your PDF file with embedding_option: ["visual"], one embedding per page.

NameTypeRequiredDescription
media_sourceMediaSourceYesSpecifies the source of the document file. See MediaSource for details.
embedding_optionOptional[List[str]]NoThe type of content to embed.

Values:
- visual: Embeds the rendered pages. Valid for PDF files.
- text: Not supported. Returns a 400 error.
embedding_typeOptional[List[str]]NoSpecifies how to structure the embedding.

Values:
- separate_embedding: Returns one embedding per requested embedding_scope.
- fused_embedding: Returns a 400 error. Documents have a single modality.

Default: separate_embedding.
embedding_scopeOptional[List[str]]NoThe scope for which you wish to generate embeddings.

Values:
- local: Returns one embedding per page. The only supported scope for PDF files, and the default.
- asset: Not supported for PDF files.

AsyncImageInputRequest

The AsyncImageInputRequest class specifies the configuration for processing image content. Required when input_type is image. Requires Marengo 3.5. The image can be up to 32 MB before encoding, whichever of the three fields you use.

For an image, the embedding_option, embedding_type, and embedding_scope fields each accept a single value; any other value returns a 400 error.

NameTypeRequiredDescription
media_sourceMediaSourceYesSpecifies the source of the image file. See MediaSource for details.
embedding_optionOptional[List[str]]NoThe type of embedding to generate for the image. Always visual.
embedding_typeOptional[List[str]]NoSpecifies how to structure the embedding. Always separate_embedding.
embedding_scopeOptional[List[str]]NoThe scope for which to generate embeddings. Always asset, which produces one embedding for the entire image.

MediaSource

The MediaSource class specifies the source of the media file. Provide exactly one of the following:

NameTypeRequiredDescription
base_64_stringstrNoThe base64-encoded media data. The decoded file can be up to 36 MB; encoded, it can be up to 48 MB.
urlstrNoThe publicly accessible URL of the media file. Use direct links to raw media files. Video hosting platforms and cloud storage sharing links are not supported.
asset_idstrNoThe unique identifier of an asset from a direct or multipart upload. The asset status must be ready. Use assets.retrieve to check the status.

AudioSegmentation

The AudioSegmentation class specifies how the platform divides the audio into segments using fixed-length intervals.

NameTypeRequiredDescription
strategyAudioSegmentationStrategyYesThe segmentation strategy. Value: fixed.
fixedAudioSegmentationFixedYesConfiguration for fixed segmentation.

This object is required when the strategy field is fixed. See AudioSegmentationFixed for details.

AudioSegmentationFixed

The AudioSegmentationFixed class configures fixed-length segmentation for audio.

NameTypeRequiredDescription
duration_secintYesThe duration in seconds for each segment. The platform divides the audio into segments of this exact length. The final segment may be shorter if the audio duration is not evenly divisible.

Min: 2.
Max: 10.

Example: With duration_sec: 5, a 12-second audio file produces segments: [0-5s], [5-10s], [10-12s].

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:

NameTypeRequiredDescription
strategyLiteral["fixed"]YesThe segmentation strategy. Value: fixed.
fixedVideoSegmentationFixedFixedYesConfiguration for fixed segmentation. See VideoSegmentationFixedFixed for details.

Dynamic segmentation: Divides the video into adaptive segments based on scene changes:

NameTypeRequiredDescription
strategyLiteral["dynamic"]YesThe segmentation strategy. Value: dynamic.
dynamicVideoSegmentationDynamicDynamicYesConfiguration for dynamic segmentation. See VideoSegmentationDynamicDynamic for details.

VideoSegmentationFixedFixed

The VideoSegmentationFixedFixed class configures fixed-length segmentation for video.

NameTypeRequiredDescription
duration_secintYesThe duration in seconds for each segment.

The platform divides the video into segments of this exact length. The final segment may be shorter if the video duration is not evenly divisible.

Min: 2.
Max: 10.

Example: With duration_sec: 5, a 12-second video produces segments: [0-5s], [5-10s], [10-12s].

VideoSegmentationDynamicDynamic

The VideoSegmentationDynamicDynamic class configures dynamic segmentation for video based on scene changes.

NameTypeRequiredDescription
min_duration_secintYesThe minimum duration in seconds for each segment.

The platform divides the video into segments that are at least this long. Segments adapt to scene changes and content boundaries and may be longer than the minimum.

Min: 2.
Max: 5.

Example: With min_duration_sec: 3, segments might be: [0-3.2s], [3.2-7.8s], [7.8-12.1s]

AsyncTemporalSegmentation

The AsyncTemporalSegmentation class wraps your settings in a temporal object. Use with Marengo 3.5.

NameTypeRequiredDescription
temporalTemporalSegmentationYesSpecifies how the platform divides the file into segments. See TemporalSegmentation for details.

TemporalSegmentation

The TemporalSegmentation type specifies how the platform divides the file into segments. The strategy field selects one variant:

Dynamic segmentation: Creates variable-length segments that align with scene or content boundaries. Use this for content-aware segmentation.

NameTypeRequiredDescription
strategyLiteral["dynamic"]YesMust be dynamic. Identifies this as the content-aware segmentation variant.
dynamicTemporalSegmentationDynamicDynamicYesConfiguration for dynamic segmentation. This object is required when strategy is dynamic. See TemporalSegmentationDynamicDynamic for details.

Fixed segmentation: Creates equal-length segments. Use this for consistent timing.

NameTypeRequiredDescription
strategyLiteral["fixed"]YesMust be fixed. Identifies this as the equal-length segmentation variant.
fixedTemporalSegmentationFixedFixedYesConfiguration for fixed segmentation. This object is required when strategy is fixed. See TemporalSegmentationFixedFixed for details.

TemporalSegmentationDynamicDynamic

The TemporalSegmentationDynamicDynamic class configures dynamic segmentation. This object is required when strategy is dynamic.

NameTypeRequiredDescription
min_duration_secintYesThe minimum duration in seconds for each segment.

The platform divides the file into segments that are at least this long. Segments adapt to scene changes and content boundaries and may be longer than the minimum.

Min: 2.
Max: 5.

TemporalSegmentationFixedFixed

The TemporalSegmentationFixedFixed class configures fixed segmentation. This object is required when strategy is fixed.

NameTypeRequiredDescription
duration_secintYesThe duration in seconds for each segment. The platform divides the file into segments of this exact length. The final segment may be shorter if the duration is not evenly divisible.

Min: 2.
Max: 10.

Return value

Returns a TasksCreateResponse object containing the task details.

The TasksCreateResponse class contains the following properties:

NameTypeDescription
idstrThe unique identifier of the embedding task.
statusLiteral["processing"]The initial status of the embedding task. Value: processing.
dataOptional[List[EmbeddingData]]Array of embedding results. Present when status is ready; null when status is processing or failed.

API Reference

Create an async embedding task

Retrieve task status and results

Description: This method retrieves the status and the results of an async embedding task.

Invoke this method repeatedly until the status field is ready or failed. When the status is ready, use the embeddings from the response. When the status is failed, the error.message field contains the reason.

Note

Embeddings are stored for seven days.

Function signature and example:

1def retrieve(
2 self,
3 task_id: str,
4 *,
5 request_options: typing.Optional[RequestOptions] = None
6) -> EmbeddingTaskResponse

Parameters

NameTypeRequiredDescription
task_idstrYesThe unique identifier of the embedding task.
request_optionsRequestOptionsNoRequest-specific configuration.

Return value

Returns an EmbeddingTaskResponse object containing the task status and results.

The EmbeddingTaskResponse class contains the following properties:

NameTypeDescription
idstrThe unique identifier of the embedding task.
statusEmbeddingTaskResponseStatusThe current status of the task.

Values:
- processing: The platform is creating the embeddings
- ready: Processing is complete. Embeddings are available in the data field
- failed: The task failed. The data field is null, and the error.message field contains the reason
created_atOptional[datetime]The date and time when the task was created.
updated_atOptional[datetime]The date and time when the task was last updated.
dataOptional[List[EmbeddingData]]An object containing the embedding results, or null otherwise.
usageOptional[EmbeddingUsage]Token counts for the request. Only Marengo 3.5 returns this field. See EmbeddingUsage for details.
metadataOptional[EmbeddingTaskMediaMetadata]Metadata for the media input. See EmbeddingTaskMediaMetadata for details.
errorOptional[EmbeddingTaskResponseError]An object describing why the embedding task failed. Present only when status is failed. Omitted otherwise.

The EmbeddingData class contains the following properties:

NameTypeDescription
embeddingList[float]The embedding vector for the content.
embedding_uncertaintyOptional[List[float]]A per-dimension uncertainty vector with the same length as the embedding array. A higher value shows lower confidence in that dimension. Present when the request sets embedding_uncertainty: true. Only Marengo 3.5 returns this field.
embedding_optionOptional[EmbeddingDataEmbeddingOption]The modality used to generate this embedding.

Values:
- visual: Embedding based on visual content (a video, a page of a PDF file, or an image embedded asynchronously).
- audio: Embedding based on audio content.
- transcription: Embedding based on transcribed speech. Returned only for content embedded with Marengo 3.0.
- text: The platform does not return this value.
- fused: Embedding based on a combination of the modalities specified in the request. The platform returns this embedding only for video and audio input, and only when the embedding_type parameter includes the fused_embedding value.
- null: For text embeddings and images embedded synchronously.
embedding_scopeOptional[EmbeddingDataEmbeddingScope]The scope for which the embedding was generated.

Values:
- clip: Embedding for a segment. For video and audio input, one embedding per detected segment.
- page: Embedding for one page of a document. The platform returns this value only for PDF files embedded asynchronously.
- asset: Embedding for the entire file. For video and audio input, use this scope for content up to 10-30 seconds to maintain optimal performance.
- null: For text embeddings and images embedded synchronously.

When you request the local scope, the platform returns clip for audio and video, and page for PDF files. For audio, video, and document input, the metadata.embedding_scopes field contains the scopes you requested.
start_secOptional[float]The start time in seconds for this segment. This field is null for text and image embeddings.
end_secOptional[float]The end time in seconds for this segment. This field is null for text and image embeddings.
start_page_numberOptional[int]The first page this embedding covers, counting from 1. The platform returns this field only for page-level embeddings of a PDF file, and null in every other case.
end_page_numberOptional[int]The last page this embedding covers, counting from 1 and including that page. This field matches the start_page_number field when the embedding covers a single page. The platform returns this field only for page-level embeddings of a PDF file, and null in every other case.

EmbeddingUsage

The EmbeddingUsage class provides token counts for the request. Only Marengo 3.5 returns this object.

NameTypeDescription
input_tokensDict[str, int]The number of tokens the request used. Each key names a type of content the request processed, and each value is the token count for that content.
truncatedboolWhether the input was truncated to fit within the token limit.

EmbeddingTaskMediaMetadata

The EmbeddingTaskMediaMetadata type provides metadata for the media input. The input_type field selects one variant:

Audio: Metadata for audio embeddings.

NameTypeDescription
input_typeLiteral["audio"]The type of the input content. Value: audio.
input_urlOptional[str]The publicly accessible URL for the audio file.
input_filenameOptional[str]The name of the audio file.
embedding_optionsList[str]The embedding_option values used to generate the embedding.
embedding_scopesList[EmbeddingAudioMetadataEmbeddingScopesItem]The embedding_scope values used to generate the embedding.
durationfloatThe duration of the audio in seconds.
start_offset_secOptional[float]The start offset in seconds.
end_offset_secOptional[float]The end offset in seconds.

Video: Metadata for video embeddings.

NameTypeDescription
input_typeLiteral["video"]The type of the input content. Value: video.
input_urlOptional[str]The publicly accessible URL for the video file.
input_filenameOptional[str]The name of the video file.
clip_lengthOptional[int]Length of each video clip in seconds. Only available for fixed segmentation.
embedding_scopesList[EmbeddingVideoMetadataEmbeddingScopesItem]The embedding_scope values used to generate the embedding.
embedding_optionsList[str]The embedding_option values used to generate the embedding.
durationfloatThe duration of the video in seconds.
start_offset_secOptional[float]The start offset in seconds.
end_offset_secOptional[float]The end offset in seconds.

Document: Metadata for document embeddings. Only Marengo 3.5 returns this object.

NameTypeDescription
input_typeLiteral["document"]The type of the input content. Value: document.
input_urlOptional[str]The publicly accessible URL for the document file.
input_filenameOptional[str]The name of the document file.
embedding_optionsOptional[List[str]]The embedding_option values used to generate the embedding.
embedding_scopesOptional[List[AsyncDocumentMetadataEmbeddingScopesItem]]The embedding_scope values used to generate the embedding.

Image: Metadata for image embeddings. Only Marengo 3.5 returns this object.

NameTypeDescription
input_typeLiteral["image"]The type of the input content. Value: image.
input_urlOptional[str]The publicly accessible URL for the image file.
input_filenameOptional[str]The name of the image file.
embedding_optionsOptional[List[str]]The embedding_option values used to generate the embedding. Always ["visual"].
embedding_scopesOptional[List[AsyncImageMetadataEmbeddingScopesItem]]The embedding_scope values used to generate the embedding. Always ["asset"].

The EmbeddingTaskResponseError class contains the following property:

NameTypeDescription
messagestrA human-readable message that describes why the task failed. Possible values:
- “The embedding service is temporarily unstable. Please try again later.”
- “The embedding task failed. Please try again later.”
- “We could not process your media for embedding. Please verify the input file and try again.” For the steps to fix the file, see the How do I fix a file that could not be processed for embedding? section on the Frequently asked questions page.

API Reference

Retrieve task status and results