LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    โŒ˜I

    Chat LangChain

    What can I help with?

    Enter to sendยทShift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corepromptschatChatMessagePromptTemplate
    Classโ—Since v1.8

    ChatMessagePromptTemplate

    Copy
    ChatMessagePromptTemplate(
        self,
        args: Any = (),
        kwargs: Any = {},
    )

    Bases

    BaseStringMessagePromptTemplate

    Attributes

    Methods

    Inherited fromBaseStringMessagePromptTemplate

    Attributes

    Aprompt: StringPromptTemplate
    โ€”

    String prompt template.

    Aadditional_kwargs: dict[str, Any]
    โ€”

    Additional keyword arguments to pass to the prompt template.

    Ainput_variables: list[str]
    โ€”

    Input variables for this prompt template.

    View source on GitHub

    Methods

    Mfrom_template
    โ€”

    Create a class from a string template.

    Mfrom_template_file
    โ€”

    Create a class from a template file.

    Mformat_messages
    โ€”

    Format messages from kwargs.

    Maformat_messages
    โ€”

    Async format messages from kwargs.

    Mpretty_repr
    โ€”

    Human-readable representation.

    Inherited fromBaseMessagePromptTemplate

    Attributes

    Ainput_variables: list[str]
    โ€”

    Input variables for this prompt template.

    Methods

    Mis_lc_serializable
    โ€”

    Return True as this class is serializable.

    Mget_lc_namespace
    โ€”

    Get the namespace of the LangChain object.

    Mformat_messages
    โ€”

    Format messages from kwargs.

    Maformat_messages
    โ€”

    Async format messages from kwargs.

    Mpretty_repr
    โ€”

    Human-readable representation.

    Mpretty_print
    โ€”

    Print a human-readable representation.

    Inherited fromSerializable

    Attributes

    Alc_secrets: dict[str, str]
    โ€”

    A map of constructor argument names to secret ids.

    Alc_attributes: dict[str, Any]
    โ€”

    List of attribute names that should be included in the serialized kwargs.

    Amodel_config

    Methods

    Mis_lc_serializable
    โ€”

    Is this class serializable?

    Mget_lc_namespace
    โ€”

    Get the namespace of the LangChain object.

    Mlc_id
    โ€”

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    โ€”

    Serialize the object to JSON.

    Mto_json_not_implemented
    โ€”

    Serialize a "not implemented" object.

    attribute
    role: str

    Role of the message.

    method
    format

    Format the prompt template.

    method
    aformat

    Async format the prompt template.

    Chat message prompt template.