Home / Function/ pretty_repr() — langchain Function Reference

pretty_repr() — langchain Function Reference

Architecture documentation for the pretty_repr() function in string.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8["pretty_repr()"]
  a3097815_cadb_7ebc_b29a_72117ccf6e27["StringPromptTemplate"]
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8 -->|defined in| a3097815_cadb_7ebc_b29a_72117ccf6e27
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8["pretty_repr()"]
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8 -->|calls| 51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8
  02fe17e5_5037_fda4_3044_50c8e47385c5["pretty_print()"]
  02fe17e5_5037_fda4_3044_50c8e47385c5 -->|calls| 51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8
  f2111c77_3867_1c07_6d6d_01dfad0cc994["format()"]
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8 -->|calls| f2111c77_3867_1c07_6d6d_01dfad0cc994
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8["pretty_repr()"]
  51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8 -->|calls| 51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8
  style 51f6ea54_b5f1_f3c0_e18c_2e8f1d74f2a8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/string.py lines 347–367

    def pretty_repr(
        self,
        html: bool = False,  # noqa: FBT001,FBT002
    ) -> str:
        """Get a pretty representation of the prompt.

        Args:
            html: Whether to return an HTML-formatted string.

        Returns:
            A pretty representation of the prompt.
        """
        # TODO: handle partials
        dummy_vars = {
            input_var: "{" + f"{input_var}" + "}" for input_var in self.input_variables
        }
        if html:
            dummy_vars = {
                k: get_colored_text(v, "yellow") for k, v in dummy_vars.items()
            }
        return self.format(**dummy_vars)

Subdomains

Frequently Asked Questions

What does pretty_repr() do?
pretty_repr() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/string.py.
Where is pretty_repr() defined?
pretty_repr() is defined in libs/core/langchain_core/prompts/string.py at line 347.
What does pretty_repr() call?
pretty_repr() calls 2 function(s): format, pretty_repr.
What calls pretty_repr()?
pretty_repr() is called by 2 function(s): pretty_print, pretty_repr.

Analyze Your Own Codebase

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

Try Supermodel Free