As a coding hobbyist, I am always on the lookout for some small project I can work on for fun. I will be the first to admit that I am not very good at it. When I first started to hear about AI Chatbots, my first thought is this is a gimmick. My first attempt to talk to one left me feeling that it was even worse than I thought. I then decided we were still a long way off from any real intelligence. Then one day I saw Bings chat bot was now available, so I tried it as well and got the idea to ask it to write a simple python code. It spit it out so quickly that I was surprised. It was much faster than I could type, much less think. I tested the code and it worked. At this point the idea was born to see if these bots could write a more complicated program with no help from me for the coding. All I would allow myself to do is ask the bot to fix something or change something. So follows that journey of Unlocking the Power of Coding: My Journey with Chat.OpenAI.com.
What is GPT-3 and how does it work?
Before I dive into my experience with Chat.OpenAI.com, it is important to understand what GPT-3 is and how it works. GPT-3 (Generative Pre-trained Transformer 3) is a machine learning model developed by OpenAI that uses deep learning to generate human-like text. It is capable of generating text in a wide range of styles and formats, including articles, essays, and even code. GPT-3 is trained on a massive dataset of text, which allows it to understand and emulate human language patterns.
GPT-3 works by taking a prompt (a few words or sentences) and generating a continuation of that prompt based on its understanding of human language patterns. For example, if you give GPT-3 the prompt “Once upon a time”, it might generate the continuation “there was a beautiful princess who lived in a castle”. This is similar to the way that humans generate stories or text based on a given prompt.
Writing code with Chat.OpenAI.com
Initially I was going to use Bings chat bot, but I soon found that I was limited on how much I could use it. So, I switched over to https://openai.com/blog/chatgpt to see if I could fare any better. I spent a good amount of time just seeing how I needed to ask things to get the best responses and honestly this is still a work in progress.
My initial idea of what I wanted it to create was a spinning wheel that would have restaurant names in it, and you could spin it to choose a random place where you would eat lunch that today. I then decided it would be better to make it any name so it could be used for multiple purposes. I came up with an initial prompt for what I wanted the bot to do for me. Here is that prompt.
Write python code to randomly choose a name from a database. It must have a graphical user interface with a wheel that spins in a circle and lands on an arrow, just like in roulette. It must allow the user to add and remove names to and from a sqlite database. The wheel has the names on the wheel. Each name is a separate section of the wheel. It needs a button to click to spin the wheel.
This produced a very basic idea of what I wanted but it required a ton of modifications to get it to what I had envisioned.
Sample list of the changes that required further input
- The names were just straight across on the screen and needed to be angled with the wheel and each pie section of the wheel
- The pie sections did not have colors
- The wheel would not spin so I ended up getting it to spin the arrow around the wheel
- The arrow would then initially spin around the center of the wheel straight up and down
- The add, remove and spin buttons only worked when pressed with the mouse, I wanted the enter key to work as well
- I wanted the colors to be random each time it loaded or when a name was added or deleted
- The random colors were sometimes too dark for the black letters so it had to be limited to light to medium colors in the wheel
- It needed a black border added
- After getting the spin button to work by pressing enter on the keyboard, the spin would not travel a full circle so that had to be modified
I am most likely forgetting many things, and all of these took multiple attempts to get right, but I think you get the point.
What did I learn that may help others?
You need some knowledge of coding, even if basic. If you have no knowledge of coding then you will struggle more. It really helps to look at what it has given you and figure out what it is trying to do, especially if it is not working as expected. It will help you to correct its output.
The bigger the code gets the harder it is for the bot to return the full code. Sometimes when you ask the bot to modify something in the code it will try to rewrite the entire code in the chat box. This would be fine and, in some cases, preferable, but in reality, it freezes up and just stops responding very often. Most of the time, you only need to modify sections of the code and not the entire thing. This is why it is best to get it to focus on that section of code. For example, if you know it is something to do with the add function of the code, then you ask it to modify that section. If it still attempts to spit out the entire code, which it has done sometimes, just stop it and type it out again and tell it that you are only interested in that section of code.
Wording is key. How you word your prompt will affect the output. Sometimes it simply does not understand and does not understand that it does not understand. Don’t let its conversational nature fool you. 🙂 If it gets it wrong, think about what you typed and see if it could be re-worded.
Error messages. If you apply the code it gives you and on running it, it produces an error message, then copy that message back in the chat. Often, it can resolve what it did wrong.
Feed it your code – Important. It is conversational, but it seems to forget sometimes or only holds so much information. I always start over with something like “Let’s start over with a new script that I will ask you questions on.” It will then ask you for the script. I then just paste it into the chat, and it replies with “how can I help” or something similar. At this point I tell it what I am wanting to do. For example, I might say, “The random color of the pie sections needs to be light to medium in color only.” If at any point you move on to a new task to change or it has tried and been failing, start over again by feeding it the code again.
Ask for an explanation. Often it will write out some explanation or instructions along with the code. Don’t forget it is conversational so if you do not understand something it said, ask it to explain it. It does a pretty good job of that.
Use wording from script. It is beneficial to use the names used in the script so that it can understand better. For example, if you have something called an arrow defined, then use that word. Don’t say “I want the pointer thing to move in a circle.” Say, “I want the arrow to move in a circle.”
It’s impossible. Somethings really are. You may have to rethink what you are doing and change your approach.
The end result
The end result is a working python script, fully written on Chat.OpenAI.com, using the Chat GPT 3.5 model. My only input was trying to tell it what needed to be done and then testing that it worked as intended. Here is a video of it in action.
Click here to download the exe >> Spin The Wheel (20 downloads)
If you prefer the python script click here SpinTheWheel.zip (37 downloads)
Keep in mind this is not a known software so you will most likely get warnings on download and on installation.
Benefits of using Chat.OpenAI.com for coding
There are many benefits to using Chat.OpenAI.com for coding. First and foremost, it can save you a lot of time and effort. Instead of spending hours poring over documentation and writing code from scratch, you can simply describe what you want to accomplish and let Chat.OpenAI.com do the heavy lifting.
Another benefit of using Chat.OpenAI.com for coding is that it can help you write more efficient and effective code. The chatbot is trained on a massive dataset of code snippets and programming best practices, which means that it can generate code that is optimized for performance and readability.
Finally, using Chat.OpenAI.com for coding can help you become a more productive and effective developer. By offloading some of the more mundane and time-consuming aspects of coding to a chatbot, you can focus on more important tasks like designing and implementing new features.
Conclusion – unlocking the power of coding with Chat.OpenAI.com
In conclusion, Chat.OpenAI.com is a powerful tool for developers that can help you write more efficient and effective code. By using GPT-3 to generate code snippets and complete programs, you can save time and focus on more important tasks like designing and implementing new features. While Chat.OpenAI.com does have some limitations, it is still an incredibly valuable tool for developers of all skill levels. If you want to unlock the power of coding, give Chat.OpenAI.com a try today.
All in all, I was quite impressed with the experience and the results. I honestly did not think I would be able to complete this project without having to intervene by writing the code myself. For full disclosure, I started with the free version but after experiencing the issues with it stopping while writing out larger pieces of code, I decided to subscribe to see if that would help. It did not. It might have helped in other ways, like not having to wait etc, but it did not help with the reason I purchased it.
I suspect that if I had put more effort into my initial prompt, it would have required less modifications. I guess we will see on my next attempt!
Looking for a more efficient way to write code? Try Chat.OpenAI.com today and experience the power of GPT-3 for yourself!
Find more on https://notposted.com