AI Functions
On this page
Enable AI Functions
To enable AI Functions, navigate to AI Services > AI & ML Functions, select the deployment on which to enable AI Functions.
Once the AI Functions are enabled, query them in the SQL Editor or SingleStore Notebooks.
Category |
Function |
---|---|
Text Processing Functions |
|
|
|
|
|
|
|
|
|
|
|
Embedding and Vector Functions |
|
|
Text Processing Functions
AI_ COMPLETE
Provides batched LLM powered completion of every input text.
Syntax
AI_COMPLETE(texts, model)
Arguments
-
texts
: A prompt. -
model
: An LLM model.
Return Type
string
Usage
Basic usage with the default model |
|
Basic usage with a specific model |
|
Input example on database |
|
AI_ SENTIMENT
Provides sentiment classification and score for all user-defined inputs.
Syntax
AI_SENTIMENT(texts, model)
Arguments
-
texts
: A prompt. -
model
: An LLM model.
Return Type
string
Usage
Basic usage with default model |
|
Basic usage with selected model |
|
Input example on database |
|
AI_ TRANSLATE
Provides translation of user-provided documents from source language to target language.
Syntax
AI_SENTIMENT(texts, source_languages, target_languages, model)
Arguments
-
texts
: A prompt. -
source_
: The language in which the prompt is written.languages -
target_
: The language to which the prompt gets translated.languages -
model
: An LLM model.
Return Type
string
Usage
Basic usage with default model |
|
Basic usage with selected model |
|
Input example on database |
|
AI_ SUMMARIZE
Provides summary of user-provided documents within the specified length.
Syntax
AI_SUMMARIZE(texts, model, max_lengths)
Arguments
-
texts
: A prompt. -
model
: An LLM model. -
max_
: Maximum length of the summary.lengths
Return Type
string
Usage
Basic usage with default model and length |
|
Basic usage with selected model |
|
Input example on database |
|
AI_ CLASSIFY
Provides classification of each input text into one of the given categories or labels.
Syntax
AI_CLASSIFY(texts, categories, model)
Arguments
-
texts
: A prompt. -
categories
: Categories for classification. -
model
: An LLM model.
Return Type
string
Usage
Basic usage with default model |
|
Basic usage with selected model |
|
Input example on database |
|
AI_ EXTRACT
Extracts information from a block or text based on the specified natural language question.
Syntax
AI_EXTRACT(texts, questions, model)
Arguments
-
texts
: A prompt. -
questions
: Input natural language question on which the LLM model extracts information. -
model
: An LLM model.
Return Type
string
Usage
Basic usage with default model |
|
Basic usage with selected model |
|
Input example on database |
|
Embedding and Vector Functions
VECTOR_ SIMILARITY
Returns similarity score of each input vector using the specified vector similarity method.
Note
The DOT_
function also supports vector similarity.DOT_
for more information.
Syntax
VECTOR_SIMILARITY(vec1, vec2, methods)
Arguments
-
vec1
: First vector input with typebytes
. -
vec2
: Second vector input with typebytes
. -
methods
: A SingleStore vector similarity method.
Return Type
float32
Usage
Basic usage |
|
Input example on database |
|
EMBED_ TEXT
Provides batched embeddings of all input text.
Syntax
EMBED_TEXT(texts, model)
Arguments
-
texts
: A prompt. -
model
: An embedding model.
Return Type
bytes
Usage
Basic usage with default model |
|
Basic usage with selected embedding model |
|
Input example on database |
|
Usage Recommendations for AI Functions
To optimize performance and control costs when using AI Functions, SingleStore recommends the following:
-
Use Common Table Expressions (CTEs) to filter rows before making calls to large language models (LLMs).
The query engine currently sends data to the LLM before applying LLM or WHERE
filters. -
LLM calls are expensive.
Begin with a small dataset to evaluate response quality and verify the results meet the requirements before scaling up. -
Enterprise plans support three model providers; Aura, Amazon Bedrock, and Azure AI Services.
Data is processed according to each provider’s policies. If a row violates provider rules, the system fails the batch that includes the row and returns errors for these rows. -
Strict usage quotas apply per model and per organization.
These quotas are not configurable by end users. For higher usage limits, contact SingleStore Support. Self-service quota configuration will be available in the future.
Last modified: September 25, 2025