3 ms·
Does anyone have a way to use generative AI to generate Jupyter notebooks? I've tried with prompts but it chokes on the markup, and also I'm wondering if the ma
by BaculumMeumEst 2y ago
Does anyone have a way to use generative AI to generate Jupyter notebooks? I've tried with prompts but it chokes on the markup, and also I'm wondering if the markup wastes too much context for that to be a good idea anyways. Right now I just use Cursor or Claude, copy replies, and chop them up into blocks manually.
- prasoonds 2y agoWe've made an open source fork of Jupyter - kind of like Cursor but for Jupyter. See GH: https://github.com/pretzelai/pretzelai/ https://github.com/pretzelai/pretzelai/ You can install it with pip install pretzelai (in a new environment preferably) - then run it with pretzel lab. You can bring your own keys or use the default free (for now) AI server. We also have a hosted version to make it easy to try it out: https://pretzelai.app https://pretzelai.app Would love to get your feedback!
- BaculumMeumEst 2y agoCan it reliably generate interspersed blocks of markup and code with a single prompt?
- prasoonds 2y agoHmm do you mean you want to create multiple cells from a single prompt - some code cells, then some markdown cells, then some code cells and so on? The sidebar can certainly produce code mixed with markdown but right now, we process the markdown and show visually. https://imgur.com/a/bpYu8yN https://imgur.com/a/bpYu8yN The cell level Cmd + K shortcut only works on a given cell to create or edit code and fix errors. Just tested it and it generates markdown well (just start your prompt with "this is a markdown cell") https://imgur.com/VuDciQN https://imgur.com/VuDciQN In the sidebar/chat window, it should be trivial to not parse the markdown and just show it raw. I'll work on it. In the main notebook, it's a bit harder but we are planning to allow multi-cell insertions but it will probably take 2-3 weeks.
- BaculumMeumEst 2y agoYeah the golden goose for me personally is the ability to say "create a jupyter notebook about x topic" and have an LLM spit out interspersed markdown (w/ inline latex) and python cells. It would be really cool if the LLM was good at segmenting those chunks and drawing stuff/evaluating output at interesting points. Quick example to illustrate the idea: https://imgur.com/04FUp9s https://imgur.com/04FUp9s I find Cursor to be extremely good right up to that point - I can work with Jupyter via the VS code extension and quickly get mixed markdown like how you're describing now - but it cannot do the multi-cell output or intelligent segmenting described above. I currently split it apart myself from the big 'ol block of markdown output.
- prasoonds 2y agoI see, interesting. Hadn't come upon this use-case before but makes sense. I've made a GitHub issue for this feature: https://github.com/pretzelai/pretzelai/issues/142 https://github.com/pretzelai/pretzelai/issues/142 If you'd like to be updated when we have this feature in, please leave a comment on the issue. Alternatively, my email is in my bio - feel free to email me so that when we have this feature, we can send you an update!
- marc-fabihq 2y agoThis is something we've experimented with and I know some other tools out there claim to do this, I've just found that there's a very simple issue with this: if the AI gets any step wrong, every subsequent step is wrong and then you have to review every bit of code/markdown bit by bit, and it ends up turning into more work than just doing the analysis step by step while guiding the AI. I'm optimistic that this will change over time as the AI gets better, but it's still quite fragile (although it demos really well...)
- BaculumMeumEst 2y agoSo if you had 3 markdown cells and 3 python cells, I would design the tool to pull all the content out of those cells and present it (sans all that ipynb markup, just contents, probably in markdown) to the model as the full context for every edit you want to make. So the tool would need to know how to transform a given notebook into a collection of markdown/python cells which it would present to the model to make edits. The model would need to return updated cells in the same format, and the tool would update the cells in the document (or just replace them entire with new cells from the response). I would be fine with this just blowing away all previous evaluation results. Do you think that approach would work? Not sure if I'm misunderstanding the issue you're describing and I recognize it is likely much messier than I imagine.