mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-07 18:35:22 +03:00
In the example for creating a Python REPL tool under the Agent module, the ".run" was omitted in the example. I believe this is required when defining a Tool.
2.2 KiB
2.2 KiB
In [1]:
from langchain.agents import Tool
from langchain.utilities import PythonREPLIn [2]:
python_repl = PythonREPL()In [3]:
python_repl.run("print(1+1)")Out [3]:
'2\n'
In [ ]:
# You can create the tool to pass to an agent
repl_tool = Tool(
name="python_repl",
description="A Python shell. Use this to execute python commands. Input should be a valid python command. If you want to see the output of a value, you should print it out with `print(...)`.",
func=python_repl.run
)