langchain - ✅(Solved) Fix docs(core,langchain): update outdated model references in docstrings and examples to latest GA versions [1 pull requests, 3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36732Fetched 2026-04-16 06:35:48
View on GitHub
Comments
3
Participants
3
Timeline
12
Reactions
0
Author
Timeline (top)
commented ×3labeled ×2mentioned ×2subscribed ×2

Fix Action

Fixed

PR fix notes

PR #36741: docs(core,langchain): update outdated model references in docstrings to current GA models

Description (problem / solution / changelog)

Summary

Per the freshness guidelines added in #36626 and the audit in #36732, several docstrings and illustrative code snippets still reference deprecated or outdated model names. This PR updates them to current GA equivalents:

ProviderOld referenceNew reference
Anthropicclaude-2claude-sonnet-4-20250514
OpenAIgpt-3.5-turbogpt-4o-mini
OpenAIgpt-3.5-turbo-0125gpt-4o-mini
OpenAIgpt-3.5-turbo-0613gpt-4o-mini

Files changed

  • libs/core/langchain_core/runnables/history.py — 2 claude-2 references
  • libs/langchain/langchain_classic/chains/structured_output/base.py — 5 references
  • libs/langchain/langchain_classic/chains/combine_documents/stuff.py
  • libs/langchain/langchain_classic/chains/conversation/base.py — 2 references
  • libs/langchain/langchain_classic/chains/sql_database/query.py
  • libs/langchain/langchain_classic/chains/openai_functions/base.py
  • libs/langchain/langchain_classic/chains/openai_functions/openapi.py
  • libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py
  • libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py

Why this is safe

This change is documentation only — no shipped default parameter values were touched, so it is not a breaking change per the "Maintain stable public interfaces" guideline.

Closes #36732


🤖 This PR was prepared with the help of an AI agent.

Changed files

  • libs/core/langchain_core/runnables/history.py (modified, +2/-2)
  • libs/langchain/langchain_classic/chains/combine_documents/stuff.py (modified, +1/-1)
  • libs/langchain/langchain_classic/chains/conversation/base.py (modified, +2/-2)
  • libs/langchain/langchain_classic/chains/openai_functions/base.py (modified, +1/-1)
  • libs/langchain/langchain_classic/chains/openai_functions/openapi.py (modified, +1/-1)
  • libs/langchain/langchain_classic/chains/sql_database/query.py (modified, +1/-1)
  • libs/langchain/langchain_classic/chains/structured_output/base.py (modified, +5/-5)
  • libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py (modified, +1/-1)
  • libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a feature request, not a bug report or usage question.
  • I added a clear and descriptive title that summarizes the feature request.
  • I used the GitHub search to find a similar feature request and did not find it.
  • I checked the LangChain documentation and API reference to see if this feature already exists.
  • This is not related to the langchain-community package.

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

Feature Description

Per the model reference freshness guidelines added in #36626, docstrings and examples should use current GA model names rather than stale ones. Several files still reference outdated models:

1. claude-2 references

  • libs/core/langchain_core/runnables/history.py (lines 138, 191)
    • Current: ChatAnthropic(model="claude-2")
    • Should be: ChatAnthropic(model="claude-sonnet-4-20250514") or another current GA model

2. gpt-3.5-turbo references in docstrings/examples

  • libs/langchain/langchain_classic/chains/structured_output/base.py (multiple lines)
  • libs/langchain/langchain_classic/chains/combine_documents/stuff.py
  • libs/langchain/langchain_classic/chains/conversation/base.py
  • libs/langchain/langchain_classic/chains/sql_database/query.py
  • libs/langchain/langchain_classic/chains/openai_functions/base.py
  • libs/langchain/langchain_classic/chains/openai_functions/openapi.py
  • libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py
  • libs/langchain/langchain_classic/retrievers/document_compressors/listwise_rerank.py

These should be updated to gpt-4o-mini or another current GA model.

Use Case

Outdated model references in docstrings and examples mislead users into using deprecated or suboptimal models. This directly contradicts the guidance in CLAUDE.md:

"Always use the latest generally available (GA) models when referencing LLMs in docstrings and illustrative code snippets. Avoid preview or beta identifiers unless the model has no GA equivalent. Outdated model names signal stale code and confuse users."

Users copying example code from docstrings end up using models like claude-2 or gpt-3.5-turbo that are either deprecated or no longer the best choice, leading to a suboptimal developer experience.

Proposed Solution

Update all outdated model references in docstrings and illustrative code snippets to their latest GA equivalents:

ProviderOld ReferenceNew Reference
Anthropicclaude-2claude-sonnet-4-20250514
OpenAIgpt-3.5-turbogpt-4o-mini
OpenAIgpt-3.5-turbo-0125gpt-4o-mini
OpenAIgpt-3.5-turbo-0613gpt-4o-mini

Important: This change only affects documentation and illustrative examples, NOT shipped default parameter values (which would be a breaking change per the guidelines).

Alternatives Considered

  1. Only updating langchain-core references and leaving langchain-classic as-is — but the policy applies to all docstrings regardless of package.
  2. Adding deprecation warnings — but this adds complexity for a simple documentation fix.

Additional Context

extent analysis

TL;DR

Update outdated model references in docstrings and examples to their latest GA equivalents, such as replacing claude-2 with claude-sonnet-4-20250514 and gpt-3.5-turbo with gpt-4o-mini.

Guidance

  • Review the proposed solution table to identify the outdated model references that need to be updated.
  • Update the model references in the specified files, such as history.py, base.py, and openapi.py, to use the latest GA models.
  • Verify that the updates do not affect shipped default parameter values, as this would be a breaking change.
  • Consider implementing the change in a separate PR to ensure a clear and focused commit history.

Example

# Before
ChatAnthropic(model="claude-2")

# After
ChatAnthropic(model="claude-sonnet-4-20250514")

Notes

The proposed solution only affects documentation and illustrative examples, and does not introduce any breaking changes. However, it is essential to review the updates carefully to ensure that they align with the established policy and do not introduce any unintended consequences.

Recommendation

Apply the proposed workaround by updating the outdated model references to their latest GA equivalents, as this will improve the accuracy and helpfulness of the documentation and examples.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING