From the course: Prompt Engineering with LangChain

Unlock the full course today

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

Few-shot prompt templates for chat

Few-shot prompt templates for chat

- [Instructor] Few-shot examples are used to provide sample interactions to a chat model, which helps guide its behavior. The purpose of few-shot prompt templates is to select examples dynamically based on the input and format them into a final prompt to provide for the model. These templates demonstrate the desired input and output format as well as the content. This helps ensure that the model can provide relevant and accurate responses. For chat models, few-shot examples typically consist of a simulated conversation between a human and a AI speaker. Each example has a human message input, and expected AI response output. few-shot examples for chat models differ from few-shot examples for standard language models in the following ways. One is they're formatted as dialogues, rather than just input-output pairs. Two, the examples model a conversation between two speakers rather than just an input to an output. Three is that they help teach the conversational flow and tone in addition…

Contents