From the course: Introduction to AI Orchestration with LangChain and LlamaIndex
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Challenge: LangChain and LlamaIndex strengths and weaknesses
From the course: Introduction to AI Orchestration with LangChain and LlamaIndex
Challenge: LangChain and LlamaIndex strengths and weaknesses
In this chapter, we dug into code for a powerful REACT agent that can reason about various tools that it can use to answer questions. In this challenge, let's add an additional tool. LLMs are infamously terrible at math. In fairness, so are a lot of humans, at least without a pocket calculator in hand. So we'll give our agent its own virtual calculator. In this challenge, you have two objectives. One; add a math tool to the LangChain agent, and two; add a test case to demonstrate math capabilities. A few hints for you; from the starter code we're going to add to the tools array, and there are entire chains that can be used as tools. In particular, there's one called LLMMathChain. And you will need to install an additional module for this to work with the numexpr library. And then add a prompt at the bottom that will test these mathematical abilities. Just think of something like, "What's the square root of 81?" So take a few minutes and give this one a try then join me in the next…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.