Prompt Engineering in Salesforce-

Prompt Engineering in Salesforce-

Artificial intelligence can be thought of as the ability for a computer to perform skills typically associated with human intuition, inference, and reasoning. Though AI entered into our life long back but all of a sudden it becomes a very hot topic and everyone started talking about it.

Why so much attention to AI now –

The sudden attention to AI was arguably caused by ChatGPT, an AI-powered chatbot that can do what no others could. ChatGPT can respond to plain-language questions or requests, and those responses seem like they were written by a human. And because ChatGPT was released to the public, people could experience it,  what it was like to have a conversation with a computer. It was surprising so of course, people started paying attention. AI can be Generative AI or Predictive AI. Since Generative AI can do conversation is human language, it started getting attention.

What is Generative AI:

There are a lot of specific tasks that AI models are trained to perform. Some AI models can just produce numbers while some other can produce variety of images, sounds , documents , emails, solve business problem , models etc. This kind of AI is known as generative AI.

What is NLP (Natural language processing)?

NLP is the language we use in conversations when we read, write, or listen. Natural language is the way we convey information, express ideas, ask questions, tell stories, and engage with each other. 

Natural language processing relies on an understanding of how words are used together, and that lets AI extract the intention behind the words.

NLP is a huge part of generative AI, it’s a subcategory of AI that takes words and turns them into unique images, sounds, and of course other words.

What is LLM (Large Language Model)?

AI that performs NLP are trained on huge amounts of data, which in this case means samples of text written by real people, internet with its billion web pages, is a great source of sample data. Because these AI models are trained on such massive amounts of data, they’re known as large language models (LLMs).  These large language models make it possible to do some incredibly advanced language-related tasks.

What is a Prompt?

To get response from LLM , you need to provide them instructions about what you want. Prompts are those instructions that help LLMs generate great output. Remember the quality of the prompt determines that how well and accurate response you are going to get back from LLM. So, a well craft prompt is the key to get accurate response.

 

What is a Prompt builder in salesforce and how to create custom Prompt builder?

Prompt builder is a tool provided by Salesforce , that allows user to create and test prompt templates.

Prompt builder in Salesforce allows you to create following types of prompt templates as of now –

-          Sales Email  - To generate personalized, targeted emails at scale, design a sales email prompt template. You can reuse your template for different products and customers, getting an LLM to write your emails saves you time and makes email workflows easier. This template can use data from Lead, contact and their related objects.

-          Field Generation - A field generation prompt template is a specific type of prompt template that's designed to return a generated response from an LLM to a specific field on a record. Field generation prompt templates have a direct relationship to record fields.

-          Record Summary - Summarized record data for a complete view of a record.

-          Flex - For any use case that isn’t covered by the other template types, a flex prompt template type is your solution. You can add up to 5 resources in this. Those resources can be salesforce objects, Free text, Flows or Apex classes. So, these templates are obviously used to solve complex business case.

-          Knowledge Answer- You can configure it to provide response from the SF knowledge articles.

-          Contextual Service Replies – Draft service replies based on the context of chat.

-          Grounded Service Replies – Draft service replies based on the data.

 

Article content
Prompt Builder

Who can create and use Prompt Templates –

In Salesforce, you need to assign following Permissions sets –

1.       Prompt Template Manager – To create and manage prompt template.

2.       Prompt Template User – To access and run prompt template.

3.       Einstein Sales email – To draft emails using a sales email prompt template.

 

Key Consideration to write an effective prompt –

While drafting a prompt template consider below point and add them in -

·       What’s the goal of the prompt template?—By declaring the goal of the response first, you can better answer all the subsequent questions.

·       Who is involved?—Describe the participants who send or receive the response, the relationship between the participants, and the relationship between the participants and the response.

·       What’s the context of the prompt template and the response?—Define a setting for the model response, the CRM data to ground the prompt in, and add a command that tells the model what to generate. We will read about grounding more in the next section.

·       What guardrails does this prompt template need to succeed?—Guardrails protect org data and instruct prompt what to do and what not to do. You can add more information like what should model do and what should not do at all. Such as instructions for the response’s style and tone. When giving instruction surrounds them in “””.

 

Grounding Techniques  -

Grounding is the ability to connect model output to the sources of information. If you provide LLMs with access to specific data sources, then grounding enables their output to these data and reduces the chances of inventing content. In salesforce, following grounding techniques can be used –

-          Record merge fields.

-          Related list merge fields.

-          Flow Merge Fields.

-          Apex Merge Fields.

-          Data Model Object Merge Fields.

-          Record Snapshots.

-          RAG (Retrieval augmented generation)

The quality and completeness of the data used for grounding are essential for generating accurate and relevant response. Grounding provides the LLM with the necessary context to produce results that align with user’s expectations. If the grounding data is incomplete or inaccurate , the LLM is going to provide incorrect and inconsistent information.

 

Article content
Prompt Builder

   

1.       Prompt Template workspace:

This space allows you to draft your prompt. Provide complete details instructions , guardrails etc. Follow best practices while creating prompt to get the best response from LLM.

2.       Resource:

Resource allows you to select the resources for the template. The available option in the resource depends upon the Prompt template type.

3.       Resolution Section:

Resolution section shows the complete prompt sent to LLM based on the test input. Each merge field is replaced with real data, but fields marked as sensitive will get masked.

4.       Response:

This section shows the LLM response which you will get for the provided input. As creating prompt is the repetitive process, so you need to iterate, test, and edit the prompt before activating it.

5.       Model:

Here you can select one of the standard provided model or you can also customize certain properties based on your business case.

 After creating those prompt template , next question is where we can use these –

Where these Templates can be used or executed?

The execution of these prompt templates depends upon their types –

a.       Sales email prompt template – Can be run by clicking the draft with Einstein button. This button gets activated and get visible to you, if you have ‘Einstein Email’ Permission set assigned to you. You will see ‘draft with Einstein button’ when creating an email in Salesforce.

b.       Field Generation Prompt Template – A generative AI enabled field icon will appear for the field which needs to have field summary. Please note – you need to have dynamic form enabled and have write permission set to see this icon.

c.       Flex Prompt template – It can be used in a flow or in Apex or in connect REST API.

 

As I mentioned in this article earlier that prompt response depends upon , how well prompt is grounded with the relevant data. While prompt instructions play a very important role, but they can’t compensate for the poor quality of data or missing data. LLM depends upon the provided input rather relying on prior data used for training. Therefore, ensuring accurate , UpToDate and compete data is critical for best performance in AI.

 

Thank you for reading.

 

             

 

Aidan Butler

Subject Matter Expert at EXL

1mo

Fantastic breakdown, Gaurav! The Salesforce Prompt Builder truly shows how enterprise AI prompting is evolving beyond plain input boxes. For those keen on mastering such practical applications, the GSDC Global Generative AI Advance Prompt Engineering Webinar 2025 is a great next step. June 30–July 4  https://www.gsdcouncil.org/upcoming-events/prompt-engineering-webinar-2025?s=Nidhi

Like
Reply

To view or add a comment, sign in

Explore topics