The Embed.V2.Tasks interface 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 interface:
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:
The TwelvelabsApi.embed.v2.TasksListRequest interface has the following properties:
Returns a Promise that resolves to a Page<TwelvelabsApi.MediaEmbeddingTask> object that allows you to iterate through the paginated task results.
The Page<T> class contains the following properties and methods:
The TwelvelabsApi.MediaEmbeddingTask interface 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 TwelvelabsApi.embed.v2.CreateAsyncEmbeddingRequest interface has the following properties:
The TwelvelabsApi.AudioInputRequest interface specifies the configuration for processing audio content. Required when inputType is audio.
The TwelvelabsApi.VideoInputRequest interface specifies the configuration for processing video content. Required when inputType is video.
The TwelvelabsApi.MediaSource interface specifies the source of the media file. Provide exactly one of the following:
The TwelvelabsApi.AudioSegmentation interface specifies how the platform divides the audio into segments using fixed-length intervals.
The TwelvelabsApi.AudioSegmentationFixed interface configures fixed-length segmentation for audio.
The TwelvelabsApi.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 TwelvelabsApi.VideoSegmentationFixedFixed interface configures fixed-length segmentation for video.
The TwelvelabsApi.VideoSegmentationDynamicDynamic interface configures dynamic segmentation for video based on scene changes.
Returns an HttpResponsePromise that resolves to a TwelvelabsApi.embed.v2.TasksCreateResponse object containing the task details.
The TwelvelabsApi.embed.v2.TasksCreateResponse.TasksCreateResponse interface 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 HttpResponsePromise that resolves to a TwelvelabsApi.EmbeddingTaskResponse object containing the task status and results.
The TwelvelabsApi.EmbeddingTaskResponse interface contains the following properties:
The TwelvelabsApi.EmbeddingData interface contains the following properties: