Artificial intelligence functions

Artificial intelligence (AI) functions allow you to work with large language models (LLMs) and Core ML models. For LLMs, these functions get and convert embedding vectors, compute cosine similarity and token counts, and provide information about table schema. For Core ML models, the remaining functions return information about and perform the evaluation of a model.

Function Purpose

AddEmbeddings

Adds two embedding vectors and returns the result as a normalized vector.

ComputeModel

Returns a JSON object containing the result of the Core ML model evaluation.

CosineSimilarity

Returns the similarity between two embedding vectors as a number between -1 (opposite) and 1 (similar).

GetEmbedding

Sends input data to an embedding model and returns a vector representation as container data.

GetEmbeddingAsFile

Converts an embedding vector from text format to binary container data.

GetEmbeddingAsText

Converts an embedding vector from binary container data to text format.

GetFieldsOnLayout

Returns a list of the fields on a layout as JSON data.

GetModelAttributes

Returns metadata in JSON format about a named model that's currently loaded.

GetRAGSpaceInfo

Returns information about the specified RAG space or all RAG spaces, if no space ID is specified.

GetTableDDL

Returns table information in Data Definition Language (DDL) format for a list of table occurrences specified as a JSON array.

GetTokenCount

Returns the token count for the specified text. Use for guidance only; actual counts used by models may vary.

NormalizeEmbedding

Normalizes an embedding vector. If specified, the dimension parameter reduces the number of vector dimensions to use before normalizing.

PredictFromModel

Returns the predicted value from a trained regression model for the specified text embedding vector.

SubtractEmbeddings

Subtracts embedding vector v2 from v1 and returns the result as a normalized vector.