Applies to: ✅ Data 360 SQL ❌ Tableau Hyper API
note: AI_GENERATE_TEXT is a pilot or beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Directory. Use of this pilot or beta service is at the Customer's sole discretion.
Calls the Nemotron 3 Nano 30B (Beta) large language model (LLM) in a Data 360 SQL query to generate or summarize text. The function returns generated text for each row of data. To get started with this function in beta, turn on Beta Generative AI Models. To find this beta feature: under Platform Tools in Setup, go to Einstein, then to Einstein Generative AI, and then to Einstein Setup.
Syntax
ai_generate_text(<input_prompt>)
Arguments
Required
input_prompt: The text prompt sent to the model. This can be a column, a literal, or an expression that composes a prompt from other columns (for example, by using the string concatenation operator).
Returns
Returns generated text for each row according to the input prompt. A language model generates the output, so the same prompt can produce different text on different runs.
Considerations
- This is a beta function, and its output behavior may change during the beta period.
- When you turn on Beta Generative AI Models, the underlying model (NVIDIA Nemotron 3 Nano 30B on Amazon (Beta)) is enabled by default. If the model isn't available, queries that call this function fail with a "model not available" error. To verify that the model is available, open the App Launcher, select AI Models, choose Library (Generative), and confirm that NVIDIA Nemotron 3 Nano 30B on Amazon (Beta) appears under Model Name. For the models that support generative AI features, see Supported Models for Generative AI Features.
- Requests to the function time out after 30 seconds. To stay within the timeout, reduce the amount of data the query processes. For example, use
ORDER BYwithLIMITto cap the number of rows sent to the model. input_promptmust be a non-NULL value. AddNON_NULLto theWHEREclause in your SQL statement to avoidNULLvalue errors.
Examples
Generate Text from a Literal Prompt
Generate text from a single prompt.
SELECT ai_generate_text(input_prompt => 'Write a one-sentence thank-you note to a customer.') AS generated_text
Returns the generated text for the prompt.
Summarize Table Data
Generate a short summary of customer feedback for each row in a table.
SELECT
"customerServiceFeedback__c",
ai_generate_text('Summarize this customer feedback in one sentence: ' || "customerServiceFeedback__c") AS summary
FROM "AutomobileServiceFeedback__dll"
ORDER BY "date__c"
DESC LIMIT 10
This example builds the prompt for each row with the string concatenation operator (||). The operator joins the fixed instruction text, 'Summarize this customer feedback in one sentence: ', to the value in the customerServiceFeedback__c column, so each row sends its own feedback text to the model as part of the prompt.
Returns a one-sentence summary of the feedback for each row.
Create a Unified Customer Profile Brief
Compose a prompt from identity, purchase, and service fields on a unified profile to generate a short brief for sales or service users.
SELECT
"Id__c",
ai_generate_text(
'Write a two-sentence customer brief from these details. Name: ' || "FirstName__c" || ' ' || "LastName__c" ||
'. Loyalty tier: ' || "LoyaltyTier__c" ||
'. Last purchase category: ' || "LastPurchaseCategory__c" ||
'. Recent service issue: ' || "LastCaseSummary__c"
) AS profile_brief
FROM "UnifiedIndividual__dlm"
ORDER BY "LastActivityDate__c" DESC
LIMIT 25
This example uses the string concatenation operator (||) to build a prompt from several profile fields, so the model generates a personalized brief for each customer. ORDER BY with LIMIT keeps the query within the 30-second timeout by capping how many rows are sent to the model.