Introduction
I have previously shared how to install the Oracle Private AI Services Container, configure the Oracle Linux certificate store, and set-up Oracle AI Database 26ai ACLs.
In this post I show how the we can call securely generate Vector Embeddings from within the Oracle AI Database 26ai using the DBMS_VECTOR package and the Oracle Private AI Services Container.
What is the DBMS_VECTOR package?
The Oracle AI Database 26ai DBMS_VECTOR package provides APIs to support common operations with Oracle AI Vector Search, such as extracting chunks or embeddings from user data, generating text for a given prompt, creating a vector index, or reporting on index accuracy.
Using the DBMS_VECTOR.UTL_TO_EMEDDING database package we can securely, off-load the generation of Vector embeddings.
Create Credential
We will start by using DBMS_VECTOR.CREATE_CREDENTIAL procedure to create a credential name for storing user authentication details in Oracle AI Database 26ai for the Private AI Services Container.
The CREDENTIAL_NAME stores authentication parameters, for example user name, password, access token, private key, or fingerprint.
The DBMS_VECTOR.CREATE_CREDENTIAL supports authentication with Cohere, Google AI, Hugging Face, Oracle Cloud Infrastructure (OCI) Generative AI, OpenAI, Vertex AI and the Private AI Services Container.
Consult the Oracle AI Database 26ai DBMS_VECTOR.CREATE_CREDENTIAL documentation for other services.
Setup Private AI Credentials
Provide a CREDENTIAL_NAME for the credential and provide the authentication parameters.
The DBMS_VECTOR package expects the PARMS authentication parameters to be passed as in a JSON format.
DBMS_VECTOR.CREATE_CREDENTIAL ( CREDENTIAL_NAME IN VARCHAR2, PARAMS IN JSON DEFAULT NULL);
Run the below into your PDB to create a credential called PRIVATEAI_CRED providing the access_token for the Private AI Services Container.
SET SERVEROUTPUT ONBEGIN DBMS_VECTOR.DROP_CREDENTIAL('PRIVATEAI_CRED');EXCEPTION WHEN OTHERS THEN NULL;END;/DECLARE jo json_object_t;BEGIN jo := json_object_t(); jo.put('access_token', '216c5e9c6242881ded41479688a9bbbe3bb22d771a356d28659e3d726fa1a285'); DBMS_VECTOR.CREATE_CREDENTIAL( credential_name => 'PRIVATEAI_CRED', params => json(jo.to_string));END;/EXIT;
Using Private AI Services Container
Now we have configured our Private AI credential we can use the DBMS_VECTOR.UTL_TO_EMEDDING database package to securely, off-load the generation of Vector embeddings to the Private AI Service Containers
SET SERVEROUTPUT ONDECLAREinput clob;v vector;BEGIN input := '"A lovestruck Romeo sang the streets a serenade","Laying everybody low with a love song that he made"'; v := DBMS_VECTOR.UTL_TO_EMBEDDING( input, json('{"provider": "privateai", "url": "https://z-re-ora1.uklab.purestorage.com:8443/v1/embeddings", "credential_name": "PRIVATEAI_CRED", "model": "all-MiniLM-L12-v2" }')); DBMS_OUTPUT.PUT_LINE(vector_serialize(v));EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE (SQLERRM); DBMS_OUTPUT.PUT_LINE (SQLCODE);END;/EXIT
For example:
$ sqlplus vector_user/vector_user@//localhost/pdb1 @create_embedding_int.sql
SQL*Plus: Release 23.26.1.0.0 - Production on Thu Jul 2 15:15:24 2026
Version 23.26.1.0.0
Copyright (c) 1982, 2025, Oracle. All rights reserved.
Last Successful login time: Thu Jul 02 2026 14:47:57 +01:00
Connected to:
Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
Create Emedding for "A lovestruck Romeo sang the streets a serenade","Laying
everybody low with a love song that he made"
[-5.54231973E-003,-5.9070304E-002,6.86978251E-002,-3.98377664E-002,-2.63463054E-
002,1.83013119E-002,1.76179688E-002,-2.66317222E-002,4.15453613E-002,-5.42198084
E-002,1.01383895E-001,6.68680295E-002,4.77581471E-002,-5.64401112E-002,1.6309784
...
6.91017285E-002,-3.44265401E-002,-3.48203294E-002,-5.01019508E-002,5.7257507E-00
2,-6.11953139E-002,1.03319682E-001,1.06296785E-001,-9.2176035E-002,-4.78688255E-
003,-3.6479082E-002,5.41784242E-002,2.79878061E-002,3.55628348E-004]
PL/SQL procedure successfully completed.
Disconnected from Oracle AI Database 26ai Enterprise Edition Release 23.26.1.0.0 - Production
Version 23.26.1.0.0
Summary
In this post I have shared how an Oracle AI Database 26ai can securely generate Vector embeddings without any dependancy on the public cloud or internet through the use of the Private AI Services Container.

Leave a Reply