Converting LangChain Messages to OpenAI and Amazon Bedrock Converse Formats

Moya Richards
When building AI applications with LangChain, your chat history usually lives as a list of LangChain message objects like SystemMessage , HumanMessage , AIMessage , and ToolMessage . That format is convenient inside LangChain, but you may eventually need to save the conversation history, inspect it, or send it to different providers such as OpenAI-compatible APIs or Amazon Bedrock Converse. Out Langchain conversation history will be: Converted to OpenAI chat-completions format. Converted to Amaz