Home / Function/ _get_profile_limits() — langchain Function Reference

_get_profile_limits() — langchain Function Reference

Architecture documentation for the _get_profile_limits() function in summarization.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  65ce74ec_3821_4fcb_dac2_deac6f30763f["_get_profile_limits()"]
  a622f56b_f697_966d_5bc7_095699ccca34["SummarizationMiddleware"]
  65ce74ec_3821_4fcb_dac2_deac6f30763f -->|defined in| a622f56b_f697_966d_5bc7_095699ccca34
  27600a06_3568_45a8_ef8e_efda7e6f1a1a["__init__()"]
  27600a06_3568_45a8_ef8e_efda7e6f1a1a -->|calls| 65ce74ec_3821_4fcb_dac2_deac6f30763f
  bbfcb116_81e5_842d_5e50_6e8f55a69bc4["_should_summarize()"]
  bbfcb116_81e5_842d_5e50_6e8f55a69bc4 -->|calls| 65ce74ec_3821_4fcb_dac2_deac6f30763f
  82390de3_387f_3a0a_61c0_4eb09524c027["_find_token_based_cutoff()"]
  82390de3_387f_3a0a_61c0_4eb09524c027 -->|calls| 65ce74ec_3821_4fcb_dac2_deac6f30763f
  style 65ce74ec_3821_4fcb_dac2_deac6f30763f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/summarization.py lines 476–491

    def _get_profile_limits(self) -> int | None:
        """Retrieve max input token limit from the model profile."""
        try:
            profile = self.model.profile
        except AttributeError:
            return None

        if not isinstance(profile, Mapping):
            return None

        max_input_tokens = profile.get("max_input_tokens")

        if not isinstance(max_input_tokens, int):
            return None

        return max_input_tokens

Domain

Subdomains

Frequently Asked Questions

What does _get_profile_limits() do?
_get_profile_limits() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/summarization.py.
Where is _get_profile_limits() defined?
_get_profile_limits() is defined in libs/langchain_v1/langchain/agents/middleware/summarization.py at line 476.
What calls _get_profile_limits()?
_get_profile_limits() is called by 3 function(s): __init__, _find_token_based_cutoff, _should_summarize.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free