If you have integrated a Custom LLM, continue to add prompts. If not, skip this article and see Co-Pilot and Dynamic Conversations features.
Effective prompts play a crucial role in enhancing response accuracy when interacting with LLMs. The new Prompts Library module empowers bot designers by allowing them to create and test suitable prompts for their specific use cases. It also displays all the newly added and default request/prompt templates for the integrated models with their status as active or inactive. The default prompts are related to the pre-built models. However, you can import any default prompt, customize it, and use it for a custom LLM model.
The post-processor for prompts allows designers to align LLM responses perfectly with Platform expectations. Designers can modify the LLM response to guarantee the correct behavior and high-quality interactions during runtime.
Pre-requisites
Ensure that you have Integrated a Custom LLM successfully before proceeding further. For more information, see Custom LLM Integration.
How to add Prompts and Requests
To add a new prompt, follow the steps:
- Go to Build > Natural Language > Generative AI & LLM.
- On the top right corner of the Prompts and Requests Library section, click +Add New.
- Enter the prompt name. Select the feature and the respective model.
- The Configuration section consists of End-point URLs, Authentication, and Header values required to connect to a large language model. These are auto-populated based on the input provided while model integration and are not editable.
- In the Request section, you can either create a request from scratch or import the existing prompt from the Library to modify as needed.
- To import an existing prompt, do the following:
- Click Import from Prompts and Requests Library. All the prompts related to the pre-built LLM are displayed without integrating them. In the case of custom prompts, all the added prompts are displayed.
- Select the Feature from the dropdown menu, select the Model, and select the Prompt (in case of custom prompts only) from the dropdown menu. Hover over and click Preview Prompt to view the prompt before importing.
Note: You have the flexibility to interchange a prompt designated for one feature with that of another, and vice versa.
- Click Confirm to get it imported into the JSON body.
- Click Import from Prompts and Requests Library. All the prompts related to the pre-built LLM are displayed without integrating them. In the case of custom prompts, all the added prompts are displayed.
- To create a prompt from scratch, click Start from scratch and enter the JSON request the LLM.
- To import an existing prompt, do the following:
- Once you type the JSON, the Sample Context Values fields are displayed. Fill in the values and click Test.
- If the request values are correct, the response from the LLM is displayed. If not, an error message is displayed.
- In the Actual Response section, double-click the Key that should be used to generate the response path. For example, double-click the text key and click Save.
- The Response Path is displayed. Click Lookup Path.
- The Actual Response and Expected Response are displayed.
- If the response structure matches, the responses will be in green. Click Save. Skip to Step 11.
Note: Both Actual Response and Expected Response are not editable.
- If the response structure does not match, the responses will be in red. Click Configure to modify the Actual Response. The Post Processor Script is displayed.
- If the response structure matches, the responses will be in green. Click Save. Skip to Step 11.
- (Only for GenAI Node) Enter the Exit Scenario Key-Value fields and Virtual Assistance Response Key. The Exit Scenario Key-Value fields help identify when to end the interaction with the GenAI model and return to the dialog flow. A Virtual Assistance Response Key is available in the response payload to display the VA’s response to the user.
- Click Save. The request is added and displayed in the Prompts and Requests Library section.
- Now proceed to enable Co-Pilot Features and Dynamic Conversations features.