Skip to content

Commit

Permalink
core[patch]: fix API reference for draw_ascii (#29370)
Browse files Browse the repository at this point in the history
typo: no `draw` but `draw_ascii` and other things

now, it works:
<img width="688" alt="image"
src="https://github.com/user-attachments/assets/5b5a8cc2-cf81-4a5c-b443-da0e4426556c"
/>

---------

Co-authored-by: Chester Curme <[email protected]>
  • Loading branch information
WrRan and ccurme authored Jan 23, 2025
1 parent 2df9daa commit 8f2c11e
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions libs/core/langchain_core/runnables/graph_ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,24 +221,37 @@ def draw_ascii(vertices: Mapping[str, str], edges: Sequence[LangEdge]) -> str:
str: ASCII representation
Example:
>>> vertices = [1, 2, 3, 4]
>>> edges = [(1, 2), (2, 3), (2, 4), (1, 4)]
>>> print(draw(vertices, edges))
+---+ +---+
| 3 | | 4 |
+---+ *+---+
* ** *
* ** *
* * *
+---+ *
| 2 | *
+---+ *
* *
* *
**
+---+
| 1 |
+---+
.. code-block:: python
from langchain_core.runnables.graph_ascii import draw_ascii
vertices = {1: "1", 2: "2", 3: "3", 4: "4"}
edges = [
(source, target, None, None)
for source, target in [(1, 2), (2, 3), (2, 4), (1, 4)]
]
print(draw_ascii(vertices, edges))
.. code-block:: none
+---+
| 1 |
+---+
* *
* *
* *
+---+ *
| 2 | *
+---+** *
* ** *
* ** *
* **
+---+ +---+
| 3 | | 4 |
+---+ +---+
"""
# NOTE: coordinates might me negative, so we need to shift
# everything to the positive plane before we actually draw it.
Expand Down

0 comments on commit 8f2c11e

Please sign in to comment.