Bring-your-own model for AI_ EMBED¶
AI_EMBED supports running inference against a user-deployed model inference service on SPCS along with Snowflake’s Cortex models. To use this feature, the model argument needs to point to an SPCS model inference service that hosts a Sentence Transformer model.
FILE input (image embeddings) is not supported yet. See Limitations.
Prerequisites¶
Before you can use this feature, log a Sentence Transformer model, then deploy it as an SPCS model inference service using the Snowsight UI or the Python API.
For more examples on creating SPCS inference services, see Example workflows.
Syntax¶
The function accepts the same arguments as the standard AI_EMBED function. The only change is that the model argument is an SPCS service name instead of the name of a Cortex embedding model.
Arguments¶
modelName of an SPCS model inference service which hosts a Sentence Transformer model.
inputA string to generate an embedding from. FILE input is not supported. See Limitations.
Returns¶
An embedding vector of type VECTOR derived from the input text.
Examples¶
The examples in this section use a SQL variable for the service name:
You can confirm the service exists with the following command:
Single embedding¶
Embeddings from a table column¶
Limitations¶
The following AI_EMBED inputs are not yet supported when the function points to an SPCS service.
FILE input¶
Image embedding via FILE input is not supported. The SPCS path only accepts text input.
PROMPT input¶
PROMPT inputs are rejected to avoid handling multimodal inputs, which are not supported yet on the SPCS path. As a result, even PROMPT() templates that contain only text arguments are rejected.
Access control requirements¶
The user must have the USAGE privilege on the SPCS service and on its inference function.
Legal notices¶
Refer to Snowflake AI and ML for legal notices.