Introduction to Prompt Chaining
Prompt chaining is a technique that breaks complex AI tasks into a sequence of simpler prompts, with each step focusing on a specific subtask. The output from one step becomes the input for the next, forming a chain of interrelated actions.
By dividing tasks into manageable components, prompt chaining gives you greater control over the AI's reasoning process, leading to more reliable and accurate results.
Why Use Prompt Chaining?
Prompt chaining offers several distinct advantages compared to using a single, complex prompt:
Improved accuracy: Breaking tasks into focused steps leads to more precise results.
Better control: You can inspect intermediate outputs and correct errors before they compound.
Enhanced reasoning: A step-by-step approach mirrors how humans solve problems, leading to more coherent results.
Transparency: The modular structure of prompt chains makes the outputs easier to understand, interpret, and debug.
Reusability: The individual components of a prompt chain can be reused across various tasks and scenarios.
Creating Prompt Chains in Arato
To reference the output of one prompt as the input to another in Arato, follow these steps:
Create the First Prompt (Prompt A):
Start by creating your first prompt using a dataset that serves as a superset for your entire workflow. This dataset should include all the columns you expect to use in the subsequent prompts.Create the Second Prompt (Prompt B):
Add a new prompt that will use the output from Prompt A as input.You can reference any original input variables from the dataset used in Prompt A, even those that were not directly used in the template of Prompt A.
Link Run Results as a Dataset:
In the dataset section of Prompt B, click on the three dots and select "Link run result as dataset." A modal window will appear.Select the source prompt whose output you wish to link (Prompt A, in this example).
Choose the specific run result from Prompt A you want to use. You can select a specific run or the "latest run result" option, which automatically uses the most recent output from Prompt A, so you don’t need to update it each time you make changes.
Click Link. Prompt B will now use the selected run result from Prompt A as its dataset.
Run Prompt A and Then Prompt B:
Once the linkage is set up, you can run Prompt A and then Prompt B to see the results based on the established connections.The output from Prompt A can be accessed in Prompt B using the
linked_response
variable.