Configuring Large Language Model (LLM) REST Service

Overview

Oracle E-Business Suite Release 12.2.15 introduces features that generate text for specific business functions by invoking a Large Language Model (LLM).

Key Features

The LLM REST service provides the following key functionalities:

High Level Architecture

The following diagram illustrates the high level architecture of the Oracle E-Business Suite REST service invocation using LLM:

Architecture Diagram for Oracle E-Business Suite REST Service Invocation Using LLM

the picture is described in the document text

The preceding diagram depicts that when a user sends a request through an Oracle E-Business Suite application, the system reads data in Oracle E-Business Suite and calls AI Services in Oracle Cloud Infrastructure (OCI) for LLM to process the specific Oracle E-Business Suite data. The system returns generated data as a response to the application user. The user accepts, rejects, or edits the generated text if necessary before saving the transaction.

The OCI AI Services supporting Cohere and Llama models will allow users to configure the prompt and configuration parameters for Oracle E-Business Suite applications use cases. The OCI AI Services can point to one or more LLM instances.

Accessing the LLM Service User Interface

A system administrator can access the LLM service UI pages through a new responsibility called LLM Service Administrator to configure service accounts, instances, and contexts as required for LLM service invocation. The administrator can also monitor all LLM service invocations through LLM Service Monitor.

This appendix explains how to configure LLM service parameters and how to use LLM Service Monitor to track the LLM service invocation details. Specifically, it includes the following topics:

Additionally, this appendix includes the API information that invokes LLM REST services and provides the context feedback. See: LLM REST Service APIs.

Setting Up and Configuring LLM Service Parameters

A system administrator or a user who has the LLM Service Administrator responsibility can log in to Oracle E-Business Suite and access the LLM service UI pages to configure LLM service parameters. This section includes the following topics:

Configuring Service Accounts

To protect LLM service content and its associated infrastructure from unauthorized access, user authentication information is configured in a service account.

To configure service accounts for using LLM authorization parameters, select the LLM Service Administrator responsibility and then LLM Service Accounts from the navigation menu. The LLM Service Account Search page appears with existing service accounts listed in a table.

LLM Service Account Search Page

the picture is described in the document text

The system administrator can perform the following tasks in the LLM Service Account Search page:

Searching LLM Service Accounts

To locate desired LLM service accounts, enter an account identifier as the search value in the "LLM Service Account Identifier" field and then click Go. The accounts that match the account identifier value are retrieved and displayed in a table.

Creating and Updating LLM Service Accounts

In addition to searching existing service accounts from the LLM Service Account Search page, the system administrator can create a new service account and update an existing account if needed.

Creating a New LLM Service Account

To create a new LLM service account, click Create LLM Service Account. The Create LLM Service Account page appears. Enter the following fields to create an account with authorization parameters:

Create LLM Service Account Page

the picture is described in the document text

Click Apply to save your entry. The newly-created LLM service account is automatically added to the LLM service accounts list in the LLM Service Account Search page.

Updating an Existing LLM Service Account

Once a service account is created, a system administrator can modify the account information if needed.

To update an existing service account, click the Update icon in the LLM service account table. The Update LLM Service Account page appears. The administrator can update the values of the API Configuration and Update Private Key fields for the selected account.

Update LLM Service Account Page

the picture is described in the document text

To view the API Configuration information in a larger text field, drag the triangle icon on the lower right corner of the text field to increase its height and width to display the full API configuration information.

Click Apply to save changes.

Configuring Instances

An instance defines an LLM service endpoint and configuration information.

To configure LLM instances, log in to Oracle E-Business Suite as a user who has the LLM Service Administrator responsibility, then select Instances from the navigation menu. The LLM Instance Search page appears with existing instances shown in a table.

LLM Instance Search Page

the picture is described in the document text

Similar to the service accounts described earlier, a system administrator can perform the following tasks in the LLM Instance Search page:

