Skip to content
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

fix: rename python tool to ipython for better tooluse format adherence #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
fix: rename python tool to ipython for better tooluse format adherence
  • Loading branch information
ErikBjare committed Dec 22, 2024
commit 113fa5885dca82b61436e4d5d34068a9de45053a
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
Loading