ChatMessagePromptTemplate.messagesPlaceholder constructor
ChatMessagePromptTemplate.messagesPlaceholder(
- String variableName
Creates a MessagesPlaceholder, a prompt template that assumes the variable is a list of ChatMessage.
This is useful for when you want to use a list of messages in the prompt. For example, after retrieving them from memory.
This is a convenience factory equivalent to MessagesPlaceholder constructor.
If you need to add a single message, use ChatMessagePromptTemplate.messagePlaceholder.
Example:
final promptTemplate = ChatPromptTemplate.fromPromptMessages([
ChatMessagePromptTemplate.system('You are a helpful AI assistant'),
ChatMessagePromptTemplate.messagesPlaceholder('history'),
ChatMessagePromptTemplate.messagePlaceholder('input'),
]);
variableName
the name of the placeholder variable.
Implementation
factory ChatMessagePromptTemplate.messagesPlaceholder(
final String variableName,
) {
return MessagesPlaceholder(variableName: variableName);
}