2023-10-23 13:22:10 +08:00
|
|
|
# LangChain 的 Shell 工具
|
2023-10-27 22:53:43 +08:00
|
|
|
from pydantic import BaseModel, Field
|
2023-09-28 20:19:26 +08:00
|
|
|
from langchain.tools import ShellTool
|
|
|
|
|
def shell(query: str):
|
|
|
|
|
tool = ShellTool()
|
|
|
|
|
return tool.run(tool_input=query)
|
|
|
|
|
|
2023-10-27 22:53:43 +08:00
|
|
|
class ShellInput(BaseModel):
|
|
|
|
|
query: str = Field(description="一个能在Linux命令行运行的Shell命令")
|