From the course: Level up LLM applications development with LangChain and OpenAI

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Define tools

Define tools

- [Instructor] So for the first parts to get started, we want to define the tools. We're going to define some tools to use, and we're going to start by a very simple example, which is to write a simple python function that we use to calculate the length of a word that we pass in as a parameter. And here, so the way that it is defined, we are going to define it as get word length. We're going to pass in a word, in a string format, and then calculate the length of the number of characters for this word that you pass in as a parameter. So, first you need to add this to the scope. Let's do this so it is already added. You're going to see, you're going to find it here. And so next we're going to actually add this decorator in order to make it a tool. Okay, so we're going to see that more in details and how it works, and I'm going to start by copying this function and add it here. And remember also to add tool, alright? And that's going to allow to give it a specific format and actually…

Contents