Skip to content
masterclass Buddy

LangChain · Function

convert_to_messages

Converts supported message-like input into a list of BaseMessage objects. It accepts either an iterable of message representations or a PromptValue.

Last updated

Since
v1.7

Syntax

convert_to_messages(messages: Iterable[MessageLikeRepresentation] | PromptValue) -> list[BaseMessage]

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • MessageLikeRepresentation
  • BaseMessage
  • PromptValue
  • messages_from_dict
  • message_chunk_to_message
  • convert_to_openai_messages

Source: convert_to_messages | langchain_core | LangChain Reference. Checked 2026-11-03.