From the course: Building Apps with AI Tools: ChatGPT, Semantic Kernel, and Langchain

Unlock this course with a free trial

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

Extracting key information from your question

Extracting key information from your question

- [Instructor] A powerful capability of LLMs is extracting key information from a phrase. It becomes even more amazing when we can map those pieces of information to a Python object. Let's dive into the code. I'm on branch 04_04b. And I'm here in the main file under Source. So, I started off with some imports here. Let's get into those. We're going to be using Pydantic to create classes from LLM responses. What I'd like to do today is to build an information extractor for a furniture store. So, our goal is that if somebody wants to get some type of furniture, we can extract key properties. So, let's get to it. So, let's go ahead and define our first Pydantic schema. I'm going to say class furniture, and then make it a subclass of BaseModel. And let's define some properties. I'm going to say type is a string. Or rather, it's called type. This is the type of furniture we need, and it's going to be a field with a…

Contents