Fix visualize graph filename to without extension. (#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. - https://github.com/openai/openai-agents-python/pull/451
This commit is contained in:
parent
616d8e7f4b
commit
0a3dfa071a
3 changed files with 4 additions and 6 deletions
|
|
@ -81,7 +81,7 @@ draw_graph(triage_agent).view()
|
|||
デフォルトでは、`draw_graph` はグラフをインラインで表示します。ファイルとして保存するには、ファイル名を指定します:
|
||||
|
||||
```python
|
||||
draw_graph(triage_agent, filename="agent_graph.png")
|
||||
draw_graph(triage_agent, filename="agent_graph")
|
||||
```
|
||||
|
||||
これにより、作業ディレクトリに `agent_graph.png` が生成されます。
|
||||
これにより、作業ディレクトリに `agent_graph.png` が生成されます。
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@ draw_graph(triage_agent).view()
|
|||
By default, `draw_graph` displays the graph inline. To save it as a file, specify a filename:
|
||||
|
||||
```python
|
||||
draw_graph(triage_agent, filename="agent_graph.png")
|
||||
draw_graph(triage_agent, filename="agent_graph")
|
||||
```
|
||||
|
||||
This will generate `agent_graph.png` in the working directory.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,6 @@ def draw_graph(agent: Agent, filename: Optional[str] = None) -> graphviz.Source:
|
|||
graph = graphviz.Source(dot_code)
|
||||
|
||||
if filename:
|
||||
graph.render(filename, format="png")
|
||||
graph.render(filename, format="png", cleanup=True)
|
||||
|
||||
return graph
|
||||
|
|
|
|||
Loading…
Reference in a new issue