mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-05 04:38:26 +00:00
core[patch]: fix API reference for draw_ascii (#29370)
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 <chester.curme@gmail.com>
This commit is contained in:
parent
2df9daa7f2
commit
8f2c11e17b
@ -221,24 +221,37 @@ def draw_ascii(vertices: Mapping[str, str], edges: Sequence[LangEdge]) -> str:
|
|||||||
str: ASCII representation
|
str: ASCII representation
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
>>> vertices = [1, 2, 3, 4]
|
|
||||||
>>> edges = [(1, 2), (2, 3), (2, 4), (1, 4)]
|
.. code-block:: python
|
||||||
>>> print(draw(vertices, edges))
|
|
||||||
+---+ +---+
|
from langchain_core.runnables.graph_ascii import draw_ascii
|
||||||
| 3 | | 4 |
|
|
||||||
+---+ *+---+
|
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)]
|
||||||
+---+ *
|
]
|
||||||
| 2 | *
|
|
||||||
+---+ *
|
|
||||||
* *
|
print(draw_ascii(vertices, edges))
|
||||||
* *
|
|
||||||
**
|
.. code-block:: none
|
||||||
|
|
||||||
+---+
|
+---+
|
||||||
| 1 |
|
| 1 |
|
||||||
+---+
|
+---+
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
+---+ *
|
||||||
|
| 2 | *
|
||||||
|
+---+** *
|
||||||
|
* ** *
|
||||||
|
* ** *
|
||||||
|
* **
|
||||||
|
+---+ +---+
|
||||||
|
| 3 | | 4 |
|
||||||
|
+---+ +---+
|
||||||
"""
|
"""
|
||||||
# NOTE: coordinates might me negative, so we need to shift
|
# NOTE: coordinates might me negative, so we need to shift
|
||||||
# everything to the positive plane before we actually draw it.
|
# everything to the positive plane before we actually draw it.
|
||||||
|
Loading…
Reference in New Issue
Block a user