Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0a3dfa0

Browse filesBrowse files
authored
Fix visualize graph filename to without extension. (openai#554)
Only the file name is needed since graphviz's `render()` automatically adds the file extension. Also, unnecessary .gv (.dot) files are output, so the `cleanup=True` option has been modified to prevent them from being saved. Here is a similar modification, but in a different content. - openai#451
1 parent 616d8e7 commit 0a3dfa0
Copy full SHA for 0a3dfa0

File tree

Expand file treeCollapse file tree

3 files changed

+4
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+4
-6
lines changed

‎docs/ja/visualization.md

Copy file name to clipboardExpand all lines: docs/ja/visualization.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ draw_graph(triage_agent).view()
8181
デフォルトでは、`draw_graph` はグラフをインラインで表示します。ファイルとして保存するには、ファイル名を指定します:
8282

8383
```python
84-
draw_graph(triage_agent, filename="agent_graph.png")
84+
draw_graph(triage_agent, filename="agent_graph")
8585
```
8686

87-
これにより、作業ディレクトリに `agent_graph.png` が生成されます。
87+
これにより、作業ディレクトリに `agent_graph.png` が生成されます。

‎docs/visualization.md

Copy file name to clipboardExpand all lines: docs/visualization.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ draw_graph(triage_agent).view()
7878
By default, `draw_graph` displays the graph inline. To save it as a file, specify a filename:
7979

8080
```python
81-
draw_graph(triage_agent, filename="agent_graph.png")
81+
draw_graph(triage_agent, filename="agent_graph")
8282
```
8383

8484
This will generate `agent_graph.png` in the working directory.
85-
86-

‎src/agents/extensions/visualization.py

Copy file name to clipboardExpand all lines: src/agents/extensions/visualization.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ def draw_graph(agent: Agent, filename: Optional[str] = None) -> graphviz.Source:
132132
graph = graphviz.Source(dot_code)
133133

134134
if filename:
135-
graph.render(filename, format="png")
135+
graph.render(filename, format="png", cleanup=True)
136136

137137
return graph

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.