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

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

Returns a vector representation as container data for input text using an embedding model.

GetEmbeddingAsFile

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

GetEmbeddingAsText

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

GetModelAttributes

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

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.