AI

ChatGPT- My First Post About AI in Real IT

Considering my title on LinkedIn says I’m the RDBMS Dinosaur Farmer, you might be surprised to see a blog post on artificial intelligence (AI) coming from me, but I’ve been interested in the field for some time.  There was also a time where I was spending considerable hours on IOT and new technology, only having dug deep into Oracle when it was clear that this was what we needed from me after I joined Microsoft just short of five years ago.  I was hired in Analytics and AI, but it became apparent quite quickly it wasn’t going to be my focus less than four months into my new role.

Now that the Oracle Migration Accelerator is launched, I’m re-investing my technical time in what interests me and that topic is AI.  I’ve been working with a few, defined areas which bring me “technical joy”, (I’m stealing Marie Condo’s coin phrase since she’s not using it anymore…) which puts me squarely in the following areas:

  • AI prompt capabilities
  • AI to support code generation
  • AI data modeling to scale technical automation.
  • AI to support technical documentation.

I may pepper in a few things around MidJourney, Dall.e and others, but most of my time will be spent in ChatGPT, BARD, CoPilot and others in this realm.  For this first post, we’ll start with code generation, as what I couldn’t do just two months ago, I can do today, which is pretty mind-blowing.

AI and Prompts and Code Generation

For AI, the prompt is everything. An AI prompt is a text-based instruction, or a piece of information provided to an AI system to generate a specific output. AI prompts are used to guide AI systems to produce responses, text, images, or other types of content based on the input given to the system.  For users of AI, this is how they deliver their request to the AI and how we interact with AI today.  For IT, a prompt may be more code based and have more complex delivery systems, but code can be complex, so it shouldn’t surprise any of us.

I think it’s easy as we watch AI evolving week in and week out, if the days of the programmer are over.  I think those who have advanced programming skills will always have a role, but yes, there may be a challenge for new programmers to break into the industry when AI can offer solutions so easily.  How do AI and how much is required for AI to create code via prompts?

  1. Input/output examples: This type of prompt provides one or more examples of input and expected output and asks the model to generate code that produces the same output when given the same input. For example, given a list of numbers, the model might be asked to generate code that returns the sum of those numbers.  I’m working on a project now that is using vector in and out parameters to help ChatGPT to provide translations in code from Batch to BASH scripts for a customer.
  2. Natural language descriptions: This type of prompt provides a natural language description of a task and asks the model to generate code that performs that task. For example, given a description of how to sort a list of strings, the model might be asked to generate code that implements that sorting algorithm.  Many times, AI can come up with this algorithm faster than a human coder might, saving human resources considerable time.
  3. Code skeletons: This type of prompt provides a partial code implementation, with some key parts left blank, and asks the model to fill in those blanks. For example, given a partially implemented function that adds two numbers together, the model might be asked to complete the implementation by filling in the missing arithmetic operations.
  4. Multiple-choice questions: This type of prompt presents the model with a set of possible code implementations and asks it to choose the correct one. For example, given a problem that involves string manipulation, the model might be asked to choose the correct implementation of a function that concatenates two strings.  This is another example where human resources are necessary to the success of the AI solution.
  5. Contextual prompts: This type of prompt provides the model with context about a problem, such as the programming language being used, or the task being performed and asks it to generate code that is appropriate for that context. For example, given a prompt that specifies the use of Python and the need to create a list of unique values from another list, the model might be asked to generate Python code that performs that task.  I used a similar formula earlier today in a post on LinkedIn, then posted the output as part of my post.

Create the Code!

As you enter your prompt, no matter if you enter it in as a natural language description, a github repository set of input/output examples, etc.  The code will be presented as most programer UI output would, with an option to copy the code with the recommended formatting intact:

This offers an easy way for the code to be exported from the ChatGPT interface or as we now are experiencing, using CoPilot with Visual Studio or just debugging our code.

Is the Code Any Good?

I think this was the biggest complaint by many of those who either used ChatGPT and similar AI early in its development or were simply quite biased that nothing unless it was developed by a seasoned programmer would be worthwhile.  AI generated code is only as good as what feeds it.  This doesn’t just go for the data, models, algorithms, and even the interference that is built into an AI, but also the prompts, etc. that are given to it to produce code of value.  For GPT-4, it was found that that hallucination rate, (rate of BS, I like to call it) was just under 9%, so expect that you’re going to need someone who can find that 9% of mistakes in the code it produces.  Each AI has its own hallucination rate, so know your AI and know what your investment will be in correcting it as it evolves.  AI learn over time and the version you are using is as important as anything else we’ve discussed here.

As code generation with AI is just in its infancy, I’ll revisit this continually, but I wanted to start here, as I think it is a topic that was at the top of a lot of programmer’s minds, just as it is in my own.