mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 15:16:21 +00:00
cr
This commit is contained in:
parent
46354d4f64
commit
450be8d15f
@ -12,10 +12,10 @@ from langchain.python import PythonREPL
|
||||
from langchain.requests import RequestsWrapper
|
||||
from langchain.serpapi import SerpAPIWrapper
|
||||
from langchain.utilities.bash import BashProcess
|
||||
from langchain.utilities.wsl import WSLProcess
|
||||
from langchain.utilities.powershell import PowerShellProcess
|
||||
from langchain.utilities.google_search import GoogleSearchAPIWrapper
|
||||
from langchain.utilities.powershell import PowerShellProcess
|
||||
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
|
||||
from langchain.utilities.wsl import WSLProcess
|
||||
|
||||
|
||||
def _get_python_repl() -> Tool:
|
||||
@ -41,6 +41,7 @@ def _get_terminal() -> Tool:
|
||||
"Executes commands in a terminal. Input should be valid commands, and the output will be any output from running that command.",
|
||||
)
|
||||
|
||||
|
||||
def _get_wsl() -> Tool:
|
||||
return Tool(
|
||||
"WSL",
|
||||
@ -48,6 +49,7 @@ def _get_wsl() -> Tool:
|
||||
"Executes bash commands in a linux system running on Windows Subsystem for Linux (WSL). Input should be valid bash commands, and the output will be any output from running that command.",
|
||||
)
|
||||
|
||||
|
||||
def _get_powershell() -> Tool:
|
||||
return Tool(
|
||||
"PowerShell",
|
||||
@ -55,6 +57,7 @@ def _get_powershell() -> Tool:
|
||||
"Executes commands in PowerShell. Input should be valid commands, and the output will be any output from running that command.",
|
||||
)
|
||||
|
||||
|
||||
_BASE_TOOLS = {
|
||||
"python_repl": _get_python_repl,
|
||||
"requests": _get_requests,
|
||||
|
@ -17,7 +17,9 @@ class PowerShellProcess:
|
||||
commands = ";".join(commands)
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(["powershell.exe", "-Command", commands]).decode()
|
||||
output = subprocess.check_output(
|
||||
["powershell.exe", "-Command", commands]
|
||||
).decode()
|
||||
|
||||
except subprocess.CalledProcessError as error:
|
||||
return str(error)
|
||||
|
@ -15,7 +15,7 @@ class WSLProcess:
|
||||
if isinstance(commands, str):
|
||||
commands = [commands]
|
||||
commands = ";".join(commands)
|
||||
commands = 'wsl.exe ' + commands
|
||||
commands = "wsl.exe " + commands
|
||||
try:
|
||||
output = subprocess.check_output(commands, shell=True).decode()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user