Skip to content

Installation

  • Oracle Database 12.2 or later
  • Oracle APEX (old versions also work, because UC AI uses only some of the APEX APIs)
  • Outbound HTTPS access to your AI provider. On on-premises and self-managed databases, you must first configure network ACLs and a TLS wallet. See Network Setup (ACL & Wallet).

UC AI writes debug information to a log. If you do not have Logger installed, UC AI logs through the apex_debug package.

The GitHub release page of each UC AI version contains scripts. These scripts install the UC AI packages and their dependencies.

  • install_uc_ai_complete.sql installs all UC AI objects
  • install_uc_ai_complete_with_logger.sql installs all UC AI objects and the Logger package
  • upgrade_packages.sql upgrades the UC AI packages. Most releases change only the packages. For these releases, run this script to get the new version. Read the release notes also. A release can contain changes that need the complete installation script.

Run the script that you need in your SQL client. It installs the UC AI packages and their dependencies.

Download the source code of the latest release from the GitHub releases page, or clone the GitHub repository.

Make sure that you are on the main branch, not the development branch. Then run this script in any SQL client:

Terminal window
# inside the uc_ai directory
sql ./install_uc_ai.sql

The install_with_logger.sql script installs UC AI together with the Logger package.

Terminal window
# inside the uc_ai directory
sql ./install_with_logger.sql

If you do not want Logger, install its “no op” (no operation) version instead. This version creates the objects that the UC AI packages need to compile. It writes no log entries.

Terminal window
# inside the uc_ai directory
cd ./src/dependencies/logger_3.1.1
sql ./logger_install_no_op.sql

You can manage your API keys for the AI providers in two ways: a key function, or APEX Web Credentials.

The installation script created the following function. Modify it to return your API keys for the AI providers you want to use.

create or replace function uc_ai_get_key (
p_provider in uc_ai.provider_type
)
return varchar2
as
e_unhandled_provider exception;
begin
-- retrieve and return your keys from a secure location the way you prefer
case p_provider
when uc_ai.c_provider_openai then
return 'change_me';
when uc_ai.c_provider_anthropic then
return '...';
when uc_ai.c_provider_google then
return '...';
else
raise e_unhandled_provider;
end case;
exception
when e_unhandled_provider then
raise_application_error(-20001, 'No key defined for provider: ' || p_provider);
when others then
raise;
end uc_ai_get_key;
/

You can also store your secret API keys as APEX Web Credentials. This needs an APEX workspace for the schema that holds UC AI. Log in to that workspace. Then go to Workspace Utilities → Web Credentials (guide with screenshots). These guides show how to create the web credential of each provider:

Before you call a UC AI function, set the package variable of your provider to the static ID of the web credential. For example, an OpenAI web credential with the static ID OPENAI needs this code:

uc_ai_openai.g_apex_web_credential := 'OPENAI';
DECLARE
l_result JSON_OBJECT_T;
BEGIN
-- If you are using APEX Web Credentials set it here
-- uc_ai_openai.g_apex_web_credential := 'OPENAI';
l_result := uc_ai.generate_text(
p_user_prompt => 'What is APEX Office Print?',
p_provider => uc_ai.c_provider_openai, -- change to your preferred provider
p_model => uc_ai_openai.c_model_gpt_5_6_luna -- change to your preferred model
);
-- Get the AI's response
DBMS_OUTPUT.PUT_LINE('AI Response: ' || l_result.get_string('final_message'));
END;
/

For most versions, run only the upgrade_packages.sql script. It upgrades the packages that changed since the last version.

Read the release notes also. A release can contain changes that need the complete installation script.

UC AI is now installed. Read these pages next: