shroominic/codeinterpreter-api
Fork: 402 Star: 3784 (更新于 2024-11-11 19:51:00)
license: MIT
Language: Python .
👾 Open source implementation of the ChatGPT Code Interpreter
最后发布版本: v0.1.17 ( 2024-04-11 00:20:22)
👾 Code Interpreter API
A LangChain implementation of the ChatGPT Code Interpreter. Using CodeBoxes as backend for sandboxed python code execution. CodeBox is the simplest cloud infrastructure for your LLM Apps. You can run everything local except the LLM using your own OpenAI API Key.
Features
- Dataset Analysis, Stock Charting, Image Manipulation, ....
- Internet access and auto Python package installation
- Input
text + files
-> Receivetext + files
- Conversation Memory: respond based on previous inputs
- Run everything local except the OpenAI API (OpenOrca or others maybe soon)
- Use CodeBox API for easy scaling in production
Docs
Checkout the documentation for more information.
Installation
Get your OpenAI API Key here and install the package.
pip install "codeinterpreterapi[all]"
Everything for local experiments are installed with the all
extra.
For deployments, you can use pip install codeinterpreterapi
instead which does not install the additional dependencies.
Usage
To configure OpenAI and Azure OpenAI, ensure that you set the appropriate environment variables (or use a .env file):
For OpenAI, set the OPENAI_API_KEY environment variable:
export OPENAI_API_KEY=sk-**********
from codeinterpreterapi import CodeInterpreterSession, settings
# create a session and close it automatically
with CodeInterpreterSession() as session:
# generate a response based on user input
response = session.generate_response(
"Plot the bitcoin chart of year 2023"
)
# output the response
response.show()
Bitcoin YTD Chart Output
Dataset Analysis
from codeinterpreterapi import CodeInterpreterSession, File
# this example uses async but normal sync like above works too
async def main():
# context manager for auto start/stop of the session
async with CodeInterpreterSession() as session:
# define the user request
user_request = "Analyze this dataset and plot something interesting about it."
files = [
# attach files to the request
File.from_path("examples/assets/iris.csv"),
]
# generate the response
response = await session.generate_response(
user_request, files=files
)
# output to the user
print("AI: ", response.content)
for file in response.files:
# iterate over the files (display if image)
file.show_image()
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Iris Dataset Analysis Output
Production
In case you want to deploy to production, you can utilize the CodeBox API for seamless scalability.
Please contact me if you are interested in this, as it is still in the early stages of development.
Contributing
There are some remaining TODOs in the code. So, if you want to contribute, feel free to do so. You can also suggest new features. Code refactoring is also welcome. Just open an issue or pull request and I will review it.
Please also submit any bugs you find as an issue with a minimal code example or screenshot. This helps me a lot in improving the code.
Contact
You can contact me at contact@shroominic.com. But I prefer to use Twitter or Discord DMs.
Support this project
If you would like to help this project with a donation, you can click here. Thanks, this helps a lot! ❤️
最近版本更新:(数据更新于 2024-10-07 23:59:44)
2024-04-11 00:20:22 v0.1.17
2024-04-04 20:23:12 v0.1.16
2023-12-13 01:39:58 v0.1.15
2023-10-11 05:47:51 v0.0.14
2023-09-29 18:30:29 v0.0.13
2023-08-10 01:56:34 v0.0.11
2023-08-05 22:37:37 v0.0.10
2023-07-15 01:47:29 beta
主题(topics):
chatgpt, chatgpt-code-generation, code-interpreter, codeinterpreter, langchain, llm-agent
shroominic/codeinterpreter-api同语言 Python最近更新仓库
2024-11-24 20:32:32 xtekky/gpt4free
2024-11-24 01:08:40 jasoneri/ComicGUISpider
2024-11-23 07:15:18 comfyanonymous/ComfyUI
2024-11-23 02:05:08 hect0x7/JMComic-Crawler-Python
2024-11-22 19:26:55 ultralytics/ultralytics
2024-11-22 18:58:34 home-assistant/core