Friday, February 17, 2023

ChatGPT - Try it !!!

For an index to all my stories click this text.

Sometimes something comes up that is so current that it needs attention and other things have to wait a bit. ChatGPT is such a thing.

Undoubtedly you have heard about ChatGPT. It is an AI (Artificial Intelligence) program that allows you to pose questions in natural language and gives amazing answers. You could compare it to a search fuction (like Google). The difference is that you do not get links to webpages but a real, conversation like, answers. ChatGPT was fed millions of documents and distills the information out of those. It is up to date with documents till 2021 (at this moment). So you will not find information on the Ukrain war. Neither can (will ??) it predict share prices.

Kids and students are using it for writing their school homework and essays. Some journalists are using it for researching stories, just like researchers. And........programmers are using it to write code.

Fear for AI.

There is a lot going on about ChatGPT. Some think it is a threat for jobs, independence, freedom etc. I am not a philosofer or visionary but I have heard this about 10 times before in the almost 50 years I have been around in the computer world. When computers were invented and became a mass product people were afraid that millions of jobs would be lost. Never happened. Robots would take over our work. Never happened. Calculators would make our kids lose their ability to calculate. Never happened. Etc. etc.
What happened is that we learned to adapt these inventions to our needs. And that is what (in my opinion) is also going to happen with this technology.

Alan Turing and Eliza

Alan Turing was a computer scientist specialised in AI. In 1936 he wrote an essay about computer intelligence. From this originated the Turing test. The Turing test is about a human sitting behind a computer screen and keyboard and starting a conversation with someone not in the room. If you can not determine if the answers you get are from a human or a computer we can say there is artificial intelligence.

It took till 1964-1966 that another scientist from the MIT, Joseph Weizenbaum, wrote a program called Eliza that could more or less carry a "normal" conversation. I had Eliza running on my Pet computer in the seventies. 



There is a Javascript version that you can play with:
http://psych.fullerton.edu/mbirnbaum/psych101/eliza.htm
Play a bit with Eliza. Although limited in modern view it still is fun, especially considering this was made in 1966 !!!

And now we have Google Home, Amazon Echo and ChatGPT. And the last one is getting better and better.

AI on this blog.

In the past I have written on this blog about AI. Think Google home. I wrote several stories on that mostly on how to use it for IOT purposes. On this blogs index page you can find links to these stories. Just scroll down till you see Google Home Assistant.
http://lucstechblog.blogspot.com/p/index-of-my-stories.html

And there was a story about writing an app for your Android phone that did image recognition. It works pretty good. If you want to give that a try you can find the link here:
https://lucstechblog.blogspot.com/2019/02/image-recognition-for-free.html

And now ChatGPT.

There is no computer knowledge or programming experience required for using ChatGPT. Anyone can use it. As stated before you can "talk" to it using everyday speech. And it is free to use !!!!



First step is to visit the website. ChatGPT is at this moment (for us mere mortals) only available through this link: https://openai.com/blog/chatgpt/  There is however an API available and that makes it possible to incorporate ChatGPT into your own projects.......

Press the purple "Try ChatGPT" button.



You are presented with a login page with the choices to log-in if you have already worked with the program or Sign up if it is your first visit.



You can log-in with your MicroSoft Account, your Google Account or your email adress.

If it is your first visit the logjn page asks for some personal information. Not really very personal. Just your name.



And then you are directed to the opening screen.
On the left side at the top you can see some previous conversations. In the main screen you can see some ideas on what you can do.

The above picture and the rest on this page shows my conversation in English. You can try to pose questions in your own language. Many languages will work. Dutch did !!



So I tried to play TicTacToe.



And it actually cheated !!!
My cross was at the upper left corner and ChatGPT overwrites it and even says so !!!!!

Well I don't really think it cheated. I guess the underlying program is just bad. But here it shows that there is no underlying intelligence here.........


As I mentioned that it was cheating it apologized. Nevertheless I won. See the three crosses at the bottom.



So is it better as Google's search engine ??? We leave that answer to ChatGPT itself.


Raspberry Pi Pico audio

Playing games is fun but I wanted to try something serious. At the moment I am experimenting with audio on the Raspberry Pi Pico. And that is a great success. The audio on the Pico in no way resembles the audio I was doing on the ESP32 with talkie. That sounded like an Apple II in the old days. Audio on the Pico sounds like real audio and I am doing a multi-story series on that so stay tuned.

So I wanted to know if ChatGPT could offer some help.   



My first question was if ChatGPT could write a program for The Raspberry Pi Pico that plays tones without using a sound-card.



And there it is. Right on the nose. Compleet with the necesary libraries and reference to a pin number. There was one little flaw. pwm.duty(period //2) gave an error. For MicroPython you need to alter this in pwm.duty_u16. I needed the tones to play on GP3 so I modified the program in Thonny and it worked like a charm.

NOTE: This is not the audio quality I was looking for. This is like the old computer bleeps. But as a test this works fine. To get this working you need a low-pass filter on pin GP3 and a active speaker (like your computer speaker). But this will all be discussed in upcoming stories about Pi Pico audio.

UPDATE TO NOTE:
Just ask ChatGPT how to build a low-pass filter with only resistors and capacitors and be amazed !!!




ChatGPT gave me the hint that it was possible to get a better sound using multiple harmonics. So I re-formulated the question.



And almost immediate came this up. WOW !!!



So obvious this was the next question: make a program that plays the full scale.



And there you are !!!
Trust me I have tried this and it works !!!


Concluding.

I am fan !!!! This is fun real fun. And it is a glimpse of what the future will bring us. It still has flaws like not exactly being aware of a programming languages syntax but it can be a tremendous aid in developing projects. Next to that you really need to think how you formulate your questions. Trial and error is what it takes. And please check the answers, there might be flaws in it. Note that it is not limited to MicroPython. Javascript is also one of the languages it can handle.

Nevertheless: play with it !!! Not only ask computer related questions but also ask about art, technical questions, ask it to write poems, ask it to write short stories on any subject you may think of, and play games. I did and got some amazing answers and even suggestions which I myself might never had thought of..........

This is costing me a lot of time. But man what fun !!!!

Oh, and from now on you never can be sure if the programs on this web-log are really written by me.

Till next time
Have fun

Luc Volders