Hands on with AI tool to build software? (Feat ChatGPT)
With tons of AI related things happening around the world and hundreds of implementations popping up daily, the pace at which we are moving simply amazes me. The domain of AI has broadened to such extend that its implementation rages from medical field to defence, from generating virtual factionary images from text description to generating articles/ resumes/blogs and the list simply goes on. With all these happening, one question that keeps popping up, will AI replace humans altogether?
(Note: No* AI tools so far have claimed to replace humans, nor we are here to tame any tool out there but rather we are trying to look at the situation from a perspective so bear with me.)
Now with all this in mind, I started with a basic goal of building something that I already know but to understand how AI can actually replace my work? and I was hit with a simple idea.
If you have been following me, I have recently published an article on building a browser extension. Keeping that in mind, I thought about building the same with AI.
A bit of self-praise here, if you haven’t checked my previous article, please give it a try here Building a browser (Edge) extension | by Rohit P. Shirke | Mar, 2023 | Medium
Now, back to the topic,
As mentioned earlier, the answer I was trying to find here was, will I be able to simply ask the tool to generate what I want, and it will return the exact result? Will it replace my efforts, or will the result be something totally unexpected?
Another Note: Long post with too many screenshots!
So now to try it, I went to chatGPT site and logged in with creds.
Next was to simply ask the AI tool what I wanted and below was the result!
— — — — — — —— — With this result, my first reaction was, — — — — — —
The AI did generate pretty much what I wanted and that too in fraction of seconds! 🤯
The code generated by the tool pretty much does exactly what was asked but if you try to run it, it won’t run coz there are many small hiccups in the code. Let’s try to find and fix them with the help of tool.
📝 Note: What we are trying to evaluate here is, can the AI generate the final output that we can straightaway consum? Is that going to be reliable? Short answer: No at least for now!
Let’s move on, further I asked it for some improvements to the shared code & see what happens next,
As expected, it did make the adjustment and returned the updated code!
Further, I tried asking it to re-generate it in full and here is the response.
Well, it did refuse to generate the full code without any context but pretty much spit the code of what I asked for!
🚫 Hiccup:
Now, if you know the current state of manifest version, the V2 version is going to be deprecated and the latest supported version is V3. Now if you look at all previous output it generated, it was based on V2 version. So, it did the job but skipped the validation/recency!
I further thought about giving the tool opportunity to fix the issue. So, I tried asking counter question about deprecation of V2 and here is the output.
So, it did rectify itself but missed on another aspect, updating manifest.json file. I further tried asking the same to which it suggested updates to manifest.json file.
Now I asked about the updates on HTML and background.js file to which it returned below output.
Now, if you compare the code from the 2–1, 2–2 with 3–1, 3–2 and 4–1, 4–2 you will realise that all three version the code the implementation has slightly changed. So, even If I am continuously working on a context and trying to grab the output as in, it will not be going to work just like the Stack overflow thing! 😅 (This is though not a deal breaker)
Next was to simply ask for a fresh example to see what it returns,
But again if you see the example returned here with the version 2? which we just had recently asked it to fix.
I again asked for the fix on manifest version, and it now simply returned another example but this time almost lost context on the current tab logic?
Plus even if you run these both examples you will still get the error |
Error: Cannot read properties of null (reading ‘addEventListener’) and the reason? If you have read the code, you will immediately find it.
🚫 Hiccup:
You can’t refer the elements in the JS that are not yet loaded by DOM.
Now if you observe the code returned, it didn’t mention the background.js file which is fair but as per my previous example it was needed. So, Am I supposed to use it or not?
On futher few attempts, it returned multiple slighly modified version of the same code. With and without background.js file or use of chrome API.
Here are some versions.
and there are more…
By this time, I was simply amazed with the fact that how many combinations it returned plus it simply saved the pain of visiting n number of webistes to find the solution. Everything was kept all together!
Now, thought it was quick and pretty much on the point in answering the question, here are few takeaways,
- The code it returned didn’t executed due to some basic mistakes.
- It generated new piece of code for each iteration with slight modifications. (Obviously it's not thinking but pulling it from the various sources and hence this output)
- You will need to have your own instinct no matter how close the AI generated output is to what you are looking for.
Conclusion,
- AI is certainly going to change the way we are thinking and using the traditional tools e.g. Search? Bing Search (From traditional search list to more focused search results)
- AI will certainly improve quality of the work we are doing by providing quick and easy insights. Eg. Quick explanation and details on subjects from astrophysics, medical even analytics and more. Eg. Google workspace
- It will be closer to generate the final solutions but getting it working for us is going to be our duty!
- Certainly, there will be an impact on the mundane task that we are doing eg. Generating summaries, collecting data on topics and all but it will be there to help and enhance the way we work just like the Robots are doing.
This was a fun article to write hope you find it insightful & Thanks for reading!
Happy coding until the AI takes over! 😬😅
…