Home / Function/ box() — langchain Function Reference

box() — langchain Function Reference

Architecture documentation for the box() function in graph_ascii.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  333b0598_86ec_e08e_fb9e_97bb5d448e1d["box()"]
  76bb01c4_195c_1bd6_3c3d_0ecb71e225e5["AsciiCanvas"]
  333b0598_86ec_e08e_fb9e_97bb5d448e1d -->|defined in| 76bb01c4_195c_1bd6_3c3d_0ecb71e225e5
  89ad4f5d_065c_e8f6_983b_d18b7460b090["draw_ascii()"]
  89ad4f5d_065c_e8f6_983b_d18b7460b090 -->|calls| 333b0598_86ec_e08e_fb9e_97bb5d448e1d
  d9684099_24e5_2267_1d5c_54ff6c1d5f0d["point()"]
  333b0598_86ec_e08e_fb9e_97bb5d448e1d -->|calls| d9684099_24e5_2267_1d5c_54ff6c1d5f0d
  style 333b0598_86ec_e08e_fb9e_97bb5d448e1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/runnables/graph_ascii.py lines 160–190

    def box(self, x0: int, y0: int, width: int, height: int) -> None:
        """Create a box on ASCII canvas.

        Args:
            x0: x coordinate of the box corner.
            y0: y coordinate of the box corner.
            width: box width.
            height: box height.

        Raises:
            ValueError: if box dimensions are invalid.
        """
        if width <= 1 or height <= 1:
            msg = "Box dimensions should be > 1"
            raise ValueError(msg)

        width -= 1
        height -= 1

        for x in range(x0, x0 + width):
            self.point(x, y0, "-")
            self.point(x, y0 + height, "-")

        for y in range(y0, y0 + height):
            self.point(x0, y, "|")
            self.point(x0 + width, y, "|")

        self.point(x0, y0, "+")
        self.point(x0 + width, y0, "+")
        self.point(x0, y0 + height, "+")
        self.point(x0 + width, y0 + height, "+")

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does box() do?
box() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/graph_ascii.py.
Where is box() defined?
box() is defined in libs/core/langchain_core/runnables/graph_ascii.py at line 160.
What does box() call?
box() calls 1 function(s): point.
What calls box()?
box() is called by 1 function(s): draw_ascii.

Analyze Your Own Codebase

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

Try Supermodel Free