The EmbedClient.V2Client.TasksClient class provides methods to create embeddings asynchronously for audio and video content. Use this class for processing files longer than 10 minutes.
When to use this class:
Video:
Audio:
Creating embeddings asynchronously requires three steps:
create method. The platform returns a task ID.retrieve method. Wait until the status is ready.ready using the retrieve method.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.
Function signature and example:
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:
The MediaEmbeddingTask class contains the following properties:
Description: This method creates embeddings for audio and video content asynchronously.
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
The AudioInputRequest class specifies the configuration for processing audio content. Required when input_type is audio.
The VideoInputRequest class specifies the configuration for processing video content. Required when input_type is video.
The MediaSource class specifies the source of the media file. Provide exactly one of the following:
The AudioSegmentation class specifies how the platform divides the audio into segments using fixed-length intervals.
The AudioSegmentationFixed class configures fixed-length segmentation for audio.
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:
The VideoSegmentationFixedFixed class configures fixed-length segmentation for video.
The VideoSegmentationDynamicDynamic class configures dynamic segmentation for video based on scene changes.
Returns a TasksCreateResponse object containing the task details.
The TasksCreateResponse class contains the following properties:
Create an async embedding task
Description: This method retrieves the status and the results of an async embedding task.
Task statuses:
processing: The platform is creating the embeddings.ready: Processing is complete. Embeddings are available in the response.failed: The task failed. Embeddings were not created.Invoke this method repeatedly until the status field is ready. When status is ready, use the embeddings from the response.
Function signature and example:
Returns an EmbeddingTaskResponse object containing the task status and results.
The EmbeddingTaskResponse class contains the following properties:
The EmbeddingData class contains the following properties: