Home / Function/ dict() — langchain Function Reference

dict() — langchain Function Reference

Architecture documentation for the dict() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  9ecc68a4_1a52_6816_7fd7_ca210db8af19["dict()"]
  f3cef70e_11b0_61c9_7ec0_7308f4b45056["Chain"]
  9ecc68a4_1a52_6816_7fd7_ca210db8af19 -->|defined in| f3cef70e_11b0_61c9_7ec0_7308f4b45056
  d66dd3df_8d8d_1576_bf19_2f49fc27b7ec["prep_inputs()"]
  d66dd3df_8d8d_1576_bf19_2f49fc27b7ec -->|calls| 9ecc68a4_1a52_6816_7fd7_ca210db8af19
  a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c["aprep_inputs()"]
  a668f6fe_95e7_c3c9_3e60_d9c0b67fe88c -->|calls| 9ecc68a4_1a52_6816_7fd7_ca210db8af19
  style 9ecc68a4_1a52_6816_7fd7_ca210db8af19 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/base.py lines 735–757

    def dict(self, **kwargs: Any) -> dict:
        """Dictionary representation of chain.

        Expects `Chain._chain_type` property to be implemented and for memory to be
            null.

        Args:
            **kwargs: Keyword arguments passed to default `pydantic.BaseModel.dict`
                method.

        Returns:
            A dictionary representation of the chain.

        Example:
            ```python
            chain.model_dump(exclude_unset=True)
            # -> {"_type": "foo", "verbose": False, ...}
            ```
        """
        _dict = super().model_dump(**kwargs)
        with contextlib.suppress(NotImplementedError):
            _dict["_type"] = self._chain_type
        return _dict

Subdomains

Frequently Asked Questions

What does dict() do?
dict() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/base.py.
Where is dict() defined?
dict() is defined in libs/langchain/langchain_classic/chains/base.py at line 735.
What calls dict()?
dict() is called by 2 function(s): aprep_inputs, prep_inputs.

Analyze Your Own Codebase

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

Try Supermodel Free