Introducing AI Functions: Power of AI With the Simplicity of SQL

Today, SingleStore is closing the gap between your data and AI-powered insights. We are thrilled to announce SingleStore AI Functions, a new capability that allows you to run state-of-the-art generative AI and embedding models directly on your data with simple SQL commands.

Introducing AI Functions: Power of AI With the Simplicity of SQL

The guiding principle behind AI Functions is simple but profound: Bring the models to the data, not the data to the models. By eliminating data movement, we are eliminating the latency, complexity and cost that have held back the adoption of operational AI. This new feature is built on three pillars of value:

  1. Unmatched simplicity. 
    For the first time, business analysts and application engineers can leverage the world's most powerful LLMs using the language they already know and love: SQL. There are no new frameworks to learn, no complex APIs to integrate and no data pipelines to build. If you can write a SELECT statement, you can now perform sentiment analysis, summarization, translation and more.

  2. Blazing-fast performance. 
    AI Functions execute in a container co-located with the SingleStore engine, around your data as it resides in memory and on disk. This co-location of compute and storage eradicates network latency, enabling AI-powered queries that return results in seconds, not minutes.

  3. True real-time capability. 
    Because SingleStore is a Hybrid Transactional/Analytical Processing (HTAP) database, AI Functions can run on live, operational data the instant it's created. 

AI Functions are delivered as pre-configured, managed Python User-Defined Functions (UDFs) running in optimized containers within the SingleStore Aura cloud service. This containerized approach is a strategic choice designed for the rapid pace of AI innovation.

Your AI toolkit, now in SQL

With the initial release of AI Functions, we are providing a comprehensive toolkit for the most common, impactful natural language processing (NLP) and vector embedding tasks. 

Note: The exact syntax of the AI functions and usage will change as we polish this feature before GA. Check our documentation for the exact up to date syntax

Here is a look at the initial suite of functions available in the aura namespace:
AI_COMPLETE(prompt, model). This is your general-purpose gateway to powerful LLMs like Claude 4.0 Sonnet. Use it for any task that requires text generation, completion or complex reasoning.

1SELECT aura.AI_COMPLETE('Generate a product description for a new line of carbon fiber running shoes.', 'claude-4-0-sonnet') AS product_copy;

AI_SENTIMENT(text). Instantly analyze a block of text to determine if the sentiment is positive, negative or neutral. This is invaluable for gauging customer feedback at scale.

1SELECT review_id, aura.AI_SENTIMENT(review_text) AS sentiment FROM product_reviews;

AI_TRANSLATE(text, source_lang, target_lang). Break down language barriers by translating text between dozens of languages directly within your queries.

1SELECT comment_id, aura.AI_TRANSLATE(comment_text, 'Spanish', 'English') AS translated_comment FROM user_comments;

EMBED_TEXT(text, model). The cornerstone of modern AI applications like Retrieval-Augmented Generation (RAG) and semantic search. This function converts text into high-dimensional vector embeddings.

EMBED_TEXT(text, model). The cornerstone of modern AI applications like Retrieval-Augmented Generation (RAG) and semantic search. This function converts text into high-dimensional vector embeddings.

1UPDATE articles SET content_vector = aura.EMBED_TEXT(article_body, 'openai-text-embed-large');

AI_SUMMARIZE(text, length). Distill long-form text into concise summaries. You can specify the desired length in sentences for tailored output.

1SELECT report_id, aura.AI_SUMMARIZE(full_report, 100) AS executive_summary FROM market_research;

AI_CLASSIFY(text, categories). Categorize unstructured text into a predefined set of labels. This is perfect for automating routing and organization tasks.

1SELECT ticket_id, aura.AI_CLASSIFY(ticket_body, '["billing", "technical", "sales"]') AS department FROM support_tickets;

AI_EXTRACT(text, question). Pull specific, structured information from unstructured text by simply asking a question.

1SELECT contract_id, aura.AI_EXTRACT(contract_text, 'What is the contract renewal date?') AS renewal_date FROM legal_documents;

To make these capabilities even more accessible, the following table provides a quick-reference guide.

Function name

Description

Example use case

aura.AI_COMPLETE

General-purpose text generation and completion using state-of-the-art LLMs like Claude 3.5 Sonnet.

Generating marketing copy or product descriptions from a list of key features.

aura.AI_SENTIMENT

Analyzes text to return a sentiment classification (e.g., positive, negative, neutral) and score.

Instantly gauging customer sentiment from thousands of product reviews in real time.

aura.AI_TRANSLATE

Translates text between specified source and target languages.

Localizing user-generated content for a global application without an external API.

aura.EMBED_TEXT

Converts text into high-dimensional vector embeddings for semantic search and RAG applications.

Powering a semantic search engine over your company's internal documentation.

aura.AI_SUMMARIZE

Condenses long-form text into a concise summary of a specified length.

