Skip to content

docs(messages): add serialization section with dump/load examples#3361

Open
Youngho Kim (JadenKim-dev) wants to merge 2 commits intolangchain-ai:mainfrom
JadenKim-dev:docs/add-serialization-section-to-messages
Open

docs(messages): add serialization section with dump/load examples#3361
Youngho Kim (JadenKim-dev) wants to merge 2 commits intolangchain-ai:mainfrom
JadenKim-dev:docs/add-serialization-section-to-messages

Conversation

@JadenKim-dev
Copy link
Copy Markdown
Contributor

Overview

Adds a "Serialization" section to the messages guide covering how to serialize and deserialize LangChain message objects using dump()/load() (JS) and dumpd()/load() (Python). This addresses a long-standing gap where there was no documentation on persisting messages to a database and restoring them.

Type of change

Type: Update existing documentation

Related issues/PRs

Checklist

  • I have read the contributing guidelines, including the language policy
  • I have tested my changes locally using docs dev
  • All code examples have been tested and work correctly
  • I have used root relative paths for internal links
  • I have updated navigation in src/docs.json if needed

Adds a new "Serialization" section to the messages guide covering
dump()/load() usage for persisting and restoring message objects.
Includes Python (dumpd/load) and JS (dump/load) examples with
language-specific security warnings based on each implementation's
actual security model.
@github-actions github-actions Bot added langchain For docs changes to LangChain oss external User is not a member of langchain-ai labels Mar 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

❌ Import check failed

This PR contains imports from langchain_core that should be imported from langchain instead.

Detailed issues
Analyzing diff for import issues...
 Found 1 import issues:

File: src/oss/langchain/messages.mdx
Line: 1813
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------

 Found 1 import issues that need to be fixed.

Why this is a problem

The langchain package re-exports many modules and classes from langchain_core. When possible, imports should use langchain instead of langchain_core for:

  • Better user experience (single import source)
  • Consistency across documentation
  • Reduced cognitive load for users

How to fix

Replace the imports as suggested above. For example:

  • from langchain_core.messages import HumanMessage
  • from langchain.messages import HumanMessage

🤖 Automated check

This check is based on the latest analysis of langchain re-exports from langchain_core.

@JadenKim-dev Youngho Kim (JadenKim-dev) marked this pull request as ready for review March 29, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant