langchain - ✅(Solved) Fix docs(anthropic): add missing docstrings to utility functions in chat_models.py [1 pull requests, 1 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#36450Fetched 2026-04-08 02:22:19
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×3closed ×1cross-referenced ×1issue_type_added ×1

Several private utility functions in libs/partners/anthropic/langchain_anthropic/chat_models.py are missing docstrings:

  • _tools_in_params
  • _thinking_in_params
  • _documents_in_params
  • _compact_in_params
  • _lc_tool_calls_to_anthropic_tool_use_blocks

Adding Google-style docstrings with Args and Returns sections to improve readability, consistent with the rest of the file.

Root Cause

Several private utility functions in libs/partners/anthropic/langchain_anthropic/chat_models.py are missing docstrings:

  • _tools_in_params
  • _thinking_in_params
  • _documents_in_params
  • _compact_in_params
  • _lc_tool_calls_to_anthropic_tool_use_blocks

Adding Google-style docstrings with Args and Returns sections to improve readability, consistent with the rest of the file.

Fix Action

Fixed

PR fix notes

PR #36448: docs(anthropic): add docstrings to utility functions in chat_models

Description (problem / solution / changelog)

Closes #36450

Description

Add missing docstrings to five private utility functions in libs/partners/anthropic/langchain_anthropic/chat_models.py:

  • _tools_in_params
  • _thinking_in_params
  • _documents_in_params
  • _compact_in_params
  • _lc_tool_calls_to_anthropic_tool_use_blocks

Each docstring follows the Google Python Style Guide with Args and Returns sections, consistent with the rest of the file.

Type of change

  • Bug fix
  • Documentation/docstring improvement

Changed files

  • libs/partners/anthropic/langchain_anthropic/chat_models.py (modified, +65/-3)
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 didn't 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

Summary

Several private utility functions in libs/partners/anthropic/langchain_anthropic/chat_models.py are missing docstrings:

  • _tools_in_params
  • _thinking_in_params
  • _documents_in_params
  • _compact_in_params
  • _lc_tool_calls_to_anthropic_tool_use_blocks

Adding Google-style docstrings with Args and Returns sections to improve readability, consistent with the rest of the file.

Use Case

When reading or contributing to the LangChain Anthropic integration, several utility functions lack docstrings, making it harder to understand their purpose, arguments, and return values without reading the full implementation.

Proposed Solution

Add Google-style docstrings with Args and Returns sections to the five functions listed above, consistent with the existing docstring style in the file.

Alternatives Considered

No alternatives — docstrings are the standard approach for documenting Python functions.

Additional Context

No response

extent analysis

TL;DR

Add Google-style docstrings with Args and Returns sections to the specified private utility functions in libs/partners/anthropic/langchain_anthropic/chat_models.py to improve readability.

Guidance

  • Identify the five private utility functions (_tools_in_params, _thinking_in_params, _documents_in_params, _compact_in_params, _lc_tool_calls_to_anthropic_tool_use_blocks) in chat_models.py that are missing docstrings.
  • Add Google-style docstrings to each function, including Args and Returns sections, to document their purpose, arguments, and return values.
  • Ensure the docstring style is consistent with the existing docstrings in the file to maintain readability and consistency.
  • Review the updated functions to verify that the docstrings accurately reflect their implementation and behavior.

Example

def _tools_in_params(params):
    """
    Checks if tools are present in the given parameters.

    Args:
        params (dict): The parameters to check.

    Returns:
        bool: True if tools are present, False otherwise.
    """
    # function implementation

Notes

This solution assumes that the existing docstring style in the file is consistent with Google-style docstrings. If the style differs, the added docstrings should be adapted to match the existing style.

Recommendation

Apply workaround: Add the missing docstrings to improve readability and consistency, as this is a standard approach for documenting Python functions.

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