Optimize prompts and topic configuration
When using Generative AI, it's important to understand the best practices related to prompting and topic configuration. This article shares a few key practices, and helps you integrate guardrails to optimize results, and reduce errors and hallucinations in generated responses.
Generative AI settings
Normally, Generative AI settings are configured at the start of the copilot build (see the Generative AI tab once the copilot is created). These settings enable you to define a knowledge base for the copilot and clarify the content leveraged for the generation of answers, including the following:
Website URLs
Uploaded documents
Desired moderation level
Consider these settings as the broadest knowledge base of information for the copilot to be used, unless there are specific instructions configured in a triggered topic flow.
To learn more about the content types supported by Generative AI, and how to boost natural language capabilities, see the following articles:
Dynamic chaining and topic descriptions
Dynamic chaining is a method of automating triggers. This method is usually better than trying to predict every possible topic an end user might trigger, or manually predefining topic phrases. Dynamic chaining is currently a preview feature, but might be enabled in the Generative AI settings.
Example scenario based on housekeeping requests
Before enabling dynamic chaining, a topic might have been configured like the following:
After dynamic chaining has been enabled, a topic would look more like the following:
When enabling dynamic chaining, keep the following in mind:
The topic description helps the AI recognize intent. So, always ensure there's a complete description of what the topic or plugin is intended to offer the end user.
You might not need a topic if your plugin action is well defined and has the appropriate inputs and outputs. In this scenario, the plugin is triggered by dynamic chaining as if it were a topic. Remember that all topic or plugin descriptions define intent.
Whenever possible, try to wrap both inputs and outputs within plugins, rather than embedding the plugin in a topic. This optimizes performance and reduces long term maintenance.
Generative answers with custom instructions
In addition to the Generative AI settings page, you might also add generative answers as a node to any topic flow.
Once a node is added, there are several ways to help optimize prompts. You might include fields for configuring the input prompt, data sources, and custom instructions. Custom instructions have a high return on investment, but are also often ignored.
To locate custom instructions, from the Create generative answers node dialog, select Edit.
Sample prompts
The following examples illustrate a typical copilot experience involving an end user asking questions, which results in the flow of the topic arriving at the generative answers node. The first example shows a prompt without custom instructions, while the second shows a prompt using custom instructions.
Sample prompt without custom instructions
Prompt: What should I consider when buying an electric car (for a Lexus copilot)?
Response: When considering the purchase of an electric car, there are several factors you should take into account to ensure that you make an informed decision that suits your needs and preferences. Here are some key considerations:
Charging Infrastructure: Assess the availability of charging stations at home, work, and in public areas. Some companies offer charging stations for employees, so it's worth checking if this is available at your workplace. ¹
Range: Consider how far you can drive on a single charge and whether it meets your daily commuting needs.
Cost: Evaluate the total cost of ownership, including the purchase price, incentives, tax breaks, and the cost of electricity versus gasoline.
Maintenance: Electric cars typically require less maintenance than traditional gasoline cars, but it's important to understand the long-term maintenance requirements and costs.
Performance: Test drive different models to experience their acceleration, handling, and comfort.
Size and Capacity: Ensure the car fits your personal or family needs in terms of size and cargo space.
Technology: Electric cars often come with advanced technology features. Determine which technology features are important to you, such as regenerative braking, advanced driver-assistance systems, or connectivity options.
Environmental Impact: Consider the environmental benefits of driving an electric car, such as reduced emissions and a smaller carbon footprint.
Resale Value: Research the car's resale value and how well it retains its value over time.
Note
The remaining numbered items, and a recommendation to talk to a friend, were truncated. The answer was already long, which doesn't help Lexus to inspire a car purchase.
Sample prompt with custom instructions
Prompt: What should I consider when buying an electric car (for a Lexus copilot)?
Response: The top three factors to consider when buying an electric car in 2024 are:
Range: Ensure the car's range aligns with your daily travel needs.
Charging Options: Consider the availability and convenience of charging facilities.
Price and Incentives: Factor in the cost, including any available tax benefits or incentives.
For Lexus, the RZ450e stands out in our 2024 electric lineup, offering a blend of luxury and performance with advanced technology features. For detailed information on our electric vehicles, please refer to the Lexus website or contact us directly for personalized assistance.
Tip
In both the custom instructions, as well as the actual input prompt, you can also leverage a formula to make the prompts more dynamic, based on variables existing before the node. The following example shows where the prompt changes, based on the desired focus area and the student’s level (previously asked in the Topic flow).
Note that any prompts and/or instructions configured by the copilot maker aren't submitted to the same level of safety filtering as are end user prompts.