|  | 
| 1 | 1 | # Codeinterpreter-codebox | 
| 2 | 2 | 
 | 
| 3 |  | -这是一个通过docker构建的云服务,实现了code interpreter的后端功能,以便部署调用。Sandbox环境语言独立,可以用其他编程语言重写。 | 
| 4 |  | -实现了企业化的code interpreter代码执行的自我部署的实现,提供了更好的信息安全性和基于云的可拓展性和可用性。 | 
| 5 |  | -## 相关项目和差异 | 
| 6 |  | -1. [Code Interpreter api](https://github.com/shroominic/codeinterpreter-api)提供了基于langchain的agent调用,但是codebox为闭源收费。 | 
| 7 |  | -2. [open-interpreter](https://github.com/KillianLucas/open-interpreter) 提供了更多的编程语言支持,但是支持本地化运行,不支持远程调用。在商业化或者企业化的项目中无法应用 | 
| 8 |  | -3. [E2B](https://github.com/e2b-dev/e2b) 支持更多编程语言的云服务,闭源 | 
|  | 3 | +这是Codeinterpreter-codebox,作为执行code interpreter代码的云服务。<br> | 
|  | 4 | + | 
| 9 | 5 | 
 | 
|  | 6 | +# Features | 
|  | 7 | +1. 独立的jupyter沙盒环境  | 
|  | 8 | +完全隔离的jupyter沙盒环境,支持状态保持的执行代码。支持文件上传、下载。 | 
|  | 9 | +2. docker化一键部署<br> | 
| 10 | 10 | 
 | 
|  | 11 | +3. 完全免费开源<br> | 
|  | 12 | +4. 信息安全<br> | 
|  | 13 | +支持完全私有化部署,无需上传文件到外部服务器<br> | 
|  | 14 | +5. 更灵活 <br> | 
|  | 15 | +支持开放更多端口以实现更多自定义功能需求,如:连接数据库、连接互联网、连接其他服务器 | 
| 11 | 16 | 
 | 
| 12 | 17 | ## 功能描述 | 
| 13 |  | -1. 通过支持启动、运行、上传文件、安装python package、结束等接口,方便客户端对于codeinterpreter-codebox的调用 | 
| 14 |  | -2. 提供了docker化的虚拟环境作为代码执行的沙盒环境 | 
| 15 |  | -3. 可以增加调用管理的数据库模块功能 | 
|  | 18 | +1. 执行python代码 | 
|  | 19 | +2. 支持上传文件的读取([上传文件并分析](./examples/client/codeinterpreter_session.py))  | 
|  | 20 | +``` | 
|  | 21 | +if __name__=='__main__': | 
|  | 22 | + session=CodeinterpreterSession() | 
|  | 23 | + try: | 
|  | 24 | + session.upload_files(['./../data/test_data.csv']) | 
|  | 25 | + session.chat('上传的文件中有多少列数据') | 
|  | 26 | + finally: | 
|  | 27 | + session.close() | 
|  | 28 | +``` | 
|  | 29 | +3. 支持下载沙盒中的文件 | 
|  | 30 | +4. 支持动态扩容的商业化部署 | 
|  | 31 | +5. 支持自定义功能修改,开放端口、网络连接等,支持爬虫。 | 
|  | 32 | + | 
|  | 33 | +## 相关项目和差异 | 
|  | 34 | +1. [Code Interpreter api](https://github.com/shroominic/codeinterpreter-api) | 
|  | 35 | +2. [open-interpreter](https://github.com/KillianLucas/open-interpreter)  | 
|  | 36 | +3. [E2B](https://github.com/e2b-dev/e2b)  | 
|  | 37 | + | 
|  | 38 | + | 
|  | 39 | +| 特点/项目 | [Codeinterpreter-Codebox](https://github.com/zhangzhejian/codeinterpreter-codebox) | [Code Interpreter api](https://github.com/shroominic/codeinterpreter-api) | [open-interpreter](https://github.com/KillianLucas/open-interpreter) | [E2B](https://github.com/e2b-dev/e2b) | | 
|  | 40 | +|---|---|---|---|---| | 
|  | 41 | +| **私有商业化部署** | ✅ | ❌ | ❌| ❌ | | 
|  | 42 | +| **远程调用** | ✅ |✅ | ❌ | ✅ | | 
|  | 43 | +| **完全开源** | ✅ | ❌ | ✅ | ❌ | | 
|  | 44 | +| **免费** | ✅ | ❌ | ✅ | ❌ | | 
|  | 45 | +| **自定义修改** | ✅ | ❌ | ❌| ❌ | | 
|  | 46 | +| **信息安全** | ✅ | ❌ | ✅ | ❌ | | 
|  | 47 | +| **多编程语言支持** | ❌ | ❌ | ✅ | ✅ | | 
|  | 48 | +| **支持本地化运行** | ✅ | ✅ | ✅ | ❌ | | 
|  | 49 | +| **无需部署直接调用** | ❌ | ✅ | ✅ | ✅ | | 
|  | 50 | + | 
|  | 51 | + | 
| 16 | 52 | 
 | 
| 17 |  | -## 部署 | 
| 18 |  | -[docker compose](./app/docker_dev.yml)中使用自己的文件路径替代'CODEBOX_ROOT_PATH'和 'YOUR_MNT_PATH:/codebox' 中的'YOUR_MNT_PATH'来挂载自己的文件路径 | 
| 19 | 53 | ## 代码示例 | 
| 20 | 54 | 
 | 
| 21 | 55 | 1. [jupyter server communicate](./examples/jupyter/jupyter_api_test.ipynb) 中展示了server和jupyter container交互的细节  | 
| 22 |  | -2. [jupyter 调用](./examples/jupyter/execute_dynamic_code.ipynb)中展示了如何通过http request的方式调用web服务,执行代码获取结果 | 
| 23 |  | -3. [client session调用](./examples/client/codeinterpreter_session.py)中展示了在项目中如何以session和http request的方式让LLM调用执行代码。 | 
|  | 56 | +2. [jupyter 调用](./examples/jupyter/execute_dynamic_code.ipynb)中展示了如何通过http request的方式调用web服务,执行代码获取结果  | 
|  | 57 | +``` | 
|  | 58 | +test_code=""" | 
|  | 59 | +import docker | 
|  | 60 | +print(docker.__version__) | 
|  | 61 | + | 
|  | 62 | +""" | 
|  | 63 | +execute(test_code) | 
| 24 | 64 |  | 
| 25 | 65 |  | 
|  | 66 | +#output | 
|  | 67 | +Execute Result= {"output_type":"text/plain","content":"6.1.3\n","files":null} | 
|  | 68 | +``` | 
|  | 69 | +3. [client session调用](./examples/client/codeinterpreter_session.py)中展示了在项目中如何以session和http request的方式让LLM调用执行代码。  | 
|  | 70 | +``` | 
|  | 71 | +session=CodeinterpreterSession() | 
|  | 72 | +try: | 
|  | 73 | + session.upload_files(['./../data/test_data.csv']) | 
|  | 74 | + session.chat('上传的文件中有多少列数据') | 
|  | 75 | +finally: | 
|  | 76 | + session.close() | 
|  | 77 | +``` | 
|  | 78 | + | 
|  | 79 | +## 部署 | 
|  | 80 | +[docker compose](./app/docker_dev.yml)中使用自己的文件路径替代'CODEBOX_ROOT_PATH'和 'YOUR_MNT_PATH:/codebox' 中的'YOUR_MNT_PATH'来挂载自己的文件路径 | 
| 26 | 81 | 
 | 
| 27 | 82 | 
 | 
| 28 | 83 | ## 联系方式 | 
| 29 |  | -微信:zjajzzj1996 | 
|  | 84 | +微信:zjajzzj1996 | 
| 30 | 85 | Email: [zhangzhehian@gmail.com](zhangzhehian@gmail.com) | 
0 commit comments