Creating executive summaries of lengthy market research reports stored in the database.

aura.AI_CLASSIFY

Categorizes text into a predefined set of labels.

Automatically routing incoming customer support tickets based on their inquiry text.

aura.AI_EXTRACT

Extracts specific pieces of information from a block of text based on a natural language question.

Pulling key terms, dates and counterparties from legal contracts in a text column.

Under the hood: The architecture of simplicity and speed

The magic of AI Functions is not just what they do, but how they do it. Their remarkable performance is not an accident; it is the direct result of a purpose-built architecture designed for speed, scale and real-time processing. When a user executes a query containing an AI Function, a seamless and highly optimized process unfolds:

  1. The SQL query is received by the SingleStore Helios Engine.

  2. The engine recognizes the aura.AI_* function call and, instead of processing it locally, routes the relevant data (e.g., rows and columns to be analyzed) to the dedicated AI UDF Container.

  3. Inside the container, a managed Python environment orchestrates a secure call to the specified foundational model's API for inference.

  4. The model returns a result (e.g., a sentiment classification, a summary), which is passed back to the Helios engine.

  5. The engine incorporates this result into the final query output and returns it to the user.

This entire round trip happens with minimal overhead, but the true performance advantage comes from two core principles of SingleStore's architecture: parallel execution and our unique HTAP design.

This process is optimized for performance through two key architectural advantages:

  • Massively Parallel Processing (MPP). 
    When you run an AI Function on a large table, the workload is automatically distributed and executed in parallel across nodes in the cluster, delivering high throughput.
  • Hybrid Transactional/Analytical Processing (HTAP). 
    Unlike traditional data warehouses that have ingestion latency, SingleStore's HTAP architecture allows AI Functions to run on transactional data the moment it is created. This enables operational AI use cases, like analyzing a financial transaction for fraud
    which is architecturally impossible on pure analytical platforms. 


How to get started

  • Admin for the org navigates to the AI&ML page and enables the set of AI functions

  • View the default InferenceAPIs ( LLM and Embedding models ) enabled for a particular column and information regarding the location where these AI functions are installed and click Deploy
  • The AI functions are now enabled on all databases connected to the cluster
  • Head over to the SQL Editor/Notebook and type in your first hello world example to see these functions in action.
1SELECT aura.AI_COMPLETE('Life is like a box of ..') AS completion

Practical use cases

Here is how AI Functions can be applied to solve real-world business problems.

Use case 1: Automate customer support intelligence

  • Goal: Analyze, route and prioritize thousands of incoming support tickets per hour in real time.
  • Solution: A single SQL query can process new tickets as they are ingested.
  • aura.AI_SENTIMENTflags tickets from highly dissatisfied customers for immediate escalation.

  • aura.AI_CLASSIFY automatically routes the ticket to the correct department (['billing', 'technical', 'returns']).

  • aura.AI_SUMMARIZE creates a brief summary so agents have immediate context.

SQL example:

1SELECT 2  ticket_id,3  aura.AI_SENTIMENT(message_text) as sentiment,4  aura.AI_CLASSIFY(message_text, '["billing", "technical", "returns"]') as department,5  aura.AI_SUMMARIZE(message_text, 10) as summary6FROM support_tickets7WHERE processed = FALSE;

Business value. 
Reduce ticket response times from several minutes to few seconds, bottlenecked only by LLM calls, improve routing accuracy and increase agent efficiency.

Use case 2: Implement real-time fraud detection

  • Goal: Detect and block fraudulent transactions in seconds.
  • Solution: Use a multi-step reasoning process orchestrated entirely in SQL to identify anomalies.  
  1. aura.AI_EXTRACT pulls structured data (e.g., merchant category) from unstructured transaction descriptions.

  2. aura.EMBED_TEXT creates a vector embedding of the transaction's metadata.

  3. DOT_PRODUCT compares the new transaction's vector against a vector of the user's normal spending habits. A low similarity score indicates an anomaly.

  4. aura.AI_COMPLETE acts as a reasoning engine, taking all signals as input to make a final fraud assessment.

SQL example (conceptual):

1-- Within a stored procedure for a new transaction2WITH enriched_transaction AS (3  SELECT4    transaction_id,5    user_id,6    aura.EMBED_TEXT(description, 'openai-text-embed-large') as transaction_vector7  FROM new_transaction8),9comparison AS (10  SELECT11    et.*,12    DOT_PRODUCT(et.transaction_vector, ub.behavior_vector) as similarity_score13  FROM enriched_transaction et14  JOIN user_behavior ub ON et.user_id = ub.user_id15)16SELECT17  transaction_id,18  aura.AI_COMPLETE(19    CONCAT(20      'Is this transaction likely fraudulent (Yes/No) and why? Signals: ',21      'Vector similarity: ', similarity_score, '. ',22      'Merchant Category: Gambling. Time: 3 AM.'23    ), 'claude-4-0-sonnet'24  ) as fraud_assessment25FROM comparison;

