Home / Function/ _build_limit_exceeded_message() — langchain Function Reference

_build_limit_exceeded_message() — langchain Function Reference

Architecture documentation for the _build_limit_exceeded_message() function in model_call_limit.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  e2f72737_9375_a63d_9045_66bd6c4593f9["_build_limit_exceeded_message()"]
  cd424b61_a87c_1279_2846_1393c1806d7b["model_call_limit.py"]
  e2f72737_9375_a63d_9045_66bd6c4593f9 -->|defined in| cd424b61_a87c_1279_2846_1393c1806d7b
  d7b54633_133e_d298_79a0_6d077bb6e8f2["__init__()"]
  d7b54633_133e_d298_79a0_6d077bb6e8f2 -->|calls| e2f72737_9375_a63d_9045_66bd6c4593f9
  42246a70_bac1_7ccd_4e78_d9a0900cd789["before_model()"]
  42246a70_bac1_7ccd_4e78_d9a0900cd789 -->|calls| e2f72737_9375_a63d_9045_66bd6c4593f9
  style e2f72737_9375_a63d_9045_66bd6c4593f9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/model_call_limit.py lines 37–60

def _build_limit_exceeded_message(
    thread_count: int,
    run_count: int,
    thread_limit: int | None,
    run_limit: int | None,
) -> str:
    """Build a message indicating which limits were exceeded.

    Args:
        thread_count: Current thread model call count.
        run_count: Current run model call count.
        thread_limit: Thread model call limit (if set).
        run_limit: Run model call limit (if set).

    Returns:
        A formatted message describing which limits were exceeded.
    """
    exceeded_limits = []
    if thread_limit is not None and thread_count >= thread_limit:
        exceeded_limits.append(f"thread limit ({thread_count}/{thread_limit})")
    if run_limit is not None and run_count >= run_limit:
        exceeded_limits.append(f"run limit ({run_count}/{run_limit})")

    return f"Model call limits exceeded: {', '.join(exceeded_limits)}"

Domain

Subdomains

Frequently Asked Questions

What does _build_limit_exceeded_message() do?
_build_limit_exceeded_message() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py.
Where is _build_limit_exceeded_message() defined?
_build_limit_exceeded_message() is defined in libs/langchain_v1/langchain/agents/middleware/model_call_limit.py at line 37.
What calls _build_limit_exceeded_message()?
_build_limit_exceeded_message() is called by 2 function(s): __init__, before_model.

Analyze Your Own Codebase

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

Try Supermodel Free