Home / Function/ test_decorator_with_custom_state_schema() — langchain Function Reference

test_decorator_with_custom_state_schema() — langchain Function Reference

Architecture documentation for the test_decorator_with_custom_state_schema() function in test_wrap_model_call.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  306c9d78_760d_0a5c_fd4a_505fedfe5ed2["test_decorator_with_custom_state_schema()"]
  5a3c6db0_0302_046a_d217_22fb3d4e632e["TestWrapModelCallDecorator"]
  306c9d78_760d_0a5c_fd4a_505fedfe5ed2 -->|defined in| 5a3c6db0_0302_046a_d217_22fb3d4e632e
  style 306c9d78_760d_0a5c_fd4a_505fedfe5ed2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py lines 1191–1207

    def test_decorator_with_custom_state_schema(self) -> None:
        """Test decorator with custom state schema."""

        class CustomState(TypedDict):
            messages: list[Any]
            custom_field: str

        @wrap_model_call(state_schema=CustomState)
        def middleware_with_schema(
            request: ModelRequest,
            handler: Callable[[ModelRequest], ModelResponse],
        ) -> ModelCallResult:
            return handler(request)

        assert isinstance(middleware_with_schema, AgentMiddleware)
        # Custom state schema should be set
        assert middleware_with_schema.state_schema == CustomState

Domain

Subdomains

Frequently Asked Questions

What does test_decorator_with_custom_state_schema() do?
test_decorator_with_custom_state_schema() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py.
Where is test_decorator_with_custom_state_schema() defined?
test_decorator_with_custom_state_schema() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call.py at line 1191.

Analyze Your Own Codebase

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

Try Supermodel Free