Skip to content

fix(core): add ChatBedrockConverse to deserialization allowlist#35404

Closed
Balaji Seshadri (gitbalaji) wants to merge 1 commit into
langchain-ai:masterfrom
gitbalaji:fix/core-chat-bedrock-converse-allowlist
Closed

fix(core): add ChatBedrockConverse to deserialization allowlist#35404
Balaji Seshadri (gitbalaji) wants to merge 1 commit into
langchain-ai:masterfrom
gitbalaji:fix/core-chat-bedrock-converse-allowlist

Conversation

@gitbalaji

Copy link
Copy Markdown
Contributor

Summary

Fixes #34645.

  • ChatBedrockConverse was absent from SERIALIZABLE_MAPPING in langchain_core/load/mapping.py.
  • Since langchain-core>=1.2.5 (PR fix(core): serialization patch #34455 tightened the allowlist enforcement), calling langsmith.pull_prompt(..., include_model=True) with a ChatBedrockConverse model raises:
    ValueError: Trying to load an object that doesn't implement serialization:
    allowed_objects='core' only permits core langchain-core classes.
    
  • ChatBedrock and BedrockLLM were already in the mapping — ChatBedrockConverse was simply missed.
  • Fix: one entry added pointing ("langchain_aws", "chat_models", "ChatBedrockConverse")langchain_aws.chat_models.bedrock_converse.ChatBedrockConverse (confirmed via ChatBedrockConverse.get_lc_namespace() returning ["langchain_aws", "chat_models"]).

Areas requiring careful review

  • The serialization key ("langchain_aws", "chat_models", "ChatBedrockConverse") is derived from get_lc_namespace() + class name — confirmed against the source in langchain-ai/langchain-aws.
  • No behaviour change for any other class.

Test plan

  • test_chat_bedrock_converse_in_serializable_mapping — asserts the key is present and maps to the correct module path (no langchain-aws install required)
  • Full tests/unit_tests/load/test_serializable.py suite passes (45 tests)
  • ruff check, ruff format, mypy clean

AI disclaimer: This PR was developed with assistance from Claude Code (Anthropic).

🤖 Generated with Claude Code

@github-actions github-actions Bot added core `langchain-core` package issues & PRs external fix For PRs that implement a fix labels Feb 23, 2026
@codspeed-hq

codspeed-hq Bot commented Feb 23, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 17.65%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

❌ 12 regressed benchmarks
✅ 1 untouched benchmark
⏩ 23 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime test_import_time[HumanMessage] 239.3 ms 281.6 ms -15.02%
WallTime test_import_time[ChatPromptTemplate] 549.8 ms 639.4 ms -14.02%
WallTime test_import_time[tool] 473.5 ms 575 ms -17.65%
WallTime test_import_time[InMemoryVectorStore] 552.5 ms 617.3 ms -10.5%
WallTime test_import_time[LangChainTracer] 410.6 ms 474.2 ms -13.41%
WallTime test_import_time[CallbackManager] 286.4 ms 331.3 ms -13.55%
WallTime test_import_time[RunnableLambda] 442 ms 514.9 ms -14.15%
WallTime test_import_time[Runnable] 444.5 ms 494.5 ms -10.1%
WallTime test_import_time[PydanticOutputParser] 477.6 ms 553.7 ms -13.75%
WallTime test_import_time[Document] 172.1 ms 197.1 ms -12.67%
WallTime test_import_time[InMemoryRateLimiter] 158.6 ms 187.7 ms -15.46%
WallTime test_import_time[BaseChatModel] 482.7 ms 573.5 ms -15.82%

Comparing gitbalaji:fix/core-chat-bedrock-converse-allowlist (0f1fc20) with master (2d1492a)2

Open in CodSpeed

Footnotes

  1. 23 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on master (0b975d4) during the generation of this report, so 2d1492a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@gitbalaji

Copy link
Copy Markdown
Contributor Author

CodSpeed regressions are false positives

All 7 flagged benchmarks are unrelated to this change.

Our change: a single static dict entry added to SERIALIZABLE_MAPPING in langchain_core/load/mapping.py. No logic, no imports, no runtime code paths affected.

Why none of these benchmarks can regress from our change:

  • test_import_time[RunnableLambda/CallbackManager/Runnable/tool/PydanticOutputParser/ChatPromptTemplate] — these measure subprocess import times for completely unrelated modules. mapping.py is not imported as part of any of these import chains (it's only loaded on demand during deserialization). A static dict entry cannot affect import time of RunnableLambda.
  • test_async_callbacks_in_sync — benchmarks async streaming callbacks. No relationship to deserialization mapping.

The consistent ~10–15% regression across 6 unrelated import benchmarks in a single run is a textbook signature of a noisy shared runner, not a real regression. CodSpeed itself warns: "Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data."

`ChatBedrockConverse` was absent from `SERIALIZABLE_MAPPING`, causing
`langchain-core>=1.2.5` to raise a deserialization error when calling
`langsmith.pull_prompt(..., include_model=True)` with a Bedrock Converse
model. `ChatBedrock` and `BedrockLLM` were already allowed; this adds
the missing entry for `ChatBedrockConverse`.

Fixes langchain-ai#34645.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gitbalaji Balaji Seshadri (gitbalaji) force-pushed the fix/core-chat-bedrock-converse-allowlist branch from 5a8eb84 to 0f1fc20 Compare February 24, 2026 01:48

@ccurme ccurme (ccurme) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated with #34510.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core `langchain-core` package issues & PRs external fix For PRs that implement a fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Langsmith include_model broken due to deserialization allowlist

3 participants