- Categories:
String & binary functions (Large Language Model)
AI_EMBED¶
Note
AI_EMBED is the updated version of EMBED_TEXT_1024 (SNOWFLAKE.CORTEX). For the latest functionality, use AI_EMBED.
Creates an embedding vector from text or an image. Embeddings are abstract numerical representations of the features of a piece of text or an image that can be used to determine the degree of similarity between pieces of text or images, which can be used for semantic search, clustering, classification, and other tasks.
Region availability¶
The following table shows the regions where you can use the AI_EMBED function for text and images:
Data type
|
AWS US West 2
(Oregon)
|
AWS US East 1
(N. Virginia)
|
AWS Europe Central 1
(Frankfurt)
|
AWS Europe West 1
(Ireland)
|
AWS AP Southeast 2
(Sydney)
|
AWS AP Northeast 1
(Tokyo)
|
Azure East US 2
(Virginia)
|
Azure West Europe
(Netherlands)
|
AWS
(Cross-Region)
|
---|---|---|---|---|---|---|---|---|---|
Text
|
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
✔ |
Image
|
✔ |
✔ |
✔ |
✔ |
Syntax¶
AI_EMBED( <model> , <input> )
Arguments¶
Required:
model
A string specifying the vector embedding model to be used to generate an embedding.
For text, you can provide the following values:
snowflake-arctic-embed-l-v2.0
snowflake-arctic-embed-l-v2.0-8k
nv-embed-qa-4
multilingual-e5-large
voyage-multilingual-2
For images, you can provide only the following value:
voyage-multimodal-3
Supported models might have different costs.
input
The string or image (as a FILE object) to generate an embedding from. Images must be:
In JPEG, WEBP, PNG, or BMP format
No more than 10 MB in size
No more than 8,000 x 8,000 pixels
Returns¶
An embedding vector of type VECTOR derived from the input text or image.
Access control requirements¶
Users must use a role that has the SNOWFLAKE.CORTEX_USER database role. For more information about this privilege, see Required privileges.
Examples¶
Text example¶
In this example, a vector embedding is generated for the phrase hello world
using the snowflake-arctic-embed-l-v2.0
model:
SELECT AI_EMBED('snowflake-arctic-embed-l-v2.0', 'hello world');
Image example¶
In this example, a vector embedding is generated for a staged image using the voyage-multimodal-3
model:
SELECT AI_EMBED('voyage-multimodal-3',
TO_FILE ('@my_images', 'CITY_WALKING1.PNG'));
Limitations¶
Snowflake AI functions don’t support dynamic table incremental refresh.
Snowflake AI functions don’t work on FILE objects created from files in the following kinds of stages:
Internal stages with encryption mode
TYPE = 'SNOWFLAKE_FULL'
External stages with any customer-side encrypted mode, such as
AWS_CSE
orAZURE_CSE
.User stage
Table stage
Stage with double-quoted names
Legal notices¶
Refer to Snowflake AI and ML.