mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-21 00:35:23 -04:00
Harrison/multiline commands (#2280)
Co-authored-by: Marc Päpper <mpaepper@users.noreply.github.com>
This commit is contained in:
@@ -25,9 +25,12 @@ class PythonREPLTool(BaseTool):
|
||||
"with `print(...)`."
|
||||
)
|
||||
python_repl: PythonREPL = Field(default_factory=_get_default_python_repl)
|
||||
sanitize_input: bool = True
|
||||
|
||||
def _run(self, query: str) -> str:
|
||||
"""Use the tool."""
|
||||
if self.sanitize_input:
|
||||
query = query.strip().strip("```")
|
||||
return self.python_repl.run(query)
|
||||
|
||||
async def _arun(self, query: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user