Leveraging ONNX Models for AI Vector Search in Oracle Cloud Database 23ai
Step 1: Upload ONNX Model to Oracle Cloud Storage
Step 2: Import the ONNX Model into Oracle Database
Use the DBMS_VECTOR
package to I mport the ONNX model:
you need to create a credential and for this you need your username and password in oracle cloud
This is username BUT WHERE IS PASSWORD ??!!๐
For password in User setting > Tokens and Keys > Auth Token > Click Generate Token
This is your password !!! ๐
BEGIN
DBMS_CLOUD.DROP_CREDENTIAL(
credential_name => 'OBJ_STORE_CRED');
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'OBJ_STORE_CRED',
username => 'gholizadeh.lida@gmail.com',
password => '******************'
);
END;
/
BEGIN
DBMS_VECTOR.DROP_ONNX_MODEL( model_name => 'my_model');
END;
/
BEGIN
DBMS_VECTOR.LOAD_ONNX_MODEL_CLOUD(
model_name => 'my_model',
CREDENTIAL => 'OBJ_STORE_CRED',
uri => 'https://[The path of your file in cloud]/my_modelall_MiniLM_L12_v2.onnx'
);
END;
/
SELECT model_name, algorithm, mining_function
FROM user_mining_models
WHERE model_name = 'MY_MODEL';
Now I am going to use this model and generate Vectors for this purpose we have an amazing Function in Oracle 23ai called VECTOR_EMBEDDING
VECTOR_EMBEDDING(<model_name> USING <input_value> AS <input_label>)
SELECT vector_embedding(MY_MODEL USING 'Hello World' AS data) vectors FROM DUAL;
Comments
Post a Comment