From the course: Chat with Your Data Using ChatGPT

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Solution: Let your agent plan and act

Solution: Let your agent plan and act - OpenAI API Tutorial

From the course: Chat with Your Data Using ChatGPT

Solution: Let your agent plan and act

For this solution, I start by defining a clear goal for the agentic reasoning loop, and I'll scroll down to the new section of code starts on line 109. Here's the goal. Develop two to three plausible hypotheses about recurring symbol clusters and page structure. The key is that this is not a single question. It's an objective that can take multiple steps to reach. Here on line 110, I've limited the reasoning loop to four in order to save processing time and to reduce costs. Once the goal is set, I'll have the agent create a plan. here on line 115 using this bill plan prompt function. The plan is a short sequence of concrete analysis actions written as numbered steps. And this is where that loop becomes agentic. The agent is deciding what to do next to make progress rather than waiting for me to tell it what to do. scroll down to line 121. After the plan is generated, I parse the numbered steps using the parseNumberedPlan function. And here on line 122, limit how many the agent is…

Contents