调研:开源版gpt code interpreter

找到了一些开源项目,但都还比较初期。

  • 从方案上来看,有些采用了 jupyter kernel,有些则是另外打造了运行环境;
  • 从 prompt 上来看,有些项目重在给 gpt 一个顺畅的设定,另一些则是在 prompt 中限定了gpt可以使用的 python 包的具体版本,期望这样可以让gpt生成的代码减少一些错误。

gpt-code-ui

https://ricklamers.io/posts/gpt-code/

这个项目是目前star最多的

借助Jupyter kernels来实现代码运行,但是限制得比较死,每次回答强制调用代码运行

他的 prompt 长这样:

python 复制代码
prompt = f"""First, here is a history of what I asked you to do earlier. 
    The actual prompt follows after ENDOFHISTORY. 
    History:
    {message_buffer.get_string()}
    ENDOFHISTORY.
    Write Python code, in a triple backtick Markdown code block, that does the following:
    {user_prompt}
    
    Notes: 
        First, think step by step what you want to do and write it down in English.
        Then generate valid Python code in a code block 
        Make sure all code is valid - it be run in a Jupyter Python 3 kernel environment. 
        Define every variable before you use it.
        For data munging, you can use 
            'numpy', # numpy==1.24.3
            'dateparser' #dateparser==1.1.8
            'pandas', # matplotlib==1.5.3
            'geopandas' # geopandas==0.13.2
        For pdf extraction, you can use
            'PyPDF2', # PyPDF2==3.0.1
            'pdfminer', # pdfminer==20191125
            'pdfplumber', # pdfplumber==0.9.0
        For data visualization, you can use
            'matplotlib', # matplotlib==3.7.1
        Be sure to generate charts with matplotlib. If you need geographical charts, use geopandas with the geopandas.datasets module.
        If the user has just uploaded a file, focus on the file that was most recently uploaded (and optionally all previously uploaded files)
    
    Teacher mode: if the code modifies or produces a file, end your output AFTER YOUR CODE BLOCK with a link to it as <a href='/download?file=INSERT_FILENAME_HERE'>Download file</a>. Replace INSERT_FILENAME_HERE with the actual filename. So just print that HTML to stdout at the end, AFTER your code block."""


codeinterpreter-api

https://github.com/shroominic/codeinterpreter-api

使用了 LangChain 和 CodeBox

他的 system prompt 长这样:

复制代码
Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. 
As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.
Assistant is constantly learning and improving, and its capabilities are constantly evolving. 
It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, 
allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.

This version of Assistant is called "Code Interpreter" and capable of using a python code interpreter (sandboxed jupyter kernel) to run code. 
The human also maybe thinks this code interpreter is for writing code but it is more for data science, data analysis, and data visualization, file manipulation, and other things that can be done using a jupyter kernel/ipython runtime.
Tell the human if they use the code interpreter incorrectly.
Already installed packages are: (numpy pandas matplotlib seaborn scikit-learn yfinance scipy statsmodels sympy bokeh plotly dash networkx).
If you encounter an error, try again and fix the code.

持续跟进

后面或许会有更多人尝试实现 gpt code interpreter,持续跟进。

相关推荐
赛博鲁迅34 分钟前
coze 工作流使用中转API 教程
gpt·大模型·ai编程·agi·gemini·coze
代码AI弗森2 小时前
243 行 microGPT:把“训练 + 推理”拆到骨头里
gpt
向量引擎17 小时前
别再问GPT-5.3怎么还没记忆了!你的AI还没装“海马体”?揭秘让OpenClaw起飞的幕后大佬:高性能向量引擎实战指南(附Clawdbot保姆级配置)
人工智能·gpt·aigc·agi·api调用
老金带你玩AI1 天前
DeepSeek V4春节炸场,三大黑科技让Claude和GPT都坐不住了
人工智能·科技·gpt
程序员佳佳1 天前
炸裂!为了流畅调用 GPT-5.3 和 Sora2,我用“向量引擎”重构了核心服务,CTO 直呼内行(附 OpenClaw 保姆级配置)
gpt·重构
程序员佳佳1 天前
别再被GPT-5.3和Sora2吊打了!这篇OpenClaw+向量引擎实战,教你徒手捏个超级中转站(内附硬核配置)
人工智能·gpt·aigc·api·ai编程
骇城迷影2 天前
从零构建 GPT 分词器
linux·服务器·pytorch·gpt·深度学习·神经网络
向量引擎2 天前
向量引擎OpenClaw配置实战:让GPT-5.2跑得比隔壁老王的特斯拉还快
gpt·aigc·api·ai编程·ai写作·key·agi
烁烁闪闪烁烁2 天前
Claude Code 完全入门指南
大数据·开发语言·人工智能·gpt·ai编程·claude·cursor
松涛和鸣3 天前
73、IMX6ULL Linux按键驱动实战:从GPIO轮询到设备树中断+等待队列
linux·服务器·数据库·驱动开发·单片机·gpt