shroominic / codeinterpreter-api

👾 Open source implementation of the ChatGPT Code Interpreter
https://discord.gg/Vaq25XJvvW
MIT License
3.75k stars 401 forks source link

File class to initialize/take content from variable/binary/string - for Chainlit #78

Closed ventz closed 1 year ago

ventz commented 1 year ago

Hi,

Great work on this project!!

Would it be possible to extend your File class (codeinterpreterapi/schema/file.py) to provide a from_content function, in additional to from_path and from_url?

That is, to be able to create a File() instance from a content directly?

This would be key for being able to wrap this within Chainlit

Ex: image image

shroominic commented 1 year ago

I mean you can directly use File(name="file_name", content=b"file_content")

ventz commented 1 year ago

@shroominic Thanks!

That's what I did for the time being, but assuming since it's not a "public" method, it may change/break over time.

If it's not too much of a hassle, it would be helpful to add.

shroominic commented 1 year ago

Good point yeah I try adding this!