当前位置: 首页 > news >正文

GPT LangChain experimental agent - allow dangerous code

题意:GPT LangChain 实验性代理 - 允许危险代码

问题背景:

I'm creating a chatbot in VS Code where it will receive csv file through a prompt on Streamlit interface. However from the moment that file is loaded, it is showing a message with the following content:

我正在VS Code中创建一个聊天机器人,它将通过Streamlit界面上的一个提示接收csv文件。但是,从文件加载的那一刻起,它就显示了一条包含以下内容的消息:

ValueError: This agent relies on access to a python repl tool which can execute arbitrary code. This can be dangerous and requires a specially sandboxed environment to be safely used. Please read the security notice in the doc-string of this function. You must opt-in to use this functionality by setting allow_dangerous_code=True.For general security guidelines, please see: Security | 🦜️🔗 LangChain

ValueError:此代理依赖于访问一个可以执行任意代码的Python REPL工具。这可能存在危险,并且需要一个特别的安全沙箱环境来安全使用。请阅读此函数文档字符串中的安全通知。您必须通过设置allow_dangerous_code=True来明确选择使用此功能。对于一般的安全指南,查看相关文档

Traceback  堆栈信息

File "c:\Users\  \langchain-ask-csv\.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 589, in _run_scriptexec(code, module.__dict__)
File "C:\Users\ \langchain-ask-csv\main.py", line 46, in <module>main()
File "C:\Users\  \langchain-ask-csv\main.py", line 35, in mainagent = create_csv_agent( OpenAI(), csv_file, verbose=True)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\
\langchain-ask-csv\.venv\Lib\site-packages\langchain_experimental\agents\agent_toolkits\csv\base.py", line 66, in create_csv_agentreturn create_pandas_dataframe_agent(llm, df, **kwargs)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\ T\langchain-ask-csv\.venv\Lib\site-packages\langchain_experimental\agents\agent_toolkits\pandas\base.py", line 248, in create_pandas_dataframe_agentraise ValueError(

Here's part of the code where I'm passing the file:

这是我传递文件的部分代码:

def main():load_dotenv()# Load the OpenAI API key from the environment variableif os.getenv("OPENAI_API_KEY") is None or os.getenv("OPENAI_API_KEY") == "":print("OPENAI_API_KEY is not set")exit(1)else:print("OPENAI_API_KEY is set")st.set_page_config(page_title="Ask your CSV")st.header("Ask your CSV 📈")csv_file = st.file_uploader("Upload a CSV file", type="csv")if csv_file is not None:agent = create_csv_agent( OpenAI(), csv_file, verbose=True)user_question = st.text_input("Ask a question about your CSV: ")if user_question is not None and user_question != "":with st.spinner(text="In progress..."):st.write(agent.run(user_question))if __name__ == "__main__":main()

I checked the link given as suggestion and also tried to search on similar reports but haven't had success.

我检查了给出的建议链接,也尝试搜索了类似的报告,但都没有成功。

What might be wrong and how to fix it?

可能出了什么问题,以及如何解决它?

问题解决:

The referenced security notice is in    相关的安全通知在这里      langchain_experimental.agents.agent_toolkits.pandas.base.create_pandas_dataframe_agent — 🦜🔗 LangChain 0.2.8.

Just do what the message tells you. Do a security analysis, create a sandbox environment for your thing to run in, and then add allow_dangerous_code=True to the arguments you pass to create_csv_agent, which just forwards the argument to create_pandas_dataframe_agent and run it in the sandbox.

按照消息告诉你的去做。进行安全分析,为你的东西创建一个沙盒环境来运行,然后在传递给create_csv_agent的参数中添加allow_dangerous_code=True,这个参数会被传递到create_pandas_dataframe_agent中,并在沙盒环境中运行它。

http://www.lryc.cn/news/405736.html

相关文章:

  • 1 LableMe安装下载
  • rce漏洞-ctfshow(50-70)
  • vulntarget-a靶机-复现报告
  • 为什么 FPGA 的效率低于 ASIC?
  • 使用水星Mecury人形机器人搭建VR遥操作控制平台!
  • 【学习笔记】无人机系统(UAS)的连接、识别和跟踪(三)-架构模型和概念
  • uniapp bug解决:uniapp文件查找失败:‘uview-ui‘ at main.js:14
  • Python 爬虫(爬取百度翻译的数据)
  • 【LeetCode:2766. 重新放置石块 + 哈希表】
  • [C++]类的自动转换和强制类型转换
  • 根据鼠标所在位置获取组件拿到 “qt_scrollarea_viewport” 组件的问题
  • 深入浅出WebRTC—LossBasedBweV2
  • 就业难?誉天Linux云计算架构师涨薪班,不涨薪退学费
  • 从零开始!Jupyter Notebook的安装教程
  • FastAPI(七十)实战开发《在线课程学习系统》接口开发--留言功能开发
  • 04-数据库MySQL
  • 神经网络理论(机器学习)
  • JNI回调用中不同线程的env无法找到正确的kotlin的class
  • 免费HTML模板网站汇总
  • 大屏数据看板一般是用什么技术实现的?
  • 在 Kubernetes 中设置 Pod 优先级及其调度策略详解
  • Spring框架、02SpringAOP
  • 基于python的网络爬虫爬取天气数据及可视化分析
  • 【WPF开发】上位机开发-串口收发
  • ubuntu开启 远程登录 允许root远程登录
  • 《昇思25天学习打卡营第23天|RNN实现情感分类》
  • 机械设计基础B(学习笔记)
  • MybatisPlusException: Error: Method queryTotal execution error of sql 的报错解决
  • 人工智能领域的顶尖影响力人物(部分代表)
  • Python:jsonl文件转json文件,并做字段处理