I’m sure that by now many have heard about ChatGPT. If not, ChatGPT is a large language model developed by OpenAI. It is based on the GPT (Generative Pre-training Transformer) architecture, which was trained on a massive amount of text data to generate human-like text. ChatGPT is fine-tuned to perform specific language tasks such as answering questions, generating text and more. It uses the latest advances in neural network technology to understand and respond to natural language input in a way that mimics human conversation. It can be used for various applications such as chatbots, automated customer service, language translation and more.
I took ChatGPT for a spin to see how accurate and detailed it would be to write (Infra as) Code. Somehow Bicep felt like a good candidate! (in case you don’t know why, follow this link 😊)
The first question I asked was to author a simple Bicep template to create a Vnet.
I was blown away by the initial response which came back instantly! That looks awesome for a first try! Do note that ChatGPT says Bicep is still in preview. The reason is that ChatGPT is trained on a large dataset of text data that was current as of 2021, so it may not have information that is more recent than that. The training data used to build the model is also constantly being updated, so the information available to ChatGPT may change over time.
Also note that ChatGPT gave some advise on network designs as well, how cool is that!
A best practice however would be to use a parameter instead of ‘resourceGroup().location’. So lets tell ChatGPT to adapt to that and also tell it to to make resourceGroup().location the default value of the parameter.
That was easy! Next, we’ll tell it to use a different API version when dealing with VNets.
There we go. Finally, lets see if it can also generate a parameters file with a couple of sample values. Of course it can!
And this is just scratching the surface on what ChatGPT is able to do based on a simple example, there is so much more!
ChatGPT can help with writing code by providing code snippets, examples, and templates for a specific programming language or framework. It can also help with troubleshooting errors by providing solutions to common problems. Additionally, ChatGPT can assist with understanding the proper syntax and usage of a particular command or function by providing explanations and documentation.
ChatGPT can also help with writing code by providing suggestions for code improvements and better practices and by suggesting alternative ways to implement a certain functionality. It can also help with understanding and working with complex code by providing explanations of the code’s behavior and providing examples of how to use it.
It’s important to note that while ChatGPT can help with writing code, it’s not a replacement for human programmers. ChatGPT can provide suggestions and examples, but it can’t replace the experience and understanding of the problem domain that a human developer has.
Strong advise: do not blindly trust AI generated code for production environments. Use AI to assist you, not to replace you.
And guess what…part of this article was actually written by ChatGPT itself! Did you notice that? The possibilities are endless and I’m looking forward to test driving this some more! What are your thoughts?