Prompts

A prompt refers to the input given to a language model. It is constructed from multiple components and can be parametrized using prompt templates. A template may include instructions, few-shot examples, and specific context and questions appropriate for a given task.

Prompt Template

A prompt template refers to a reproducible way to generate a prompt. It contains a text string that can take in a set of parameters from the end user and generate a prompt.

Parameters:

  • template: A template serves as a structured framework for creating an individual request. Once a variable is defined within the template, it becomes an independent component input.

ChatMessagePromptTemplate

In situations where the chat model can handle conversations involving various roles, you can use ChatMessagePromptTemplate. This template empowers users to define specific role names for the participants, making it easier to structure and manage multi-role conversations.

Parameters:

  • template: Template used to format an individual request.

  • role: a chat message can be associated with an AI assistant, a human or a system role.

HumanMessagePromptTemplate

The HumanMessagePromptTemplate is used to create human messages.

SystemMessagePromptTemplate

The SystemMessagePromptTemplate is used when the chat message needs to be associated with a system role.

ChatPromptTemplate

The ChatPromptTemplate accepts a variety of message representations. It is used to chain multiple templates together.

Last updated