Skip to content

Commit

Permalink
fix: rename python tool to ipython for better tooluse format adherence
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Dec 22, 2024
1 parent a568795 commit 113fa58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gptme/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def init_tools(allowlist: frozenset[str] | None = None) -> None:
"""Runs initialization logic for tools."""
# init python tool last
tools = list(
sorted(ToolSpec.get_tools().values(), key=lambda tool: tool.name != "python")
sorted(ToolSpec.get_tools().values(), key=lambda tool: tool.name != "ipython")
)
loaded_tool_names = [tool.name for tool in loaded_tools]
for tool in tools:
Expand Down
3 changes: 2 additions & 1 deletion gptme/tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
if TYPE_CHECKING:
from IPython.core.interactiveshell import InteractiveShell # fmt: skip


logger = getLogger(__name__)

# TODO: launch the IPython session in the current venv, if any, instead of the pipx-managed gptme venv (for example) in which gptme itself runs
Expand Down Expand Up @@ -245,7 +246,7 @@ def init() -> ToolSpec:


tool = ToolSpec(
name="python",
name="ipython",
desc="Execute Python code",
instructions=instructions,
examples=examples,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_util_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ def test_tools_info():
runner = CliRunner()

# Test valid tool
result = runner.invoke(main, ["tools", "info", "python"])
result = runner.invoke(main, ["tools", "info", "ipython"])
assert result.exit_code == 0
assert "Tool: python" in result.output
assert "Tool: ipython" in result.output
assert "Description:" in result.output
assert "Instructions:" in result.output

Expand Down

0 comments on commit 113fa58

Please sign in to comment.