Introduction
In this blog post, you will be guided with the prompt chaining techniques with the real-world example. AiConfig will be utilized for this purpose. First, let us try to understand what AiConfig is all about, then we can deep dive in to the prompt chaining.
AiConfig is an easy-to-use configuration driven application development framework. The beauty of AiConfig is, it's a JSON based config. There are various ways of creating the config, including the programmatic capabilities.
I would highly recommend you to start using the LastMileAI workbooks for building the prompt based apps. Download the AiConfig and then start playing with it. Finetune as per your requirements and design or develop an API to serve the prompt based AI Apps.
Prompt Chaining
Let me take you to the world of prompt chaining with a real-world example of "NYC Trip Planner". This one is an extended code sample based on the original code from AiConfig Python repo. The idea of prompt chaining is to execute a series of prompts, with the output of one prompt will be fed to the next one.
Here's the plan. At high-level, we are going to have a two-step based prompt instruction for performing the NYC Trip Planner. We are going to plan our trip and return the response in JSON, so you could utilize this approach for building an API/Service.
- Tell me 5 fun attractions to do in NYC.
- Generate an itinerary and pricing information ordered by geographic location for these activities:
{{get_activities.output}}
. Return the response in JSON format.
You need to do the following steps and tweak the prompts based on your requirements.
- Download travel.aiconfig.json
- Login to LastMileAI
- Navigate to the Workbooks and then do the following to upload the aiconfig file.
Once the config is loaded, you will be seeing two chained prompts or instructions. As discussed, the first one is for fetching the fun attractions to do in NYC. The workbook prompt cell is named with get_activities, we are going to use that cell as a reference in the next prompt which is basically responsible for producing the itinerary and pricing information order by the geolocation. Also, we are going to return the response in JSON.
Reference
AiConfig Web
AiConfig Open Source
Conclusion
Hope you had a lot of fun with the AiConfig, Prompt chaining and using the LastMileAI workbook. Creativity or imagination is the limit. You can potentially create or build any useful AI based apps or service in a matter of minutes.
Top comments (3)
Really informative! Great post @ranjancse
Looks Great
Great post