知识卡片
解释器接入必须隔离执行环境
解释器可以承担精确计算,却也会执行生成代码的文件、网络和系统动作。应由运行时限制可用资源与权限并记录执行结果,不能仅靠提示要求代码安全;示例REPL不等于已经具备沙箱隔离。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 外部工具与智能体
原书出处 · 1 处
- · 查看原书依据
Code interpreter Next, let’s explore how you can invoke a code interpreter and run arbitrary code: from langchain_experimental.utilities import PythonREPL python = PythonREPL() python.run("456 * 345") Warning Be wary of running code generated by LLMs in response to user prompts. Users can induce the model to generate malicious code! Database connectors Finally, let’s check out how to connect to a database and run queries: import
参考来源
- 位置:《Designing Large Language Model Applications》第10章《外部工具与智能体》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Designing Large Language Model Applications/_epub-src/OEBPS/ch10.html)
- 结论依据:摘录中关于解释器接入必须隔离执行环境的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Code interpreter Next, let’s explore how you can invoke a code interpreter and run arbitrary code: from langchain_experimental.utilities import PythonREPL python = PythonREPL() python.run("456 * 345") Warning Be wary of running code generated by LLMs in response to user prompts. Users can induce the model to generate malicious code! Database connectors Finally, let’s check out how to connect to a database and run queries: import