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-coreprompt_values
    Module●Since v0.1

    prompt_values

    Prompt values for language model prompts.

    Prompt values are used to represent different pieces of prompts. They can be used to represent text, images, or chat message pieces.

    Attributes

    attribute
    AnyMessage

    A type representing any defined Message or MessageChunk type.

    Functions

    function
    get_buffer_string

    Convert a sequence of messages to strings and concatenate them into one string.

    Classes

    class
    Serializable

    Serializable base class.

    This class is used to serialize objects to JSON.

    It relies on the following methods and properties:

    • is_lc_serializable: Is this class serializable?

      By design, even if a class inherits from Serializable, it is not serializable by default. This is to prevent accidental serialization of objects that should not be serialized.

    • get_lc_namespace: Get the namespace of the LangChain object.

      During deserialization, this namespace is used to identify the correct class to instantiate.

      Please see the Reviver class in langchain_core.load.load for more details.

      During deserialization an additional mapping is handle classes that have moved or been renamed across package versions.

    • lc_secrets: A map of constructor argument names to secret ids.

    • lc_attributes: List of additional attribute names that should be included as part of the serialized representation.

    class
    BaseMessage

    Base abstract message class.

    Messages are the inputs and outputs of a chat model.

    Examples include HumanMessage, AIMessage, and SystemMessage.

    class
    HumanMessage

    Message from the user.

    A HumanMessage is a message that is passed in from a user to the model.

    class
    PromptValue

    Base abstract class for inputs to any language model.

    PromptValues can be converted to both LLM (pure text-generation) inputs and chat model inputs.

    class
    StringPromptValue

    String prompt value.

    class
    ChatPromptValue

    Chat prompt value.

    A type of a prompt value that is built from messages.

    class
    ImageURL

    Image URL for multimodal model inputs (OpenAI format).

    Represents the inner image_url object in OpenAI's Chat Completion API format. This is used by ImagePromptTemplate and ChatPromptTemplate.

    class
    ImagePromptValue

    Image prompt value.

    class
    ChatPromptValueConcrete

    Chat prompt value which explicitly lists out the message types it accepts.

    For use in external schemas.

    View source on GitHub