Skip to content

Fix visualize graph filename to without extension. #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/ja/visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` が生成されます。
4 changes: 1 addition & 3 deletions docs/visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


2 changes: 1 addition & 1 deletion src/agents/extensions/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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