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-corepromptschatBaseStringMessagePromptTemplate
    Class●Since v0.1

    BaseStringMessagePromptTemplate

    Base class for message prompt templates that use a string prompt template.

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

    Bases

    BaseMessagePromptTemplateABC

    Attributes

    attribute
    prompt: StringPromptTemplate

    String prompt template.

    attribute
    additional_kwargs: dict

    Additional keyword arguments to pass to the prompt template.

    attribute
    input_variables: list[str]

    Input variables for this prompt template.

    Methods

    method
    from_template

    Create a class from a string template.

    method
    from_template_file

    Create a class from a template file.

    method
    format

    Format the prompt template.

    method
    aformat

    Async format the prompt template.

    method
    format_messages

    Format messages from kwargs.

    method
    aformat_messages

    Async format messages from kwargs.

    method
    pretty_repr

    Human-readable representation.

    Inherited fromBaseMessagePromptTemplate

    Methods

    Mis_lc_serializable
    —

    Return True as this class is serializable.

    Mget_lc_namespace
    —

    Get the namespace of the LangChain object.

    Mpretty_print
    —

    Print a pretty representation of the message.

    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

    Mis_lc_serializable
    —

    Return True as this class is 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
    —

    Convert the graph to a JSON-serializable format.

    Mto_json_not_implemented
    —

    Serialize a "not implemented" object.

    View source on GitHub