Home / Function/ test_pydantic_model_with_secret_dict() — langchain Function Reference

test_pydantic_model_with_secret_dict() — langchain Function Reference

Architecture documentation for the test_pydantic_model_with_secret_dict() function in test_secret_injection.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  166861cc_2877_c618_bd3a_576f829c6fdb["test_pydantic_model_with_secret_dict()"]
  5bcc852a_907e_cf18_edf6_b688fb3f8ccb["TestPydanticModelTopLevel"]
  166861cc_2877_c618_bd3a_576f829c6fdb -->|defined in| 5bcc852a_907e_cf18_edf6_b688fb3f8ccb
  9667a3de_eb6c_d235_9e9f_0bb0ddcacee3["_assert_no_secret_leak()"]
  166861cc_2877_c618_bd3a_576f829c6fdb -->|calls| 9667a3de_eb6c_d235_9e9f_0bb0ddcacee3
  style 166861cc_2877_c618_bd3a_576f829c6fdb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/load/test_secret_injection.py lines 188–202

    def test_pydantic_model_with_secret_dict(self) -> None:
        """Pydantic model containing a secret-like dict directly."""

        class MyModel(BaseModel):
            data: dict[str, Any]

        payload = MyModel(data=MALICIOUS_SECRET_DICT)
        _assert_no_secret_leak(payload)

        # Test treatment of "parsed" in additional_kwargs
        msg = AIMessage(content=[], additional_kwargs={"parsed": payload})
        gen = ChatGeneration(message=msg)
        _assert_no_secret_leak(gen)
        round_trip = load(dumpd(gen))
        assert MyModel(**(round_trip.message.additional_kwargs["parsed"])) == payload

Domain

Subdomains

Frequently Asked Questions

What does test_pydantic_model_with_secret_dict() do?
test_pydantic_model_with_secret_dict() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/load/test_secret_injection.py.
Where is test_pydantic_model_with_secret_dict() defined?
test_pydantic_model_with_secret_dict() is defined in libs/core/tests/unit_tests/load/test_secret_injection.py at line 188.
What does test_pydantic_model_with_secret_dict() call?
test_pydantic_model_with_secret_dict() calls 1 function(s): _assert_no_secret_leak.

Analyze Your Own Codebase

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

Try Supermodel Free