Skip to content

Commit f77d492

Browse files
committed
chore: update graphai docs
1 parent dd4de10 commit f77d492

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,4 +246,4 @@
246246
"youtube": "https://www.youtube.com/@jamesbriggs"
247247
}
248248
}
249-
}
249+
}

graphai/client-reference/graph.mdx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ Get the current graph state.
2828
#### set\_state
2929

3030
```python
31-
def set_state(state: dict[str, Any]) -> "Graph"
31+
def set_state(state: dict[str, Any]) -> Graph
3232
```
3333

3434
Set the graph state.
3535

3636
#### update\_state
3737

3838
```python
39-
def update_state(values: dict[str, Any]) -> "Graph"
39+
def update_state(values: dict[str, Any]) -> Graph
4040
```
4141

4242
Update the graph state with new values.
4343

4444
#### reset\_state
4545

4646
```python
47-
def reset_state() -> "Graph"
47+
def reset_state() -> Graph
4848
```
4949

5050
Reset the graph state to an empty dict.
@@ -53,7 +53,7 @@ Reset the graph state to an empty dict.
5353

5454
```python
5555
def add_edge(source: NodeProtocol | str,
56-
destination: NodeProtocol | str) -> "Graph"
56+
destination: NodeProtocol | str) -> Graph
5757
```
5858

5959
Adds an edge between two nodes that already exist in the graph.
@@ -63,6 +63,20 @@ Adds an edge between two nodes that already exist in the graph.
6363
- `source` - The source node or its name.
6464
- `destination` - The destination node or its name.
6565

66+
#### compile
67+
68+
```python
69+
def compile() -> "Graph"
70+
```
71+
72+
Validate the graph:
73+
- exactly one start node present (or Graph.start_node set)
74+
- at least one end node present
75+
- all edges reference known nodes
76+
- no cycles
77+
- all nodes reachable from the start
78+
Returns self on success; raises GraphCompileError otherwise.
79+
6680
#### get\_callback
6781

6882
```python
@@ -89,3 +103,13 @@ as the default callback when no callback is passed to the `execute` method.
89103

90104
- `callback_class` (`Type[Callback]`): The callback class to use as the default callback.
91105

106+
#### visualize
107+
108+
```python
109+
def visualize(*, save_path: str | None = None)
110+
```
111+
112+
Render the current graph. If matplotlib is not installed,
113+
raise a helpful error telling users to install the viz extra.
114+
Optionally save to a file via `save_path`.
115+

0 commit comments

Comments
 (0)