AI_GENERATE_TEXT (Beta)

Applies to: ✅ Data 360 SQL ❌ Tableau Hyper API

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.

Note

GenAI features are not supported in Salesforce Government Cloud Plus. Please do not turn on or enable these features in Government Cloud Plus orgs. Contact your Salesforce account executive for additional details.

Warning

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 

1AI_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 BY with LIMIT to cap the number of rows sent to the model.
  • input_prompt must be a non-NULL value. Add NON_NULL to the WHERE clause in your SQL statement to avoid NULL value errors.

Examples 

Generate Text from a Literal Prompt 

Generate text from a single prompt.

1SELECT 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.

1SELECT
2  "customerServiceFeedback__c",
3  ai_generate_text('Summarize this customer feedback in one sentence: ' || "customerServiceFeedback__c") AS summary
4FROM "AutomobileServiceFeedback__dll"
5ORDER BY "date__c"
6DESC 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.

1SELECT
2  "Id__c",
3  ai_generate_text(
4    'Write a two-sentence customer brief from these details. Name: ' || "FirstName__c" || ' ' || "LastName__c" ||
5    '. Loyalty tier: ' || "LoyaltyTier__c" ||
6    '. Last purchase category: ' || "LastPurchaseCategory__c" ||
7    '. Recent service issue: ' || "LastCaseSummary__c"
8  ) AS profile_brief
9FROM "UnifiedIndividual__dlm"
10ORDER BY "LastActivityDate__c" DESC
11LIMIT 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.

Related Documentation