Retool AI Action
The following lab demonstrates some basic steps for engineering more effective prompts in Retool AI Actions and incorporating Retool Vectors for Retrieval Augmented Generation (RAG).
Requirements
- Create a vector with the automotive maintenance manual
- Have Retool AI enabled, Retool Vectors, AI Actions enabled in Settings > Retool AI.
Steps
Create vector using a Text file
This required portion of the lab is available as a separate artifact in Creating Vectors in Retool Vectors. Complete this first before continuing with the rest of the instructions.
Create a simple maintenance application
A simple maintenance application is used to provide a visual means to validate / test prompts.
Create app and place select and text area components
- Select Apps > Create > App and rename to
auto-maintenance-manual
and create a page calledmanual
. - Add a select input, rename the tag to
selectAnswers
, with a label ofQuick answers
. - Add a text area below the select input, rename the tag to
instructionTextArea
, labelledInstructions
, to the canvas to represent the query from the user and the response from the LLM.
The following demonstrates the previous steps:
- Update select input to have values for
Changing wiper blades
,Changing oil
,Replacing battery
andThe vehicle won't start. What do I do?
.
The following demonstrates the previous steps:
Create AI Action query
- Select Code > + > AI Action to create a query named
getInstructionManual
, Resource set toRetool AI
, Action set toGenerate text
. - Select the instructionTextArea component and in the right panel update the Content > Default value to the following:
{{{getInstructionManual.data}}}
The following demonstrates the previous steps:
Create event handler for selectAnswers
- Select the selectAnswers component.
- In the right-panel, select Event handlers > +
- Event is set to
Change
, Action set toControl query
, and Query is set togetInstructionManual
.
The following demonstrates the previous steps:
Create initial prompt
With the previous work completed, the remaining parts of this lab will focus on adjusting the AI Action values to see the effect on the results. The goal is to start with a generic prompt and continue to engineer it to provide more structure and relevant results.
My AutoRVC Model 1 won't start; what should I do?
If your AutoRVC Model 1 won't start, here are some troubleshooting steps you can take to diagnose and potentially resolve the issue:
1. **Check the Power Source**:
- Ensure the device is properly plugged in (if applicable).
- Check the power outlet to confirm it’s working by testing it with another device.
- If it’s battery-operated, make sure the batteries are charged or replace them with new ones.
2. **Inspect the Connections**:
- Check all cables and connections for damage or looseness. Reseat any connectors that appear to be loose.
- If there are any external devices connected, try disconnecting them to see if the model starts without them.
3. **Look for Error Indicators**:
- Check for any error lights, beeping sounds, or flashing indicators on the device. Refer to the user manual for what these indicators mean.
4. **Reset the Device**:
- Sometimes a simple reset can solve the problem. This can usually be done by turning the unit off, unplugging it, waiting a minute, and then plugging it back in and turning it on.
5. **Consult the User Manual**:
- Refer to the user manual for any specific troubleshooting steps that apply to starting issues. There may be specific procedures for your model.
6. **Check for Overheating**:
- If the device feels hot, allow it to cool down before attempting to start it again.
7. **Software Issues**:
- If the device has firmware or software, consider looking for updates that might address startup issues.
8. **Inspect for Mechanical Issues**:
- Open the device (if you're comfortable doing so) to look for any mechanical problems. Look for jammed parts, disconnected wires, or other visible issues.
9. **Contact Support**:
- If all else fails, it may be necessary to contact the manufacturer's customer support for further assistance. They can provide additional troubleshooting specific to your model and might be able to guide you through repairs.
By following these steps, you should be able to diagnose the problem or determine if you need professional help.
The following demonstrates the previous steps:
Update prompt to incorporate structure and dynamic data
A common first step is to organize the prompt into distinct sections identifying the question, input data to start.
- Select the
getInstructionManual
query and update the Input to the following entry:
Context:
The AutoRCV Model 1 EV manual covers activities like replacing items (e.g., light bulbs, fuses, windshield wiper blades, lubricants) as well as providing an overview of operation of the vehicle and general maintenance schedules.
Instructions:
{{ selectAnswers.selectedItem.value}}
The following demonstrates the previous steps:
Update prompt to incorporate system message
The system message helps identify the persona (style of response) and response format.
You are a customer service representative who is an expert in automotive maintenance.
You can provide facts to general maintenance questions about the AutoRCV Model 1 EV vehicle that would be found in an owner's vehicle manual.
The following demonstrates the previous steps:
Update system message to provide few shot learning
To help improve the structure and consistency of the response, we can provide examples. This is referred to as few-shot learning
.
Below are two examples that help structure the output placed into the system message.
Examples (optional):
Example 1:
Overview: The AutoRCV Model 1 EV ....
Instructions:
Step 1: Do XX and YY and ZZ
Step 2: Do AA and BB and CC
Parts:
1) Part description 1 - part number XXX
2) Part description 2 - part number YYY
Tools:
1) None
Example 2:
Overview: The AutoRCV Model 1 EV mail fail to start due to ...
Instructions:
Step 1: Do XX and YY and ZZ
Step 2: Do AA and BB and CC
Parts:
1) Part description 1 - part number XXX
2) Part description 2 - part number YYY
3) Part description 3 - part number ZZZ
Tools:
1) 1 Phillips Screwdriver
2) Rubber Mallet
The following demonstrates the previous steps:
Update prompt to change Temperature and specify Retool Vector(s)
The final step is adjust the temperature and addition of a vector.
- Select Temperature and change from 1 to 0.2. This will reduce the variability in responses and make them more consistent.
- In the AI Action prompt, select Use Retool Vectors to provide more context to your query. Under the
Select Vector
, specifysample-automotive-manual
.
The addition of one or more vectors will provide additional context added to the prompt and sent to the LLM.
Here is an output of one of the responses:
"Overview: The AutoRCV Model 1 EV uses a secondary battery in addition to the main battery pack. The secondary battery provides an electrical source for vehicle starter and cockpit electronics in the event the main battery pack is drained to zero charge. The following steps provide instructions on how to replace the secondary battery.
Instructions:
Step 1: Turn off the vehicle.
Step 2: Disconnect the red cable from the positive terminal and the black cable from the negative terminal of the existing battery.
Step 3: Remove the placement bolts and harness, and set them aside.
Step 4: Remove the old battery from the battery tray and place it away from the vehicle.
Step 5: Insert a new battery (Part number: EEG-771091) into the battery tray.
Step 6: Attach the harness and tighten the bolts.
Step 7: Apply lubricant (Part number: ELB-110021) generously on the positive terminal, ensuring not to touch the negative terminal.
Step 8: Apply lubricant (Part number: ELB-110021) generously on the negative terminal, ensuring not to touch the positive terminal.
Step 9: Attach the black cable to the negative terminal and tighten it.
Step 10: Attach the red cable to the positive terminal and tighten it.
Step 11: Turn on the vehicle.
Step 12: Reset the clock and settings to match the current time and date.
Parts:
1) Secondary Battery - Part number: EEG-771091
2) Lubricant - Part number: ELB-110021
Tools:
1) Socket wrench
2) ½” socket"
The following demonstrates the previous steps: