|
1 |
| -# codeinterpreter-api |
2 |
| -Run LLM Code Interpreter Agents using isolated CodeBox environments. |
| 1 | +# Code Interpreter API |
| 2 | + |
| 3 | +A LangChain implementation of the ChatGPT Code Interpreter. |
| 4 | +Using CodeBoxes as backend for sandboxed python code execution. |
| 5 | +[CodeBox](https://github.com/shroominic/codebox-api/tree/main) is the simplest cloud infrastructure for your LLM Apps. |
| 6 | +You can run everything local using your own OpenAI API Key. |
| 7 | + |
| 8 | +## Installation |
| 9 | + |
| 10 | +```bash |
| 11 | +pip install codeinterpreterapi |
| 12 | +``` |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +```python |
| 17 | +from codeinterpreterapi import CodeInterpreterSession |
| 18 | + |
| 19 | +# start a session |
| 20 | +session = CodeInterpreterSession() |
| 21 | +await session.astart() |
| 22 | + |
| 23 | +# generate a response based on user input |
| 24 | +output = await session.generate_response( |
| 25 | + f"Plot the bitcoin chart of 2023 YTD" |
| 26 | +) |
| 27 | +# show output image in default image viewer |
| 28 | +file = output.files[0] |
| 29 | +file.show_image() |
| 30 | + |
| 31 | +# show output text |
| 32 | +print("AI: ", output.content) |
| 33 | + |
| 34 | +# terminate the session |
| 35 | +await session.stop() |
| 36 | + |
| 37 | +``` |
| 38 | + |
| 39 | +## Production |
| 40 | + |
| 41 | +In case you want to deploy to production you can use the CodeBox API for easy scaling. |
| 42 | +Please contact me if you want to use the CodeBox API in production. |
| 43 | +Its currently in early development and not everything is automated yet. |
| 44 | + |
| 45 | +## Contributing |
| 46 | + |
| 47 | +There are some TODOs left in the code |
| 48 | +so if you want to contribute feel free to do so. |
| 49 | +You can also suggest new features. Code refactoring is also welcome. |
| 50 | +Just open an issue pull request and I will review it. |
| 51 | + |
| 52 | +Also please submit any bugs you find as an issue |
| 53 | +with a minimal code example or screenshot. |
| 54 | +This helps me a lot to improve the code. |
| 55 | + |
| 56 | +Thanks! |
| 57 | + |
| 58 | +## License |
| 59 | + |
| 60 | +[MIT](https://choosealicense.com/licenses/mit/) |
| 61 | + |
| 62 | +## Contact |
| 63 | + |
| 64 | + |
| 65 | +Sorry for the weird email address but I don't want to get spammed so I can deactivate it if necessary. |
| 66 | +But you can also contact me on [Twitter](https://twitter.com/shroominic) or [Discord](https://gptassistant.app/community). |
0 commit comments