Searching Instances

In the Search region, enter a search value in the "LLM Instance Name" field and then click Go. The instances that match the search value are retrieved in the search result table. Each instance listed in the table contains Instance Name, Service URL, and LLM Type information.

Creating and Updating Instances

The system administrator can create a new instance or update an existing instance from the LLM Instance Search page.

Creating a New Instance

To create a new LLM instance, click Create LLM Instance in the LLM Instance Search page. The Create Service page appears.

Create Service Page

the picture is described in the document text

Enter the following fields to create a service:

Note that the CompartmentId and modelId properties can be obtained from the Oracle Cloud page.

Click Apply. The newly-created instance is automatically added to the instances list in the LLM Instance Search page.

Updating an Existing Instance

From the instances table in the LLM Instance Search page, click the Update icon for a desired instance. The Update Service page appears. The system administrator can make appropriate changes for the selected instance.

Update Service Page

the picture is described in the document text

To view the LLM Instance Config field details, drag the triangle icon on the lower right corner of the text field to increase its height and width to display the full instance configuration information.

Click Apply to save changes.

Setting Up Context

Contexts are use cases for Oracle E-Business Suite products. After configuring service accounts and instances, a system administrator needs to create contexts with required parameters to constitute request messages for the defined instances. These parameters include prompt, data API, and instance configuration.

To access the Contexts page, select Contexts from the navigation menu after logging in to Oracle E-Business Suite as a user who has the LLM Service Administrator responsibility. The Context Search page appears with existing contexts shown in a table.

Context Search Page

the picture is described in the document text

A system administrator can perform the following tasks in this page:

Searching Contexts

In the Search region, enter a search value in the "Context Name" field and then click Go. The contexts that match the search value are retrieved and displayed in the search result table. Each context listed in the table contains the context name, active version, and instance name information.

Click the Update icon in the table to modify an existing context. See: Updating an Existing Context.

Creating and Updating Contexts

This section includes the following topics:

Creating a New Context

To create a new context, click Create Context in the Context Search page. The Create Context page appears.

Create Context Page

the picture is described in the document text

Enter the following fields to create a new context:

Click Apply to save the entry and return to the Search Context page.

The newly-created context is added to the contexts list with a version number assigned. The version number is incremented after each modification, provided the specific context-version combination has been used for invocations. A system administrator can activate a desired version of the context if necessary. For more information about activating a version, see Updating an Existing Context.

Updating an Existing Context

To improve or optimize response messages or generated text for a specific business function, a system administrator can update or fine-tune the configuration by modifying the prompt, API, or instance configuration for a given context.

To update a context, click the Update icon in the context table. The Update Context page appears. The administrator can make appropriate changes for this selected context.

Update Context Page

the picture is described in the document text

Click Apply to save changes.

Once the update is complete successfully, if invocations already exist for the context, then its version number will be incremented by 1 and shown in the context table. The new version replaces the previous version to become the active version; the previous version becomes inactive. If there is no existing invocation for the context, the version number remains unchanged.

Monitoring and Managing LLM Service Invocation Through LLM Service Monitor

The LLM Service Monitor provides monitoring and auditing features for tracking all LLM service invocations. Information about each invocation—including its context, request and response messages, status, and user feedback—is captured in the LLM Service Monitor.

Accessing LLM Service Monitor for LLM Services

To access the LLM Service Monitor page for LLM services, select Service Monitor from the navigation menu after logging in to Oracle E-Business Suite as a user who has the LLM Service Administrator responsibility. This displays the LLM Monitor Search page where all LLM service invocations can be monitored.

LLM Monitor Search Page

the picture is described in the document text

A system administrator can perform the following activities through this page:

Searching Requests

To locate a desired request, perform a search by entering search criteria in the Search region of the LLM Monitor Search page. These criteria include context, request sent time, entity key, user feedback, and request status.

Click Go. All entries that match the search criteria will be retrieved and listed in a table.

