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

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corepromptsmessageBaseMessagePromptTemplate
    Class●Since v0.3

    BaseMessagePromptTemplate

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

    Bases

    SerializableABC

    Used in Docs

    • MESSAGE_COERCION_FAILURE

    Attributes

    Methods

    Inherited fromSerializable

    Attributes

    Alc_secrets: dict[str, str]
    —

    A map of constructor argument names to secret ids.

    Alc_attributes: dict
    —

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

    Amodel_config

    Methods

    View source on GitHub
    M
    lc_id
    —

    Return a unique identifier for this class for serialization purposes.

    Mto_json
    —

    Convert the graph to a JSON-serializable format.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    attribute
    input_variables: list[str]
    method
    is_lc_serializable
    method
    get_lc_namespace
    method
    format_messages
    method
    aformat_messages
    method
    pretty_repr
    method
    pretty_print

    Base class for message prompt templates.

    Input variables for this prompt template.

    Return True as this class is serializable.

    Get the namespace of the LangChain object.

    Format messages from kwargs.

    Should return a list of BaseMessage objects.

    Async format messages from kwargs.

    Human-readable representation.

    Print a human-readable representation.