Skip to content

docs(core): retired claude-2 model referenced in RunnableWithMessageHistory docstring examples #37173

@AyhamJo7

Description

@AyhamJo7

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

# The two docstring examples on `RunnableWithMessageHistory` in
# `langchain_core.runnables.history` (lines 138 and 191 of `history.py`)
# instantiate the chat model as:
from langchain_anthropic import ChatAnthropic

ChatAnthropic(model="claude-2")
# Anthropic retired the `claude-2` model family in 2025, so anyone
# copy-pasting these examples gets a model-not-found error from the API.

Error Message and Stack Trace (if applicable)

anthropic.NotFoundError: Error code: 404 — {"type":"error","error":{"type":"not_found_error","message":"model: claude-2"}}

Description

The two illustrative examples in the RunnableWithMessageHistory class
docstring (in langchain_core.runnables.history) build a chain with
ChatAnthropic(model="claude-2"). Anthropic retired the claude-2 model
family in 2025, so users copy-pasting the docstring example hit a
not-found error from the Anthropic API.

Expected: the docstring example uses a currently-GA Anthropic model, so
copy-pasting it works.
Actual: the example references a retired model.

Proposed fix: replace both occurrences with claude-sonnet-4-6,
matching the convention already used in langchain_core.runnables.fallbacks
(see the with_fallbacks example). Documentation-only change; no public
API or runtime behavior is affected.

I have a one-file diff ready locally and would like to be assigned this
issue so I can open the PR.

System Info

System Information

OS: Linux
OS Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Python Version: 3.12.3 (main, Mar 23 2026, 19:04:32) [GCC 13.3.0]

Package Information

langchain_core: 1.3.2
langsmith: 0.7.31
langchain_protocol: 0.0.10
langchain_tests: 1.1.7
langchain_text_splitters: 1.1.2

Metadata

Metadata

Labels

bugRelated to a bug, vulnerability, unexpected error with an existing featurecore`langchain-core` package issues & PRsexternal

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions