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

Unlock the full course today

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

Create the chain: Prompt + model + parser

Create the chain: Prompt + model + parser

- [Instructor] So the next demonstration is going to feel like a refresher. We're going to create a chain, we're going to compose the chain with multiple components in order to generate a response. So, here it's going to be a chain that I'm going to set as for now an empty string. But it's going to be a chain with a prompt, a model, and an output parser. So first we need to define the prompt. So let's go back up to find where we need to define the prompt. And here we define a template to tell the language model how to behave. And we want to tell the language models to act as a customer support specialist who can answer questions and assist users with general inquiries based on context. So we're going to start by defining the prompts, and we're going to do that first with a system message prompt template, like this. And we're going to do that with this class, which is system prompt template. And we need to initialize it by using this method, which is from_template, and we pass template…

Contents