Hello, this is Motohashi from Kintan Lab .
When creating a kintone plugin, there are times when I feel the urge to turn everything into a plugin. It's like having a hammer and everything looks like a nail. At that time, I discovered how to use the ChatGPT API, and this is a record of my experiment in hammering nails into kintone with glee.
What is ChatGPT?
By the way, ChatGPT is an artificial intelligence that can hold a conversation. Looking at it from another perspective, it is "software that understands natural language."
Natural language is a language used by natural intelligences like us to communicate with each other, such as Japanese or English. Until now, humans could not communicate with computers without using computer language. ChatGPT is an interpreter that allows us to converse in natural language.
Many programmers work as interpreters (programming) between this natural intelligence and computers, so I can understand the fuss that ChatGPT's appearance as an interpreter will cause jobs to disappear.
I'd like to join in the fun and have some fun together, so I'd like to try having him take over my work.
Experiment
This time, we tried ChatGPT to use a technology called "natural language processing." Natural language processing is something like, for example, "Read the following text and express the author's feelings in one word." If you read a text and summarize it briefly, it's a "summary," if you express the main topic in one word, it's a "topic extraction," and if you speak on behalf of the author's feelings, it's a "sentiment extraction."
Answer the author's feelings using the Japanese calendar.
First, let's convert dates, which is easy to understand. This is the Japanese calendar to Gregorian calendar conversion, which is a common process when customizing kintone. By default, kintone can only handle the Gregorian calendar.
I would like the text "August 2, 1979, 18:30", expressed in the Gregorian calendar, converted from a kintone date and time field, to be converted to the string "August 2, 1979". In kintone, the auto-calculated field in the following snapshot is used as input, and the conversion result is written to the output field.
prompt
Please convert the Gregorian calendar into the Japanese calendar from the date and time expression in the format "YYYY year M month d day H hour m minute" that follows, and output it together with the date. The time is not necessary. The Japanese calendar can be Meiji, Taisho, Showa, Heisei, or Reiwa. Please output "Reiwa WW year M month d day".
Successfully, the Showa era date has been output in the "Output field".
Recently, I was asked to "extract only the date from a date and time expression," so I made a plugin to do that. If you use ChatGPT, you can just say "I want this processing!" in natural language and it will do the job without having to write the processing in JavaScript.
Naturally, one of my jobs disappeared.
Judge the author's feelings as spam
Can you determine whether an email you receive is spam? To test it out, I pasted the text of an obvious spam email into the input text field and had ChatGPT determine it using the following prompt:
prompt
You have received the following email. Please judge whether this email is spam or not, and print the score on a 10-point scale, with 10 being spam, as "Spam level: xx points" on the first line. Next, please include a blank line and explain why you judged it that way.
They gave me a score out of 10 for how spammy it was and explained why it got that score.
I think many people use web forms and kintone in conjunction with each other. When an inquiry has a high spam rating, it seems like it would be okay to ignore the inquiry. It is now possible to pre-process inquiries without reading the contents.
Previously, I had created an external kintone integration that used a natural language processing library to analyze inquiries from web forms on the server side and assign them to the appropriate person in charge, but from now on, I can just ask ChatGPT to do that for me.
Once again, I have succeeded in getting my job taken over by AI.
Communicate the author's feelings to other computers
At the beginning, I wrote about natural language and computer language, but ChatGPT is also good at computer language. You can also have ChatGPT speak computer language. Here, let's have it speak in a data format called JSON.
If ChatGPT can speak JSON, you can have other programs you've created talk to it directly. Just prompt it to return JSON.
prompt
I received the following email. Please judge whether this email is spam, give it a score out of 10, with 10 being spam, and explain why you judged it that way.
{ "chatgptkintone": { "spam-score": N, "description": "Description of the score" } }
Please output the json.
It returned JSON that you won't be embarrassed to use anywhere.
If the response from ChatGPT is JSON, the plugin can receive it, do something with it, and then sort it into the appropriate fields on kintone. That kind of detailed handling is what programmers are good at.
This is the moment when AI gives back the jobs that it took away.
Split the author's name into first and last names
This is not limited to kintone, but we often receive requests to split data that stores surnames and given names into surnames and given names. This is a difficult problem. To be honest, even if we let humans make the judgment, we can't understand what we can't understand. If we go back in time, the rules for names are different, such as for Minamoto no Yoshitsune.
Leaving aside the details, I asked ChatGPT for help.
prompt
Split the name that follows into a surname and given name and guess whether it is male or female. Output the guess results in the form "surname/first name (gender)" on each line.
It's divided neatly. It's also successful in making names that may seem difficult to understand.
If you were to program this name splitting using conventional methods, you would have to use a dictionary of 150,000 to 300,000 surnames (negotiable). It's not impossible, but it seems like a long shot when you consider surnames with many kanji characters that are homophonic, like Saito and Watanabe.
Apparently it was.
That aside, it seems like we can leave even the most troubling tasks to ChatGPT. If we make a mistake, it's ChatGPT's responsibility. It's the first step towards a society that tolerates mistakes.
Rather than being left out in the cold, it seems that programmers are now able to do more.
Can you really end up homeless?
ChatGPT has an API, so it can be considered a software component. It can also be said that natural language processing can now be handled by calling an API. Since the scope of what programmers can process has expanded to include natural language, rather than leaving them out in the cold, they have probably gained more work.
Let's let AI take over the work we are currently doing and swing the new hammer of AI to our heart's content.
Where are the nails!
I published the plugin on github
This experiment showed that by linking ChatGPT with kintone, various natural language processing tasks that were previously difficult to perform can now be easily incorporated into kintone.
https://github.com/motohasystem/KintoneChatGPTPlugin
The kintone plugins used in the experiments so far are available on github. There is also a zip file that you can try out right away, so please give it a try if you like. You can try out the experiments in this article with ver.0.3. (The setting screen has changed since 0.4.)
https://github.com/motohasystem/KintoneChatGPTPlugin/tree/main/dist
If you have any questions about how to make ChatGPT more advanced, or if you have any issues that you would like to address with AI integration, please contact Kintan Lab.