How to Write Code with AI
I was an AI skeptic. I had seen other AI products in the past and I was not very impressed with their capabilities. Now I am blown away by what these AI products can do. The two tools that I have been using the most are Chat GPT and Perplexity.
https://chatgpt.com/
https://www.perplexity.ai/
Chat GPT is the most famous of the new wave of AI tools. It provides answers to questions and can write some decent python code. I prefer Perplexity because it cites sources when it provides answers to questions and I find the code it writes to contain less errors. Chat GPT also has a limit of how many free questions you can ask during the day whereas Perplexity does not.
What I like to do when I want to see code output from an AI is ask the tool how it would achieve a certain task. What API calls would it make? What headers would it include? What dependencies are necessary etc. Then I ask the AI tool to write a python script that accomplishes this task using this method.
Users may have to iterate a bit if they run into errors trying to run the script. Reporting errors back to the AI and asking it to tweak the script are necessary. A natural second step in the code writing process is for the AI to add code providing additional logging into the script so that users can trouble shoot.
Check out this book on Financial Planning from Ramit Sethi:
I Will Teach You to Be Rich: No Guilt. No Excuses. Just a 6-Week Program That Works