From the search result table, the system administrator can click a desired Message ID link to view the request and response message details for the selected LLM service. See: Viewing Request and Response Details.

Viewing Request and Response Details

To view a desired LLM service invocation, click the Message ID link from the search result table. The Message page appears for the selected context.

Message Page

the picture is described in the document text

This page displays the invocation details, along with the Request region and Response region. If the request failed, then an additional Fault Details region will be displayed.

The invocation information includes the LLM Type, Context Name, Context Version, Active Context (Yes or No), Service Endpoint, Status, Entity Key, HTTP Response Status, Feedback, and Execution Time.

Fault Details Region (Conditional)

This region appears only if the request has a "Failure" status.

Fault Type: Depending on the nature of the fault, the value could be one of the following types:

Message: The fault code or the first 150 characters of the error message are shown.

Request Region

This region contains the LLM service invocation request information, including the request sent date and time, HTTP headers, request message, and payload type (JSON).

Response Region

This region contains the LLM service invocation response information, including the response received date and time and the response message.

Click the Response Message View link if it is available to view the content in the HTTP body received as the response message.

For example, based on the request message described earlier in the Request region, the LLM service invocation returns the generated text about Oracle and its relational database as the response message.

Purging LLM Service Invocation Monitor Data

LLM Service Monitor provides the purge feature, allowing a system administrator to purge LLM service invocation messages that have been collected and stored in the Oracle E-Business Suite database for a period of time.

To purge desired invocation data, click Purge in the LLM Monitor Search page to launch the LLM Monitor Purge page.

LLM Monitor Purge Page

the picture is described in the document text

Enter the following purge parameters in the LLM Monitor Purge Data region:

Click Submit. Once the purge request has been submitted successfully, a request number will be automatically generated. LLM Service Monitor will purge all monitored LLM invocation data that match the purge criteria within a specified date range.

LLM REST Service APIs

Overview

This section describes the LLM REST Service APIs that are defined in the LLMInvocationUtils.java class. Information about the Data API is also included in this section.

LLMInvocationUtils.java

Description: The LLMInvocationUtils class is an LLM utility class. It invokes LLM REST services and also updates the context feedback. This utility class is located in the oracle.apps.fnd.wf.bes Java package.

Important: Java is case-sensitive, and all Java method names begin with a lowercase letter to follow Java naming conventions.

The following list shows the APIs in this LLMInvocationUtils class:

invokeLLMService

Syntax

public Map<String, String> invokeLLMService(String entityKey,

                                  String contextName,

                                  String clientPrompt,

                                  Map<String, String> contextAttrs) throws LLMInvocationException

Description

This API invokes an LLM REST service using the given parameters and returns the response. Specifically, it performs the following tasks:

Arguments (input)

Parameter Description
entity key Primary key of the entity
contextName Name of the context
clientPrompt Prompt which can be sent from client
contextAttrs The context attribute name-value pairs

updateLLMContextFeedback

Syntax

public boolean updateLLMContextFeedback(int messageId,

                            String feedback) throws Exception

Description

This API updates the LLM Context Feedback for the given message Id. The valid feedback values are Accept, Reject, and Regenerate. It returns false if the feedback value is invalid and returns true if the feedback is updated successfully. It throws an exception for any other errors.

Arguments (input)

Parameter Description
messageId Invocation message Id
feedback Feedback value

Data API

PL/SQL Syntax

function <api_name>(p_entity_key varchar2,

                    p_client_prompt in varchar2,
 
                    p_param_list in WF_PARAMETER_LIST_T) return VARCHAR2;

Description

This data API generates an additional prompt using the entity key, client prompt, and context attributes parameters.

<api_name> represents the name of the data API.

Arguments (input)

Parameter Description
p_entity_key Primary key of the entity
p_client_prompt Prompt which can be sent from a client
p_param_list A list of context attribute name and value pairs