app-builder
app-builder copied to clipboard
[开发中]支持调用LangChain Community 中的Tool实现
用户示例代码
import appbuilder
from appbuilder import LangChainToolWrapper
from langchain_community.tools import ShellTool
# 使用LangChain的ShellTool插件
component = LangChainToolWrapper(langchain_tool = ShellTool())
query = appbuilder.Message("echo 'hello world' && time")
answer = component.run(query)
print(answer.content)
结果输出
➜ appbuilder python3 -u langchain_wrapper.py
/Users/chengmo/Library/Python/3.9/lib/python/site-packages/langchain_community/tools/shell/tool.py:32: UserWarning: The shell tool has no safeguards by default. Use at your own risk.
warnings.warn(
Executing command:
echo 'hello world' && time
hello world
real 0m0.000s
user 0m0.000s
sys 0m0.000s