langchain.prompts.chat.BaseMessagePromptTemplate¶

class langchain.prompts.chat.BaseMessagePromptTemplate[source]¶

Bases: Serializable, ABC

Base class for message prompt templates.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

abstract format_messages(**kwargs: Any) List[BaseMessage][source]¶

Format messages from kwargs. Should return a list of BaseMessages.

Parameters

**kwargs – Keyword arguments to use for formatting.

Returns

List of BaseMessages.

to_json() Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implemented() SerializedNotImplemented¶
abstract property input_variables: List[str]¶

Input variables for this prompt template.

Returns

List of input variables.

property lc_attributes: Dict¶

Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor.

property lc_namespace: List[str]¶

Return the namespace of the langchain object. eg. [“langchain”, “llms”, “openai”]

property lc_secrets: Dict[str, str]¶

Return a map of constructor argument names to secret ids. eg. {“openai_api_key”: “OPENAI_API_KEY”}

property lc_serializable: bool¶

Whether this object should be serialized.

Returns

Whether this object should be serialized.

model Config¶

Bases: object

extra = 'ignore'¶