cohere-toolkit
cohere-toolkit copied to clipboard
tool: Implement E2B's code interpreter
Hello Cohere team!
Thank you for this great template! I'm following up with this PR based on the discussion I had with Nick on Twitter.
Description: This PR adds E2B's code interpretes. E2B is an open-source secure runtime for AI agents and AI apps. We have a dedicated SDK for code interpreting built on top of our sandboxes. Each sandbox is a micro VM that we can quickly spawn (usually around 900-1.5s). It's like a small computer for AI. The sandbox is made for running untrusted AI-generated code in isolation (it's built on top of Firecracker from AWS).
Dependencies:
- Added https://github.com/e2b-dev/code-interpreter
Docs, lints, and test:
- [x] Add docs: Please include testing and documentation for your changes
- [x] Lint and test: Run
make lint
andmake test
Needed help from the Cohere team: The E2B code interpreter supports generating and streaming charts. This is achieved byt the code interpreter running a full Jupyter server inside the E2B sandbox. Here's an example notebook of Llama-3 using our code interpreter for generating charts
My questions:
- Do you want to keep the default Python Interpreter tool?
- Can you point me to what would be the best way how to send the tool results to frontend outside of the messages stream? I need to send back the charts data and other rich content
- Would the
MessageContent.tsx
component be the best place to implement displaying the charts and other rich content?
Thank you!
Thanks for the contribution! Looking into it today.
Hi mlejva - we're so excited for your contribution, we're going to create a package for community tools for users to browse and add. Thanks for taking the time to add this! Were you able to get it working in your env?
Hi @elaineg!
Were you able to get it working in your env?
I forgot to add it to LANGCHAIN_TOOLS
variable! Sorry, fixed now. Here's a video with the Cohere toolkit + our code interpreter.
Please let me know if you have any other issues with running my PR so I could fix them.
I'd love to get rendering charts working before we merge because that's one of the most powerful features of our code interpreter:
My questions:
- Do you want to keep the default Python Interpreter tool?
- Can you point me to what would be the best way how to send the tool results to frontend outside of the messages stream? I need to send back the charts data and other rich content
- Would the MessageContent.tsx component be the best place to implement displaying the charts and other rich content?
Hi @elaineg @rodrigue-h, is there anything I can help with?
We're demoing Cohere's toolkit with our code interpreter on our developer meetup that we're hosting with LangChain
Here's one of the demos we have prepared. We kind of had to hack together the plot rendering as it wasn't very easy to send the non-message data on the frontend.
Hey @mlejva! Sorry it took us so long to get back to you. We just added a new community
folder in which we're going to keep all the tools and model deployments added by the community. Do you mind migrating this code to the new folder? The structure should be exactly the same
Hi @lusmoura super sorry for the late answer, I'll look into it probably Friday and latest over the weekend!
Hi @mlejva, let us know if you have any further questions regarding the new community
folder. You'll also have to sign your commits to allow a merge
Hi @tianjing-li , I'm sorry I got distracted by bunch of things around running the company. I'm aiming to get this done this week.
Hey @mlejva is this still in the works? There has actually been significant changes to the codebase since April, if still interested you'd have to migrate your changes to the /community folder.
Hi @tianjing-li, I'm sorry this got so neglected on my end. I had been buried in other company tasks and it was hard to keep up with the changes. I'll most likely do a new implementation so it's up to date with the latest community guidelines.
@mlejva no worries I totally understand, appreciate your flexibility here. I'll close this PR for now and will look forward to your future contributions!