Artificial Intelligence Services at no cost for Oracle Intelligent Advisor Demos

See! Here at intelligent-advisor.com we too can write articles about Artificial Intelligence Services (for example, our sister site Siebel Hub has been experimenting with the OCI AI Services.) Since the rest of Internet is now completely overrun with articles about how to improve your business / your waistline / your bank balance / your LinkedIn likes with AI (in all its forms), we decided to get in on the act. This article however is about how you can make demonstrations of the commonest AI services within Oracle Intelligent Advisor / Oracle Policy Modeling without spending a single cent / penny / centime.

For our own demonstrations we use CodeProject.AI. This open source, locally installed server basically gives you all the standard AI services (sentiment analysis, text summary, image recognition, ANPR, LlamaGPT – Meta’s answer to ChatGPT, and a whole lot of other services that come supplied as modules of the server). And it is SO simple to install. It drops in as a Windows service but comes also ready to install on Docker, Mac and Linux and the source code is available too. It hides all the horrible complexity of getting everything to work and just gives you a bunch of APIs. It’s fabulous. It can be extended and you can write your own modules, and you can hook it up to various bits of hardware. But for our purposes, we just need a simple to use back-end to be called from interviews.

The second part of the approach used in this article, is that we don’t always have access to a Hub. In real life, any API call would go via an Interview Connection for security. But since this is a local server (if you choose to install it on your laptop) you can also just call it using the traditional Mozilla “fetch” rather than the Oracle Intelligent Advisor-specific “interview.fetch()” which means your AI demonstrations become even more portable. Listen carefully – I am not telling you to stop using interview.fetch(). I am saying that for a stand-alone, disconnected from the internet, sitting with a laptop, “do me a demo now” scenario, you’re covered. But for real-life stuff, use interview.fetch() and talk to your CodeProject.AI server the proper way.

To install, just go to the website and follow the instructions. You will end up with a server accessible on http://localhost:32168/ . You can install and enable any modules you need for your demonstrations from the installer page. Enable them once installed and you can even test them in the supplied CodeProject.AI Explorer page. It doesn’t get easier than that, frankly.

Artificial Intelligence - CodeProject.AI Server

Let’s look at two examples

  • Sentiment Analysis

This CodeProject.AI API takes form data with one element – text – and sends back a bunch of output including the sentiment score and the confidence factor. Perfect for your interview to branch or display different things based on the output.It’s going to look something like this (adapted from the examples in the API documentation) :

var formData = new FormData();
formData.append("text", yourtext ); // yourtext being whatever you need to analyse, for example a control on the Screen
var url = 'http://localhost:32168/v1/text/sentiment';
                    fetch(url, {
                        method: "POST",
                        body: formData
                    }).then(response => {
                        if (response.ok) {
                            response.json().then(data => {
                                var theTextArea = document.getElementById("myoutputelement"); // an element to display the output of the service
                                theTextArea.value = 
                                ("success: " + data.success) + ("\nis_positive: " + data.is_positive) + ("\npositive_probability: " + data.positive_probability.toFixed(2)) + ("\ninferenceMs: " + data.inferenceMs) + ("\nprocessMs: " + data.processMs) + ("\nanalysisRoundTripMs: " + data.analysisRoundTripMs)
                            })
                        }
                    }).catch(error => {
                        var theTextArea = document.getElementById("myoutputelement");
                        theTextArea.value = ('Unable to complete API call: ' + error);
                    });
  • Text Summary

This API takes two form data inputs – the text to summarize and the number of sentences to output. This can be very useful for the agent if they are faced with a free text attribute and lots of text to read. So it is pretty much identical:

var formData = new FormData();
						formData.append("text", summaryAttributevalue);
						formData.append("num_sentences", thenumbeofsentences); // an integer attribute or variable
						var url = 'http://localhost:32168/v1/text/summarize';
						fetch(url, {
							method: "POST",
							body: formData
						}).then(response => {
							if (response.ok) {
								response.json().then(data => {
									var theTextArea = document.getElementById("customInput");
									theTextArea.value = 
									("success: " + data.success) + ("\nsummary: " + data.summary) + ("\ninferenceMs: " + data.inferenceMs) + ("\nprocessMs: " + data.processMs) + ("\nanalysisRoundTripMs: " + data.analysisRoundTripMs)
								})
							}
						}).catch(error => {
							var theTextArea = document.getElementById("customInput");
							theTextArea.value = ('Unable to complete API call: ' + error);
						});

Of course, with only local resources, CodeProject.AI is never going to be some huge Cyberdyne Systems / Deep Thought Artificial Intelligence platform, so don’t expect the same level of accuracy or content as the online behemoths. But it definitely ticks all the boxes for demonstrations “on the fly” for Oracle Intelligent Advisor (and actually more than just demonstrations, to be honest).

If you are interested in the demonstrations, the Zip is available, just drop a comment below (it assumes you have installed the CodeProject.AI server in the local machine, but you can change that of course in the JavaScript files, just look for the fetch calls and change the URL ). Bear in mind that Internet Explorer does not support fetch() or interview.fetch() so you will have to run your project from Oracle Policy Modeling using Ctrl+F5 to open it in a real browser.

Here’s a video of CodeProject.AI working locally in a laptop. Have fun, and look out for further Artificial Intelligence examples in the coming weeks.

video
play-sharp-fill

Author: Richard Napier

After 8 years in case management and ERP software roles, Richard Napier joined Siebel Systems in 1999 and took up the role of managing the nascent Siebel University in Southern Europe. He subsequently was Director of Business Development and Education for InFact Group (now part of Business & Decisions) for 8 years. He now runs Intelligent Advisor IT Consulting OÜ. Owner of intelligent-advisor.com, he also is Co-Founder of the Siebel Hub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Intelligent Advisor IT Consulting Serving Customers Worldwide
Hide picture