How to call the OCI AI Language Service from the Oracle Integration Cloud

February 8, 2022 | 5 minute read
Daniel Martins Teixeira
Principal Product Manager ODA
Text Size 100%:

The OCI AI Language service is one of the new set of AI Services and it can provide valuable capabilities in the context of the Oracle Integration Cloud (OIC). I wrote about the language AI service in this post.

There are plenty of use cases where OIC could potentially benefit from AI Services, anomaly detection being an obvious one, but also language with the ability to detect sentiment, detect language and extract key words from text.

This post will focus for now on the technical side of setting this up in OIC.

Step 1: Create a Connection

This is similar to other Connections, like Object Storage or Functions.

The connection URL can be found here.

And here the usual required configuration details, like the OCID’s for user and tenancy, and the PrivateKey + Fingerprint.

I covered this more in detail in previous posts (here). All the info is available in the documentation.

Step 2 : Create an Integration (Trigger)

For this example I will create an AppDriven Integration that takes a text as input, calls the AI Service for language detection (the simplest of all) and returns the result.

The input is only a text element.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
{"text":"text"}

For the response I want some details about the DetectLanguage result, hence I will return exactly what the AI Service returns.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
{
    "languages": [
        {
            "name": "English",
            "code": "en",
            "score": 0.999992405558998
        }
    ]
}

 

Step 3 : Call the AI Service

Now we drag the connection created on step 1.

The URI is available in the documentation: https://docs.oracle.com/en-us/iaas/api/#/en/language/20210101/DetectDominantLanguageResult/DetectDominantLanguage

The request and response are defined in the API documentation.

The input is only a text element.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
{"text":"text"}

The response sample can be found in the documentation. It took mine from a POSTMAN response.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
{
    "languages": [
        {
            "name": "English",
            "code": "en",
            "score": 0.999992405558998
        }
    ]
}

Step 4: Mapping

This is pretty straightforward.

And below we map 1-1 the CallAILanguage response to the output.

Test

Ok, let’s put this to the test!

 

And with another language!

 

Notes:

The language service has several capabilities, like Sentiment Analysis, Key-Phrases extraction, Text-Classification etc. This was just a simple example on how to configure everything.

This post was originally published here.

 

For more Information about the Oracle Integration Cloud please visit here.

Daniel Martins Teixeira

Principal Product Manager ODA

Daniel Teixeira is a Principal Product Manager within Oracle's Digital Assistant development team responsible for technical enablement. With a strong background in consulting and pre-sales, in and out of Oracle, he brings those experience elements into creating and delivering enablement sessions for partners and customers. He actively writes about Oracle Digital Assistant and other Oracle technology on techtrantor.com.

Show more

Previous Post

February 2022 Oracle Integration Update

Antony Reynolds | 2 min read

Next Post


February 2022 New Third Party Application Adapter

Madhav Poosarla | 4 min read
Oracle Chatbot
Disconnected