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

Unlock the full course today

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

Define and structure a prompt

Define and structure a prompt

- [Instructor] Now we look at Prompt Templates, which is the section right below. And we're going to look at how to define and structure a prompt, which is going to help with interfacing with the language model. So what is a prompt? A prompt is a set of instructions or inputs provided by the user to guide the model's behavior and response to generate outputs. And so prompt templates are predefined recipes for generating prompts for the language model. And it's going to help format instructions with variables to tell the language model what behavior and content generation are expected, like this example below. So we're going to use the PromptTemplate class provided by LangChain. And so the prompt template may include instructions, few short examples, and specific context, and also questions for a given task. So in this example, what we do is to define a prompt = PromptTemplate class, and we want to ask the models to generate a name for a company. So the question is, ("What is a good…

Contents