AI_MULTI_EMBED
functiondeferredAI & MLCreates multimodal embeddings from text, an image, an audio file, or a video file. Embeddings are abstract numerical representations of the features of an input that can be used to determine the degree of similarity between inputs across modalities. Use AI_MULTI_EMBED for semantic search, scene retrieval, content indexing, similarity search, and other tasks that combine visual, audio, and text understanding. Unlike AI_EMBED, which returns a single embedding vector, AI_MULTI_EMBED returns one or more embedding vectors together with metadata that describes each segment. For video and audio inputs, the function generates separate embeddings for different modalities (visual, audio, transcription) and for different segments of the asset. The following table shows the regions where you can use the AI_MULTI_EMBED function:
Syntax
supportedpartialnot supportednot scored
AI_MULTI_EMBED( <model> , <input> [ , <options> ] )
Parameters
| Name | Required | Description |
|---|---|---|
model | required | A string specifying the multimodal embedding model to use. You can provide the following value: twelvelabs-marengo-embed-3-0 Supported models might have different costs. |
input | required | The content to generate embeddings from. Can be one of the following: A string containing the text to embed. A FILE object (created with TO_FILE) referencing an image, audio, or video file in a Snowflake stage. The twelvelabs-marengo-embed-3-0 model supports embedding generation for transcribed speech and text queries in 36 languages. For the full list, see the TwelveLabs Marengo documentation. Supported file formats: Video: .mp4, .mov, .avi, .mkv, .webm, .flv Audio: .mp3, .wav, .flac, .ogg Image: .jpg, .jpeg, .png For the maximum supported duration and file size, see Limitations. |
options | optional | An object containing zero or more of the following keys. The options apply only to video and audio inputs; they’re ignored for text and image inputs. start_sec: A number that specifies the time point in seconds where embedding generation should begin. Minimum value: 0. Default: 0 end_sec: A number that specifies the time point in seconds where embedding generation should end. Must be greater than start_sec plus the segment length, and no greater than the duration of the media. Default: Duration of the media embedding_options: An array specifying which modalities to embed. Valid array members: visual — Visual embeddings from the video. audio — Embeddings of the audio track. transcription — Embeddings of the transcribed speech in the audio track. Defaults: For video: ['visual', 'audio', 'transcription'] For audio: ['audio', 'transcription'] embedding_scope: An array specifying the scope of the returned embeddings. Provide one or both of the following values: clip — Returns one embedding per segment (clip) of the asset. asset — Returns a single embedding that represents the entire asset. Default: ['clip'] embedding_type: An array specifying how embeddings are aggregated across modalities. Valid array members: separate_embedding — Returns a separate embedding for each modality in embedding_options. fused_embedding — Returns a weighted fusion of the modalities in embedding_options. For video, fused_embedding requires at least two modalities in embedding_options. For audio, fused_embedding requires both audio and transcription in embedding_options. Default: ['separate_embedding'] use_fixed_length_sec: An integer that specifies the duration in seconds of each segment when using fixed-length segmentation. Range: 1 to 10. This option is mutually exclusive with min_clip_sec. If neither is provided, video uses dynamic (shot-boundary) segmentation and audio uses fixed-length segmentation of approximately 10 seconds. min_clip_sec: An integer that specifies the minimum duration in seconds of each segment when using dynamic (shot-boundary) segmentation. Range: 1 to 5. Default: 4 This option is mutually exclusive with use_fixed_length_sec. Dynamic segmentation applies only to video. |
Returns
Returns an OBJECT with the following fields: - error: A string describing any error that occurred, or NULL if the call succeeded. - value: An array of objects, one for each embedding. Each object contains the following fields: embedding: An array of floats representing the embedding vector. The Marengo Embed 3.0 model returns 512-dimensional vectors. Cast this value to VECTOR(FLOAT, 512) before using it with the vector similarity functions. - embedding_option: The modality of the embedding. One of visual, audio, transcription, or fused. Not present for text or image inputs. - embedding_scope: The scope of the embedding. One of clip or asset. Not present for text or image inputs. - start_sec: The starting timestamp of the segment in seconds. Not present for text or image inputs. - end_sec: The ending timestamp of the segment in seconds. Not present for text or image inputs.
Access control requirements
You must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role or the SNOWFLAKE.CORTEX_EMBED_USER database role to call this function. See Cortex LLM privileges for more information on granting one of these privileges.
Limitations
- The twelvelabs-marengo-embed-3-0 model has the following input limits: Maximum video or audio duration: 4 hours - Maximum video or audio file size: 6 GB - Maximum text length: 500 tokens - Maximum image size: 5 MB - The model is available in AWS US East 1 (N. Virginia) only. Cross-region inference is supported. - FILE objects for AI_MULTI_EMBED can reference files in internal stages and external stages on AWS, Azure, or Google Cloud Storage. All stage encryption types are supported, including server-side encryption (SSE) and customer-side encryption (CSE). - AI_MULTI_EMBED supports stages protected by network policies.
Legal notices
Refer to Snowflake AI and ML.
Known gaps
- The emulator does not run language, embedding, document or speech models, so Cortex AI functions have no model to answer with.