I need to build a langchain agent that plans an answer to a specific question, that requires multiple steps to be answerd. So, the idea (taken from this work: https://arxiv.org/pdf/2305.04091.pdf), is the following:
- The agent is faced with a complex question. First, it has to plan an answering strategy, according to the following command:
Let’s first understand the problem and devise a plan to solve the problem. Then, let’s carry out the plan to solve the problem step by step.
- An LLM agent solves one step at the time, until the last one is solved, and provides the correct answer.
How could i do this in python? Let us assume I'm expecting an output as the following:
Q: James decides to run 3 sprints 3 times a week. He runs 60 meters each sprint. How many total meters does he run a week?
A: Let’s first understand the problem and devise a plan to solve the problem. Then, let’s carry out the plan to solve the problem step by step.
Output: Given: James runs 3 sprints 3 times a week. Each sprint is 60 meters. Plan: We need to calculate the total meters run by James in a week. Calculation: Total number of sprints run by James in a week = 3 sprints x 3 times = 9 sprints Total meters run by James in a week = 9 sprints x 60 meters = 540 meters Answer: James runs 540 meters in a week.
Can someone provide me with a guideline on how to build it? Which function to use, how to structure the chain, and an overall intuition of the process?
Thanks!