Business value.
Move from static rules to a dynamic, context-aware fraud detection engine that identifies novel threats in real time, reducing financial losses without impacting the user experience.

Use case 3: Predict and reduce customer churn

  • Goal: Proactively identify customers at risk of churning to enable targeted retention efforts.
  • Solution: Use an LLM's reasoning capabilities as a powerful zero-shot classifier for churn prediction.  
  1. Aggregate key behavioral metrics for each customer (e.g., login frequency, features used, days since last purchase) using standard SQL.

  2. Calculate a customer_satisfaction_score by running aura.AI_SENTIMENT over all support tickets submitted by each customer.

  3. Feed these aggregated metrics into aura.AI_COMPLETE with a prompt that instructs it to act as a churn prediction model.

SQL example:

1WITH customer_behavior_summary AS (2  -- CTE contains aggregated behavioral metrics and sentiment score3  SELECT user_id, login_freq, avg_sentiment, days_since_purchase FROM...4)5SELECT 6  user_id,7  aura.AI_COMPLETE(8    CONCAT(9      'Act as a churn analyst. Predict if this customer will churn (Yes/No) and give a reason. Data: ',10      'Login Frequency: ', login_freq, ', ',11      'Satisfaction Score: ', avg_sentiment, ', ',12      'Days Since Last Purchase: ', days_since_purchase, '.'13    ), 'claude-4-0-sonnet'14  ) as churn_prediction15FROM customer_behavior_summary;

Business value: 
Democratize predictive modeling and gain explainable churn predictions directly in the database. This allows customer success teams to prioritize outreach and reduce revenue churn.

The platform for enterprise operational AI

The move to embed AI capabilities directly into data platforms is one of the most significant industry shifts in a generation. SingleStore's unique value proposition is for the Application Developer and the Application Engineer. Our focus is on powering the next generation of high-performance, data-intensive, operational AI applications.

Our HTAP architecture is the key. It is purpose-built for the speed and concurrency required to embed AI-powered features directly into customer-facing applications. While our competitors can help you analyze your past with AI, SingleStore empowers you to build the future of your business on AI. We provide the engine for the real-time services that define modern applications: the instant fraud detection, the on-the-fly content personalization, the intelligent recommendation engine that operates on data the moment it is created. 

Our vision extends far beyond the current set of capabilities, and we are excited to share a glimpse of our roadmap.

Our immediate focus will be to complement these powerful, API-calling AI Functions to a broader suite of Real-time data-aware ML Functions.

While AI Functions are exceptional at leveraging the general-purpose intelligence of external foundational models, ML Functions will involve training predictive models on your specific data directly within the database. This will unlock capabilities like:

  • Time-series forecasting. 
    Natively predict future sales, inventory needs or user traffic based on historical patterns in your data.

  • Anomaly detection. 
    Automatically identify outliers and unusual events in real-time data streams without pre-defined rules.

  • Classification and regression. 
    Build and train custom models for tasks like lead scoring or price prediction, tailored to the unique dynamics of your business.

Looking further ahead, our roadmap is guided by key industry trends and customer needs:

  • Expanded model support. 
    We will continuously add support for the latest and greatest models from leading providers, as well as popular open-source models. We also plan to provide pathways for customers to bring their own fine-tuned models to run securely within our containerized environment.

  • Multi-modal capabilities. 
    The world of data is not limited to text. We will soon extend our function catalog and augment existing functions to include capabilities for analyzing images, audio and complex documents natively, mirroring the multi-modal advancements of leading foundational models.

  • Additional AI functions.
    For advanced semantic operations like semantic joins. 

  • Deeper MLOps integration. 
    As more models are deployed within SingleStore, we will introduce tighter integrations with tools for model monitoring, lineage and governance. This will create a more complete, end-to-end platform for managing the entire AI/ML lifecycle with the trust and security enterprises demand

Get started with AI Functions today

You no longer need to move your data to get state-of-the-art insights; you can now build faster, smarter and more responsive applications than ever before.

We invite you to experience the future of data-intensive and real-time AI today. Here’s how you can get started:

  • Try it now. 
    Ready to run your first AI query in SQL? 
    Reach out using the in-portal “Try it” button or to our support teams to get this enabled in your orgs to experiment with the full suite of AI Functions.

  • Dive deeper. 
    Want to explore the syntax, available models and advanced options for each function? Head over to our 
    comprehensive technical documentation.

  • See it in action. 
    Join our upcoming live webinar where our engineers will build a real-time AI application from scratch.

  • Talk to an expert. 
    Have a complex use case or want to discuss how AI Functions can transform your business? 
    Reach out to our support team.


Share

Start building with SingleStore