Skip to content

Commit

Permalink
fix: fixed prompt for python tool
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 6, 2024
1 parent 639e4cb commit 64f9491
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions gptme/tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
if TYPE_CHECKING:
from IPython.terminal.embed import InteractiveShellEmbed # 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 @@ -180,19 +179,14 @@ def get_installed_python_libraries() -> set[str]:
#### It can write an example and then execute it:
> User: compute fib 10
> Assistant: To compute the 10th Fibonacci number, we write a recursive function:
{ToolUse("ipython", [], '''
def fib(n):
...
''').to_output()}
Now, let's execute this code to get the 10th Fibonacci number:
> Assistant: To compute the 10th Fibonacci number, we can execute this code:
{ToolUse("ipython", [], '''
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
fib(10)
''').to_output()}
'''.strip()).to_output()}
> System: Executed code block.
{ToolUse("result", [], "55").to_output()}
""".strip()
Expand Down

0 comments on commit 64f9491

Please sign in to comment.