Home / Class/ CustomFieldMiddleware Class — langchain Architecture

CustomFieldMiddleware Class — langchain Architecture

Architecture documentation for the CustomFieldMiddleware class in test_wrap_model_call_state_update.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f599aae2_9cd8_0a7e_7269_2457bb905f96["CustomFieldMiddleware"]
  949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"]
  f599aae2_9cd8_0a7e_7269_2457bb905f96 -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e
  08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"]
  f599aae2_9cd8_0a7e_7269_2457bb905f96 -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00
  f3526338_26c9_33d3_f0aa_0db46a0fc699["wrap_model_call()"]
  f599aae2_9cd8_0a7e_7269_2457bb905f96 -->|method| f3526338_26c9_33d3_f0aa_0db46a0fc699

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 118–128

        class CustomFieldMiddleware(AgentMiddleware):
            def wrap_model_call(
                self,
                request: ModelRequest,
                handler: Callable[[ModelRequest], ModelResponse],
            ) -> ExtendedModelResponse:
                response = handler(request)
                return ExtendedModelResponse(
                    model_response=response,
                    command=Command(update={"custom_key": "custom_value"}),
                )

Extends

Frequently Asked Questions

What is the CustomFieldMiddleware class?
CustomFieldMiddleware is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py.
Where is CustomFieldMiddleware defined?
CustomFieldMiddleware is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 118.
What does CustomFieldMiddleware extend?
CustomFieldMiddleware extends AgentMiddleware.

Analyze Your Own Codebase

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

Try Supermodel Free