On ChatGPT and OpenAI

4 minute read

ChatGPT/OpenAI/AI Text Generation … is the ancestor of Jarvis from Ironman. It is the beginning of the wave that will drive life altering innovations for everyday life. I know that is a big claim but hear me out. 

I was playing around with OpenAI earlier this week and specifically trying to see if it could help me solve some mundane coding tasks more efficiently. I was trying to mock out some data to stress test a piece of the UI I was working on and I had the idea to write a function to generate a random string to fill in some properties on some generated instances of made up data. I started to write a generateRandomString function when it occurred to me that this seemed like something that plenty of others had already done so why was I doing it manually? Then it occurred to me this feels like the type of thing AI could do very easily. I hoped over to an OpenAI sandbox and asked it to generate a function that returned a random string with a length equal to a given input. Digital-clack-clack-clack later and there it is. 

image of function code

A perfectly good function that does exactly what I need. Satisfied with having saved myself time and having gotten to play with a new toy I happily moved on to finish my actual task. All was good. Yeah cool it’s basically a much better intellisense. Not all that life changing. Fair point. However, and I didn’t realize it at the time, I was only scratching the surface of what this type of tool can do.

A few days later I was recounting the above story to a coworker and they joked “I know we will all be replaced by robots”. I laughed and thought “yeah well until it can write a component for a UI I’m not too worried”. Then I really thought about that. Could it do that already? So I fired up OpenAI once again and asked it “write me an angular component that displays the current date and time”. To my surprise it spit out a working component with imports, interface implementations and an HTML template. I was utterly shocked and for the first time slightly concerned for my job security ;-) 

original component code

I couldn’t believe it worked so well. As I looked at the generated code more I noticed it wasn’t ideal. It used a setTimeout to constantly update the date time value. Is this the worst offense for a component with zero context generated on the fly? Absolutely not but it did make me think “ok well until it can do it using observables or whatever the latest coding trend is I shouldn’t be that worried”. Then I remembered you can ask it to refine its output. So I entered “use observables instead of setInterval”. And guess what? Yup it did it mostly correctly. 

observables generated code

I was complete astonished. I just stared at it for a good few minutes. That is when I remembered a scene in the original Ironman movie where Tony Stark is designing his suit and simply tells Jarvis “now do it in Hotrod Red”. 

tony stark and jarvis

The ability to refine the output is basically like doing a code review. I looked at the first draft and didn’t have to think of all the effort that went into getting there I could start at the completed stage and optimize it for what I thought made the most sense for my situation. And I could do it in plain thought. For me this refinement with context is the true gift here. I don’t know exactly what will come out of a generated response     

How ChatGPT Writes This Post

Prompt

Write a blog post that explains how ChatGPT is the precursor to technology like Jarvis in the science fiction world of Ironman

Response

In the science fiction world of Ironman, Jarvis is the advanced AI personality that serves as Tony Stark’s assistant. Jarvis aids Stark in daily tasks, from scheduling appointments to providing tactical advice in battle. But what if there was something like Jarvis available today? Enter ChatGPT, an AI-powered chatbot that is the precursor to technology like Jarvis. ChatGPT is a natural language processing (NLP) chatbot that uses machine learning to understand and respond to user queries. It can be used for a variety of applications, from customer support to virtual assistants. At its core, ChatGPT is powered by an advanced natural language model. This model has been trained on thousands of conversations, allowing it to understand and respond to user input in a conversational way. It’s also capable of recognizing and responding to context, so it can provide more accurate answers to questions. ChatGPT can be used in a variety of ways. For example, it can be used as a customer support agent to answer questions and provide guidance, or it can be used as a virtual assistant to answer simple questions and provide reminders and tasks. The possibilities for ChatGPT are endless, and it’s only getting better. As the technology continues to develop and advance, it will become more and more like Jarvis in the world of Ironman. We’re already seeing this in the customer service and virtual assistant applications, where ChatGPT can provide automated responses to customer queries and assist with scheduling tasks. ChatGPT is an exciting new technology that’s paving the way for the Jarvis-like AI of the future. As it continues to improve and evolve, it will become increasingly more capable of providing the same level of service that Jarvis does in the world of Ironman.