ChatGPT, SAP HANA and Jupyter notebooks, a match made in heaven!
Ever since I came across ChatGPT, I’m in complete awe. For those of you who don’t know what it is is, ChatGPT, which stands for Chat Generative Pre-trained Transformer, is a chatbot developed by OpenAI. ChatGPT is built on top of OpenAI’s GPT-3.5 family of large language models, and is fine-tuned with both supervised and reinforcement learning techniques. In short, it is damn smart and gives a peek into the future of AI. ChatGPT has been trained with millions of datasets and can give answers on every question possible. ChatGPT interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests. ChatGPT can also code. Ask it to check the syntax of a program with a misstake, and it will correct it. Ask it to reverse engineer a piece of code, and it will. According to my kids, it’s also great at writing homework assignments, but thats for another day ;-).
In my current projects with SAP Datawarehouse Cloud we come across a lot of use cases where SAP HANA data is combined with ML and AI to train models. These models are trained by using Python and Jupyter notebooks are used to write the code in a structured way, and to execute it.
Having said that, I had an idea. What if I could combine ChatGPT with a Jupyter notebook and HANA? Would I be able to use it as the ETL of the future? Simple ask it a question and see if it could gather the results and write it back into HANA so that I could use it for further processing and reporting. The use cases would be endless. The journey starts!
An awesome Chrome extension
I love open source. The number of GitHub projects already using ChatGPT without it even having a proper API is endless.
I tried out many Python libraries which are available, but then I came across something truly magnificent. A Chrome extension which does exactly what I need. Interact with Jupyter natively without breaking a sweat. The extension can be found here. Installing it is a piece of cake.
Putting it to the test
So part of my Xmas shopping list is done. The final piece I need is a way to connect HANA to Jupyter. Lets ask ChatGPT how to do that:
Now thats convenient! Would it be smart enough to generate the python code itself?
Thank goodness it is not smart enough to guess my credentials to connect to the HANA Cloud database. So, I add the credentials and execute the code in my Jupyter notebook:
It has created the entries by simply asking!
And now for the icing on the cake. Would it be smart enough to simply adapt my code by giving it as an example and generate a new table on a completely different topic? Lets find out:
Now you can think of many other use cases. Ofcourse you could also select data from HANA and use the results in another calculation. E.g. predict the number of Christmas trees which will be sold in 2022
Select from my Christmas tree sales from HANA:
Merry Christmas everyone!
I can’ wait to see what use case you come up with!