Intro

By now everyone has heard of ChatGPT. If you haven’t…why not! It’s being mentioned everywhere - even in mainstream media!

For example:

Microsoft is even bringing the technology into Office apps.

So I decided to take a look at how I could use it to maybe make things easier for me with respect to my job as an ops/platform engineer. I signed up and had a little play about. And it’s been pretty good so far.

Here’s what ChatGPT has to say about how it can help developers:

Want to know how these things work…Well that information is out there too:

Google search and stackoverflow are usual places to find information when I’m stuck or need help. I often find myself looking up syntax or options for commands (for example, what is the syntax for Azure Devops Crontab? Or how do I loop through a collection with Powershell?). It all kind of adds up in terms of time spent looking up how to do something rather than doing it.

In the real world

ChatGPT

At the time I was about to start working on a script to pull all values from one Azure KeyVault and copy them to another renaming them. Seemed like a perfect chance to test out ChatGPT.

My prompt:

take a list of secrets and copy them from one keyvault to another renaming the secrets

And the response:

So as we can see, we have an answer that uses both Azure CLI and Powershell. More than enough information for me to go and create the script I needed.

Google Bard

A few days later (this was late March 2023/early April 2023), I received an invitation to sign up for the preview of Google Bard. Given that I’d just used ChatGPT, I thought I’d ask it the same question…

The results were disappointing. Bard responded that it didn’t understand. A little playing about and it was clear that Bard wasn’t anywhere near as useful for me. I wanted it to understand code, but it didn’t appear that this early beta version was capable of that. A Google search was more informative.

Now this was all about a month ago, giving it another try while writing this post it seems that Google have been working on it. It actually did now understand code! With the same prompt, this is the response from Bard:

So now there is some useful info back. It’s provided a bash script using Azure CLI. But note that it’s not taken into account that I also wanted to rename the secrets in the new vault.

So there is still room for improvement here, but much improved in the past month.

Use Cases

Want to convert from between languages (eg. Bash to Powershell), both tools are able to do that with very similar responses. Note that Bard explicitly contains a disclaimer on its code example, but ChatGPT doesn’t.

Find that the answer is not quite right? Continue the conversation asking for refinement and you may get better answers. Remember that a “chat” and its history will provide context, which in turn may help you get the answer your looking for.

Text summation

There are all sorts of things you can use it for. If your not very good at wording something, you could ask for your text to be reworded. For example, I don't have time for that, I'll get to it when I can becomes I am currently unable to prioritize that task, but I intend to address it in the future when my schedule allows.

Learning new concepts

Need to learn or understand a new concept? Ask for it to be explained in simple terms that a beginner could understand.

Want to know about inheritance with Python?

"can you explain inheritance in python with examples in simple terms for a beginner"

You’ve heard “idempotance” in relation to PaaS (Platform as a Service) but never fully understood it?

"can you explain idempotence with respect to platform as a service systems and terraform with examples"

Summary

As with all code on the internet…use at your own peril. ChatGPT and its peers are liable to hallucinate. Asking it to provide factual information, you can ask it to stick to the facts rather than make things up and hope that the answer is “correct”.

So, can I use it in my day job…absolutely. As long as your prompts are worded correctly and your prepared to do some extra checking.

The future is interesting. We’re not quite at Skynet or HAL 9000 levels of intelligence or self awareness yet…