before_model() — langchain Function Reference
Architecture documentation for the before_model() function in test_framework.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee["before_model()"] a8d1868f_6ff2_5369_173c_c9fc7f2da6be["CustomMiddleware"] 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee -->|defined in| a8d1868f_6ff2_5369_173c_c9fc7f2da6be 8d3bffd7_818e_92df_028f_7ddeaca51628["before_model()"] 8d3bffd7_818e_92df_028f_7ddeaca51628 -->|calls| 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee a41c6a20_8b97_0a4a_2b59_d2382a4f2d2f["before_model()"] a41c6a20_8b97_0a4a_2b59_d2382a4f2d2f -->|calls| 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee 79d43dca_0561_c279_c472_317e6bd19324["before_model()"] 79d43dca_0561_c279_c472_317e6bd19324 -->|calls| 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee 8d3bffd7_818e_92df_028f_7ddeaca51628["before_model()"] 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee -->|calls| 8d3bffd7_818e_92df_028f_7ddeaca51628 style 8eb23e9c_37a8_6540_bfd3_b42a64a7cbee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py lines 365–369
def before_model(self, state: AgentState[Any], runtime: Runtime) -> dict[str, Any]:
assert "omit_input" not in state
assert "omit_output" in state
assert "private_state" not in state
return {"omit_input": "test", "omit_output": "test", "private_state": "test"}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does before_model() do?
before_model() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py.
Where is before_model() defined?
before_model() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py at line 365.
What does before_model() call?
before_model() calls 1 function(s): before_model.
What calls before_model()?
before_model() is called by 3 function(s): before_model, before_model, before_model.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free