The new Oracle GoldenGate 26ai AI Service feature enables the integration of external AI providers directly into the data replication process.
In this post we will see how we configure the GoldenGate AI Service using OCI Generative AI as the provider.
The Replicat process COLMAP parameter has a new function @AISERVICE which allows users to allow vector embedding using models from various AI Service providers, including Google Gemini, OpenAI, Voyager AI, and OCI Generative AI.
In this example, the GoldenGate Replicat process is generating vector embeddings for the DESC_VECTOR column in the table (data type is VECTOR) from the DESCRIPTION column in the table – using the cohere.embed-english-v3.0 model.
DESC_VECTOR= @AISERVICE(embed,’cohere.embed-english-v3.0′, description)
Generate and add the Certificate
Please read Alex Lima’s great post on using OpenAI and GoldenGate – he has demonstrated how to generate an OpenAI Certificate chain – I have used the same procedure to generate the Certificate chain for OCI Generative AI provider.
Step-by-Step: Using OpenAI Embeddings with Oracle GoldenGate 26ai – Alex Lima
openssl s_client -showcerts -connect inference.generativeai.us-chicago-1.oci.oraclecloud.com:443</dev/null 2>/dev/null \
| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/ {print}' > /tmp/genai_chain.pem
csplit -f cert_ -b "%03d.pem" genai_chain.pem '/-----BEGIN CERTIFICATE-----/' '{*}' >/dev/null

Add a GoldenGate AI Service Provider
Note the external AI providers supported at the moment. For this example, we will use OCI Generative AI.
We need to provide the following details:
- Tenancy OCID
- OCI User OCID
- Compartment OCID
- API Key Fingerprint and Private Key
- Base URL (https://inference.generativeai.us-chicago-1.oci.oraclecloud.com)


Add a GoldenGate AI Service Model
We then add the AI Model associated with the provider. In this case, we need to provide one of the pretrained supported models by OCI Generative AI
The cohere.embed-english-v3.0 model generates text embeddings from English language documents. The model creates a 1,024-dimensional vector for each embedding.


Create the source and target table
The PARKS table in the target database has the additional column with a data type VECTOR.
We will generate and populate vector embedding values for the DESC_VECTOR column. This will be performed by the GoldenGate Replicat @AISERVICE function.
Source Database
SQL> desc PARKS
Name Null? Type
----------------------------------------- -------- -------------------
PARK_ID NOT NULL NUMBER
DESCRIPTION CLOB
Target Database
SQL> desc PARKS_AI
Name Null? Type
----------------------------------------- -------- -------------------
PARK_ID NOT NULL NUMBER
DESCRIPTION CLOB
DESC_VECTOR VECTOR(*, *, DENSE)
Start the GoldenGate Extract and Replicat process


Note the COLMAP clause and the @AISERVICE function.

Insert data in the source database
SQL> insert into parks
values
(1002,
'Kings Park is both one of the worlds largest and most beautiful inner city parks and also a rich cultural heritage site. It is home to the spectacular Western Australian Botanic Garden, which displays over 3,000 species of the States unique flora - a sight unlike anywhere else in the world. With cafes, bushland walk trails, immaculate gardens and a variety of childrens play areas, leave plenty of time on your visit to discover the many sides of Kings Park.');
SQL> commit;
Commit complete.
Verify Extract and Replicat processes have captured and applied the INSERT transaction


The DESC_VECTOR column has the vector embedding values generated via the @aiservice function called by the Replicat process
