I've been excited to try https://www.napkin.io/ after seeing it at a MageTitans event in Manchester the last weekend.
It's a tool to create and deploy serverless cloud functions instantly, all from the browser.
I had an idea to use ChatGPT to automatically create developer documentation on files from Github, so I thought that would a great first task to test it.
So important tasks first, let's ask ChatGPT how to do it!
Prompt
Is there a way to get a code package from GitHub into ChatGPT to analyse and create some developer documentation from it
Ok this looks good, let's give it a try, so I'll start a Napkin.io workspace and let's see if this runs.
ERROR!
ModuleNotFoundError: openai.OpenAI
I thought this might be because the open ai package won't be available by default, so let's add that in.
With napkin.io, it was very easy to do, with a quick search and a few clicks it's installed.
But the error remains! Let's see if ChatGPT can fix it.
Ok, it has now realised the first code was broken and it made an error?!
Let's see if the new version works, success!
Ok let's try it with a real file for example, I'll use the gitpod.yml file I created for a GitHub + Magento starter project https://github.com/develodesign/magento-gitpod
Here's the final script
I had some errors around the max token size, so had to adjust the prompt to include "Markdown short paragraphs" or it would error out that the request is too large.
I've also now realised this isn't actually ChatGPT4, the API access to version 4 is only available on a waiting list currently.
So I'll try this again when that's available.
Adding the prompt for Shorter paragraphs has helped, and it now returns Markdown for the file successfully.
Putting this into a Markdown viewer and it doesn't look too bad!
It's definitely got potential and I'm looking forward to trying this more with ChatGPT4 API once that's available.
What are you building with Napkin.io or ChatGPT? Drop us a comment below!