ChatGPT Scripting
If you've already configured an AI chatbot in todo4teams, you might also want to use it to automate ticket routing decisions.
This is particularly interesting for tasks that require an understanding of language and sentiment: For example, determining whether a request is a complaint or praise.
ChatGPT and other chatbots deliver good results here. To use the chatbots' responses in our scripts, we need to force them to provide short, clear answers.
This works, for example, if we ask ChatGPT the following question:
ChatGPT answers here with a simple "Yes".
In the following example code, we use ChatGPT to set the priority of a message arriving in a mailbox, depending on whether it is a complaint:
var ans = ai.ask("Evaluate whether the following message is a complaint. Answer with 'Yes' or 'No':\n\n"+task.title+"\n"+task.description);
println("Complaint: "+ans);
if(ans!=null && ans.contains('Yes')){
task.prio=3;
} else {
task.prio=0;
}
Code explanations:
- var ai = com.proxemo.todo4.server.ai.AIHelper.getInstance();
...gets the configured AI implementation into a local variable. - var ans = ai.ask("Evaluate...");
...sends a prompt to the chat agent and stores its response in the variable ans, just as if you had sent the prompt to ChatGPT in the web browser. - if(ans!=null && ans.contains('Yes')){ ...
The AI response is checked here: If the chat agent responded with 'Yes', meaning the message contains a complaint, the priority of the ticket is increased.
As a result, you'll see a ticket with the text "Why haven't I received a response yet? The device is still broken. I'll contact my lawyer tomorrow!"
with high priority in the ticket list , while a message with the text "Thank you for the quick support! That worked great!" receives a low priority:
.
Please note: