Home / Function/ apply() — langchain Function Reference

apply() — langchain Function Reference

Architecture documentation for the apply() function in context_editing.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2["apply()"]
  2262afd8_6429_0a5f_33b7_2affd1cf9410["ContextEdit"]
  eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2 -->|defined in| 2262afd8_6429_0a5f_33b7_2affd1cf9410
  03942334_6db9_570a_7836_af54672f2984["apply()"]
  03942334_6db9_570a_7836_af54672f2984 -->|calls| eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2
  fe7b3bde_4a2b_18e3_bb12_39dc2996869d["wrap_model_call()"]
  fe7b3bde_4a2b_18e3_bb12_39dc2996869d -->|calls| eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2
  8ea33785_b55b_c969_ea50_490f985dd1bf["awrap_model_call()"]
  8ea33785_b55b_c969_ea50_490f985dd1bf -->|calls| eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2
  03942334_6db9_570a_7836_af54672f2984["apply()"]
  eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2 -->|calls| 03942334_6db9_570a_7836_af54672f2984
  style eb1539c1_1bd9_cd97_dcd3_ca4a0fa011f2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/context_editing.py lines 47–54

    def apply(
        self,
        messages: list[AnyMessage],
        *,
        count_tokens: TokenCounter,
    ) -> None:
        """Apply an edit to the message list in place."""
        ...

Domain

Subdomains

Calls

Frequently Asked Questions

What does apply() do?
apply() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/context_editing.py.
Where is apply() defined?
apply() is defined in libs/langchain_v1/langchain/agents/middleware/context_editing.py at line 47.
What does apply() call?
apply() calls 1 function(s): apply.
What calls apply()?
apply() is called by 3 function(s): apply, awrap_model_call, wrap_model_call.

Analyze Your Own Codebase

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

Try Supermodel Free