Using ChatGPT to Document your Software Project
Tags: machinelearning, webdev, programming, opensource
Published: 2023-02-06 06:24:52

At [Aista](https://aista.com) we are literally doing nothing else than machine learning and AI these days. You can see some of our [Machine Learning and AI initiatives here](https://aista.com/machine-learning/). The reasons are obvious.

> ChatGPT and OpenAI is simply the hottest and coolest thing I've seen since I discovered computers at the age of 8

Look at the following picture, and realise the documentation parts in the top right corner was automatically generated by selecting some Hyperlambda code and clicking F1.

![Documenting software using ChatGPT](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvl5phm17zroy8ur3u1l.jpeg)

As far as I'm concerned the above is nothing less of a software development miracle! It was created by scraping our [documentation website for machine learning training data](https://docs.aista.com). Then we simply included an API call inside our Magic Dashboard towards OpenAI API when users clicks F1, passing in the selected code to have ChatGPT explain the code. Let me repeat the important parts of the above screenshot such that it's not _"lost in translation"_.

![Machine learning software documentation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ypj96wil86b6r4km7gv7.jpg)

## The implications of Machine Learning

Machine learning is often associated with having humans teaching the machine something new. I suspect one of the long term implications of having access to amazing AI will inevitably be that the machine will start teaching humans. For instance, I wrote the documentation for our website. In doing so I taught the machine everything it needs to know to understand Hyperlambda. Now the machine can learn everybody else Hyperlambda, at a speed I couldn't even imagine previously.

If I was to help people understand Hyperlambda, teaching it with the same amount of quality as our integrated ChatGPT help system can do would require days, if not weeks. And at most I could maybe handle a handful of junior software developers at the same time. With the integrated ChatGPT based help system, _"I"_ can literally teach millions of people simultaneously. Philosophically you could argue that ...

> I have "uploaded" my brain to OpenAI, such that I can "replicate" myself a million times

This of course makes me a million times more productive, allowing _"me"_ to do a million things simultaneously, while the _"real me"_ can enjoy umbrella drinks at some beach in the Caribbean, having OpenAI and ChatGPT do my work. The implications of this are profound!

## Documenting your software using ChatGPT

If you've got a software project, you can document your project just as easily as I did. The process is dead simple;

1. Register at [Aista.com](https://aista.com)
2. Create a cloudlet
3. Use the machine learning component to scrape your documentation website for training data, resulting in a custom AI model
4. Inject the ChatBot HTML code into your website, and / or use the API endpoint created by Aista anywhere you want

The way our F1 trick works, is that we use the currently selected code from our code editor, and we prefix it with; _"Explain this code"_. Then we send it through our API to ChatGPT, the _"text-davinci-003"_ model, the guy with 1.7 billion parameters, and VOILA! 100% perfect answers every single time.

Assuming you've got great documentation for your software, you can literally do the entire job in less than 5 minutes. If you want to try it out for yourself, [signup at hub](https://hub.aista.com) and create your own cloudlet - Or download the open source version if you want to play around locally. For the record, [we would appreciate a star at our GitHub repository if you do the latter](https://github.com/polterguy/magic). In the video below I am walking you through how these parts works in our software.

{% embed https://www.youtube.com/watch?v=MrbT9TueWM8 %}

You can use this on _any_ snippet of Hyperlambda, as long as you don't select too much code at the same time. ChatGPT and OpenAI have limits in regards to how long questions you can ask, and the selected code basically becomes your _"prompt"_. So don't select more than maybe some 20 lines of code maximum, or it might fail.

* [Try it out for yourself](https://aista.com)

If you're too lazy to signup, you could also ask your question at our [integrated ChatGPT based support chatbot](https://aista.com) of course. Try to ask it about Hyperlambda, Aista or Magic Cloud, and see how it responds.