Installation
Prerequisites
Section titled “Prerequisites”- Oracle Database 12.2 or later
- Oracle APEX (older versions are fine, this project uses some of the APIs)
Logger
Section titled “Logger”The project uses the Logger package to log trace information like the requests and responses from the AI providers.
I do recommend installing the Logger package aswell as it helps debugging issues and keeping track of how the AI gets used.
However you have the option to install a “no op” (no operation) version of the Logger package which installs the necessary objects so that the packages compile but does not log anything.
If you want to use your own logging solution you can modify the no op version to insert the log messages into your own logging tables.
Installing UC AI
Section titled “Installing UC AI”Option 1: GitHub release scripts
Section titled “Option 1: GitHub release scripts”For each new release of UC AI the release page in GitHub will contain scripts to install the UC AI package and its dependencies.
install_uc_ai_complete.sql
installs all UC AI objectsinstall_uc_ai_complete_with_logger.sql
installs all UC AI objects and the Logger packagelogger_no_op.sql
installs Logger in “no op” mode, meaning it will not log anything but the objects will compile. You can runinstall_uc_ai_complete.sql
afterwards.upgrade_packages.sql
upgrades the UC AI packages.Most of the time only packages get modified. So for most releases you just need to run this script to upgrade to a newer version. Please still keep an eye ont the release notes to see if there are any changes that require you to run the complete installation script.
Just run the necessary script in your SQL client to install the UC AI package and its dependencies.
Option 2: Install GitHub repository
Section titled “Option 2: Install GitHub repository”Either download the source code of the latest release from the GitHub releases page or clone the GitHub repository:
Run this script to install the UC AI with any SQL client:
# inside the uc_ai directorysql ./install_uc_ai.sql
There is also a install_with_logger.sql
script that installs the UC AI with the Logger package.
# inside the uc_ai directorysql ./install_with_logger.sql
Alternatively if you don’t want the logger installed you can install it’s “no op” (no operation) version which installs the necessary objects so that the packages compile but does not log anything.
# inside the uc_ai directorycd ./src/dependencies/logger_3.1.1sql ./logger_install_no_op.sql
Set up API Keys
Section titled “Set up API Keys”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 varchar2as 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;/
Test if it is working
Section titled “Test if it is working”DECLARE l_result JSON_OBJECT_T;BEGIN 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_4o_mini -- change to your preferred model );
-- Get the AI's response DBMS_OUTPUT.PUT_LINE('AI Response: ' || l_result.get_string('final_message'));END;/
Upgrades
Section titled “Upgrades”Most of the time you just need to run the upgrade_packages.sql
script to upgrade to a newer version of UC AI. This script will only upgrade the packages that have changed since the last version.
Please still keep an eye on the release notes to see if there are any changes that require you to run the complete installation script.