top of page
Writer's pictureMichael Tobin

Building an assistant with GPT-4o

There have been some massive announcements from Build this week, from Co-pilot to Kubernetes, but I think it's no exaggeration to say that AI has been the star of the show. The release of "Assistants" and GPT-4o really caught my eye, and I wanted to jump into the OpenAI studio to test them both out. GPT-4o boasts GPT-4 Turbo performance on text in English and code, with significant improvement on text in non-English languages, while also being much faster and 50% cheaper in the API.


My aim is to build an assistant which acts as a "Pair Programmer" for my Terraform deployments.


Deploying GPT-4o

I originally wanted to do this through the AzureAI Studio but I had some issues deploying any GPT models linked to my OpenAI Resource (this is most likely because the resource was new & new OpenAI Request form was recently approved) so I headed to Azure OpenAI studio, and everything worked.


First off you want to create a new deployment in the studio, this can be found under "Management" -> "Deployments"

Please note, GPT-4o is limited to US Regions at the time of writing this, so you'll need a Azure OpenAI Studio deployment in the US.


I've left the advance options as default for now, you can go back and change this.


Creating my Assistant Prompt

Assistants require a set of instructions to define their purpose. These can be as simple, or as detailed as you require. Because I'm lazy, I'm going to ask GPT-4o to create this prompt for me in the Chat playground.

"You are an AI assistant acting as a "Pair Programmer" specializing in Terraform and Azure. Your task is to collaborate with me on infrastructure-as-code (IaC) projects, provide insightful suggestions, debug issues, and optimize resource configurations. Your goal is to help improve efficiency, ensure best practices, and ensure seamless deployment and management of Azure resources using Terraform."


Building the Assistant

Now I have my prompt, all I need to do is give it a name, import the "Instructions", save and test it out.


Testing the Assistant

My initial prompt was:

What is best practice around multiple environments in Terraform, how can I use tfvars to deploy the same code into different environments?

The output was pretty good, examples provided of directory structure, resources, variables. Examples of how to form the tfvars file and how to run the apply with the correct tfvars file.


Jailbreak Testing

I wanted to test asking my assistant a completely irrelevant question - not related to my instructions at all.

I don't want my assistant to provide any information outside of Terraform or Azure. This is where your instructions come in - I've added "Do not answer any queries that do not relate to Azure or Terraform." to my instruction set.


Luckily, this is just a test playground just for me, but anything end user facing should be tested for jailbreak - I talk a bit more about this & the importance of testing your models here.

Looks much better to me!


I can't wait to explore more possibilities with GPT-4o, this is a really basic introduction and example of what it can do. More posts to come!


28 views

Comments


bottom of page