diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/addapikey.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/addapikey.png
deleted file mode 100644
index 70eb1cb..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/addapikey.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png
deleted file mode 100644
index e2802c6..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/copypreauth.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/copypreauth.png
deleted file mode 100644
index 0d3686f..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/copypreauth.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createpolicy.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createpolicy.png
deleted file mode 100644
index 6416627..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createpolicy.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/livelabsshkey.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/livelabsshkey.png
deleted file mode 100644
index 2c1d9b6..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/livelabsshkey.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ocid.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ocid.png
deleted file mode 100644
index cf923c4..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ocid.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/saveconfig.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/saveconfig.png
deleted file mode 100644
index 637f236..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/saveconfig.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/livelabsshkey.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/livelabsshkey.png
deleted file mode 100644
index 2c1d9b6..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/livelabsshkey.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/ocid.png b/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/ocid.png
deleted file mode 100644
index cf923c4..0000000
Binary files a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/tables/images/ocid.png and /dev/null differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/apex-app.md b/ai-vector-search-apex-adb/apex-app/apex-app.md
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/apex-app.md
rename to ai-vector-search-apex-adb/apex-app/apex-app.md
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/applicationdefinition.png b/ai-vector-search-apex-adb/apex-app/images/applicationdefinition.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/applicationdefinition.png
rename to ai-vector-search-apex-adb/apex-app/images/applicationdefinition.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editbucketpar.png b/ai-vector-search-apex-adb/apex-app/images/editbucketpar.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editbucketpar.png
rename to ai-vector-search-apex-adb/apex-app/images/editbucketpar.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editingremoteserver.png b/ai-vector-search-apex-adb/apex-app/images/editingremoteserver.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editingremoteserver.png
rename to ai-vector-search-apex-adb/apex-app/images/editingremoteserver.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editociaccess.png b/ai-vector-search-apex-adb/apex-app/images/editociaccess.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editociaccess.png
rename to ai-vector-search-apex-adb/apex-app/images/editociaccess.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editociaccessconfig.png b/ai-vector-search-apex-adb/apex-app/images/editociaccessconfig.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editociaccessconfig.png
rename to ai-vector-search-apex-adb/apex-app/images/editociaccessconfig.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editremoteserver.png b/ai-vector-search-apex-adb/apex-app/images/editremoteserver.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editremoteserver.png
rename to ai-vector-search-apex-adb/apex-app/images/editremoteserver.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editrestdatasources.png b/ai-vector-search-apex-adb/apex-app/images/editrestdatasources.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editrestdatasources.png
rename to ai-vector-search-apex-adb/apex-app/images/editrestdatasources.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editwebcredentials.png b/ai-vector-search-apex-adb/apex-app/images/editwebcredentials.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editwebcredentials.png
rename to ai-vector-search-apex-adb/apex-app/images/editwebcredentials.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editworkspaceutil.png b/ai-vector-search-apex-adb/apex-app/images/editworkspaceutil.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/editworkspaceutil.png
rename to ai-vector-search-apex-adb/apex-app/images/editworkspaceutil.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/listbucketsparameters.png b/ai-vector-search-apex-adb/apex-app/images/listbucketsparameters.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/listbucketsparameters.png
rename to ai-vector-search-apex-adb/apex-app/images/listbucketsparameters.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/listobjectsinbucketparameters.png b/ai-vector-search-apex-adb/apex-app/images/listobjectsinbucketparameters.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/listobjectsinbucketparameters.png
rename to ai-vector-search-apex-adb/apex-app/images/listobjectsinbucketparameters.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/open-terminal.png b/ai-vector-search-apex-adb/apex-app/images/open-terminal.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/open-terminal.png
rename to ai-vector-search-apex-adb/apex-app/images/open-terminal.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/restdatasources.png b/ai-vector-search-apex-adb/apex-app/images/restdatasources.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/restdatasources.png
rename to ai-vector-search-apex-adb/apex-app/images/restdatasources.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/sharedcomponents.png b/ai-vector-search-apex-adb/apex-app/images/sharedcomponents.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/sharedcomponents.png
rename to ai-vector-search-apex-adb/apex-app/images/sharedcomponents.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/substitution.png b/ai-vector-search-apex-adb/apex-app/images/substitution.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/substitution.png
rename to ai-vector-search-apex-adb/apex-app/images/substitution.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/urlpathprefix.png b/ai-vector-search-apex-adb/apex-app/images/urlpathprefix.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex-app/images/urlpathprefix.png
rename to ai-vector-search-apex-adb/apex-app/images/urlpathprefix.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/apex.md b/ai-vector-search-apex-adb/apex/apex.md
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/apex.md
rename to ai-vector-search-apex-adb/apex/apex.md
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/databaseactions.png b/ai-vector-search-apex-adb/apex/images/databaseactions.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/databaseactions.png
rename to ai-vector-search-apex-adb/apex/images/databaseactions.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbaccessapexinstance.png b/ai-vector-search-apex-adb/apex/images/dbaccessapexinstance.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbaccessapexinstance.png
rename to ai-vector-search-apex-adb/apex/images/dbaccessapexinstance.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionlaunchapex.png b/ai-vector-search-apex-adb/apex/images/dbactionlaunchapex.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionlaunchapex.png
rename to ai-vector-search-apex-adb/apex/images/dbactionlaunchapex.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsapex.png b/ai-vector-search-apex-adb/apex/images/dbactionsapex.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsapex.png
rename to ai-vector-search-apex-adb/apex/images/dbactionsapex.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsappbuilder.png b/ai-vector-search-apex-adb/apex/images/dbactionsappbuilder.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsappbuilder.png
rename to ai-vector-search-apex-adb/apex/images/dbactionsappbuilder.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionscreateworkspace.png b/ai-vector-search-apex-adb/apex/images/dbactionscreateworkspace.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionscreateworkspace.png
rename to ai-vector-search-apex-adb/apex/images/dbactionscreateworkspace.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionscredentials.png b/ai-vector-search-apex-adb/apex/images/dbactionscredentials.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionscredentials.png
rename to ai-vector-search-apex-adb/apex/images/dbactionscredentials.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsexistingschema.png b/ai-vector-search-apex-adb/apex/images/dbactionsexistingschema.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsexistingschema.png
rename to ai-vector-search-apex-adb/apex/images/dbactionsexistingschema.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsimport.png b/ai-vector-search-apex-adb/apex/images/dbactionsimport.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsimport.png
rename to ai-vector-search-apex-adb/apex/images/dbactionsimport.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsnewschema.png b/ai-vector-search-apex-adb/apex/images/dbactionsnewschema.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionsnewschema.png
rename to ai-vector-search-apex-adb/apex/images/dbactionsnewschema.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionspassword.png b/ai-vector-search-apex-adb/apex/images/dbactionspassword.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/dbactionspassword.png
rename to ai-vector-search-apex-adb/apex/images/dbactionspassword.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/f100.sql b/ai-vector-search-apex-adb/apex/images/f100.sql
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/apex/images/f100.sql
rename to ai-vector-search-apex-adb/apex/images/f100.sql
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/ask.md b/ai-vector-search-apex-adb/ask/ask.md
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/ask.md
rename to ai-vector-search-apex-adb/ask/ask.md
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/admin.png b/ai-vector-search-apex-adb/ask/images/admin.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/admin.png
rename to ai-vector-search-apex-adb/ask/images/admin.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/object.png b/ai-vector-search-apex-adb/ask/images/object.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/object.png
rename to ai-vector-search-apex-adb/ask/images/object.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/pagedesign.png b/ai-vector-search-apex-adb/ask/images/pagedesign.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/pagedesign.png
rename to ai-vector-search-apex-adb/ask/images/pagedesign.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/plsql.png b/ai-vector-search-apex-adb/ask/images/plsql.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/plsql.png
rename to ai-vector-search-apex-adb/ask/images/plsql.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/run.png b/ai-vector-search-apex-adb/ask/images/run.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/run.png
rename to ai-vector-search-apex-adb/ask/images/run.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/signin.png b/ai-vector-search-apex-adb/ask/images/signin.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/signin.png
rename to ai-vector-search-apex-adb/ask/images/signin.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/vector.png b/ai-vector-search-apex-adb/ask/images/vector.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/ask/images/vector.png
rename to ai-vector-search-apex-adb/ask/images/vector.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/download.md b/ai-vector-search-apex-adb/download/download.md
similarity index 75%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/download.md
rename to ai-vector-search-apex-adb/download/download.md
index f6416ec..399b387 100644
--- a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/download.md
+++ b/ai-vector-search-apex-adb/download/download.md
@@ -26,13 +26,12 @@ Before we dive into the procedure, make sure you have the following:
## Task 1: Create Credential Object in Oracle ADB
-First, create a credential object in your Oracle Autonomous Database that will store your Object Storage credentials. This is required for authenticating with Oracle Object Storage. Please set up your [secret keys](https://medium.com/@bhenndricks/secure-access-to-oracle-buckets-in-object-storage-a-step-by-step-guide-32f3242f35e2)
-
+1. First, create a credential object in your Oracle Autonomous Database that will store your Object Storage credentials. This is required for authenticating with Oracle Object Storage.
Next head back to your ADB console, and select Database Actions and then SQL. Log in as ADMIN. This will open up an editor for us to perform statements.
![alt text](images/sqldev.png)
-Copy this statement and replace with your user and password for Oracle Cloud.
+Copy this statement and replace with your username and password for Oracle Cloud.
```sql
@@ -40,7 +39,7 @@ BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'OBJ_STORE_CRED',
username => '',
- password => ''
+ password => ''
);
END;
/
@@ -64,17 +63,14 @@ GRANT CREATE ANY DIRECTORY TO VECTOR;
```
-## Task 3: Create the credentials for ADB to access the LLM service
-
-To enable ADB to access an LLM service, API authentication is required.
+## Task 3: Option 1 - Create the credential for ADB to access OCI GenAI Service
-1. From ADB Database Actions SQL Worksheet, as ADMIN user enter and run the SQL below and replace the following with your ocid and key information you got from the previous lab.
+### OCI GenAI Service
+The OCI GenAI service provides access to several LLMs including Cohere and Llama.
+API authentication is required.
-Oracle's GenAI service is an LLM service from Oracle Cloud Infrastructure (OCI). The GenAI service provides access to several LLMs that you can pick from.
+1. From ADB Database Actions SQL Worksheet, as ADMIN user enter and run the SQL below and replace the following with your ocid and key information you got from the previous lab. Important Note: Open your private key and copy the private key all onto a single line.
-## OCI GenAI Service
-
-For OCI GenAI Service, run the following procedure. Important Note: Put the private key all on a single line.
```sql
declare
@@ -93,8 +89,27 @@ end;
/
```
+For example:
+```
+declare
+ jo json_object_t;
+begin
+ jo := json_object_t();
+ jo.put('user_ocid','ocid1.user.oc1..aaaaaaaawfpzqgzsrvb4mh6hcld2hrckadyae5y...cvza');
+ jo.put('tenancy_ocid','ocid1.tenancy.oc1..aaaaaaaafj37mytx22oquorcznlfuh77...zrq');
+ jo.put('compartment_ocid','ocid1.compartment.oc1..aaaaaaaaqdp7dblf6tb3gpzbuknvgfgkedtio...yfa');
+ jo.put('private_key','MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCP1QXxJxzVj4SXozdfrfIr...A4Iw=');
+ jo.put('fingerprint','e3:e5:ab:61:99:51:29:1f:60:2a:ad...5b:a5');
+ dbms_vector.create_credential(
+ credential_name => 'GENAI_CRED',
+ params => json(jo.to_string));
+end;
+/
+```
+
+## Task 3: Option 2 - Create the credential for ADB to access OpenAI
-## OpenAI
+### OpenAI
For OpenAI, run the following procedure:
```sql
@@ -115,7 +130,7 @@ end;
## Task 4: Download ONNX embedding models Using DBMS\_CLOUD.GET\_OBJECTS
-Now log in as ``, use the DBMS\_CLOUD.GET\_OBJECTS procedure to download the ONNX embedding model files from your Oracle Object Storage bucket into Oracle ADB. You will download two different models.
+Now log in as VECTOR or ``, use the DBMS\_CLOUD.GET\_OBJECTS procedure to download the ONNX embedding model files from the Oracle Object Storage bucket into Oracle ADB. You will download two different models.
Run to create the staging directory.
@@ -125,12 +140,14 @@ CREATE DIRECTORY staging AS 'stage';
```
+Run to get the onnx models.
+
```sql
BEGIN
DBMS_CLOUD.GET_OBJECT(
credential_name => 'OBJ_STORE_CRED',
- object_uri => 'https://objectstorage..oraclecloud.com/n//b//o/',
+ object_uri => '',
directory_name => 'staging',
file_name => ''
);
@@ -139,14 +156,22 @@ END;
```
-For example, if your object URI is 'https://oraclepartnersas.objectstorage.us-ashburn-1.oci.customer-oci.com/p/HP5q2dfCzDstMprLYpR5x0LbhJb_SyxGNgHj985fd8GELKb9j2aLcEwUUpKmV7zW/n/oraclepartnersas/b/onnx/o/tinybert.onnx', and you want to download it to ADB, the command will look like this:
+URL to all-MiniLM-L6-v2.onnx is:
+https://oraclepartnersas.objectstorage.us-ashburn-1.oci.customer-oci.com/p/CjS1gGPZaCZE2PoRWS5c6xmGNXK0v6ny6tNwoiVIOvqQrHux9NJ5oYo0dgLc6gOG/n/oraclepartnersas/b/onnx/o/all-MiniLM-L6-v2.onnx
+
+
+URL to tinybert.onnx is:
+https://oraclepartnersas.objectstorage.us-ashburn-1.oci.customer-oci.com/p/m5o31C0ol_8B_OzCLOLvqc2rWYNqz0M7kZZpMZHEaOyX7GQkhEw8_UNKoKBtcQYC/n/oraclepartnersas/b/onnx/o/tinybert.onnx
+
+
+For example, to get tinybert.onnx and download it to ADB, the command will look like this:
```sql
BEGIN
DBMS_CLOUD.GET_OBJECT(
credential_name => 'OBJ_STORE_CRED',
- object_uri => 'https://oraclepartnersas.objectstorage.us-ashburn-1.oci.customer-oci.com/p/HP5q2dfCzDstMprLYpR5x0LbhJb_SyxGNgHj985fd8GELKb9j2aLcEwUUpKmV7zW/n/oraclepartnersas/b/onnx/o/tinybert.onnx',
+ object_uri => 'https://oraclepartnersas.objectstorage.us-ashburn-1.oci.customer-oci.com/p/m5o31C0ol_8B_OzCLOLvqc2rWYNqz0M7kZZpMZHEaOyX7GQkhEw8_UNKoKBtcQYC/n/oraclepartnersas/b/onnx/o/tinybert.onnx',
directory_name => 'staging',
file_name => 'tinybert.onnx'
);
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/images/open-terminal.png b/ai-vector-search-apex-adb/download/images/open-terminal.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/images/open-terminal.png
rename to ai-vector-search-apex-adb/download/images/open-terminal.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/images/sqldev.png b/ai-vector-search-apex-adb/download/images/sqldev.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/download/images/sqldev.png
rename to ai-vector-search-apex-adb/download/images/sqldev.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/introduction/images/ai-vector-search-apex-adb.png b/ai-vector-search-apex-adb/introduction/images/ai-vector-search-apex-adb.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/introduction/images/ai-vector-search-apex-adb.png
rename to ai-vector-search-apex-adb/introduction/images/ai-vector-search-apex-adb.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/introduction/introduction.md b/ai-vector-search-apex-adb/introduction/introduction.md
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/introduction/introduction.md
rename to ai-vector-search-apex-adb/introduction/introduction.md
diff --git a/ai-vector-search-apex-adb/setup/images/addapikey.png b/ai-vector-search-apex-adb/setup/images/addapikey.png
new file mode 100644
index 0000000..4ddde5c
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/addapikey.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/aidemofolder.png b/ai-vector-search-apex-adb/setup/images/aidemofolder.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/aidemofolder.png
rename to ai-vector-search-apex-adb/setup/images/aidemofolder.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeyadd.png b/ai-vector-search-apex-adb/setup/images/apikeyadd.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeyadd.png
rename to ai-vector-search-apex-adb/setup/images/apikeyadd.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeydownload.png b/ai-vector-search-apex-adb/setup/images/apikeydownload.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/apikeydownload.png
rename to ai-vector-search-apex-adb/setup/images/apikeydownload.png
diff --git a/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png b/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png
new file mode 100644
index 0000000..f86343c
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/apikeysaveinfo.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/browser.png b/ai-vector-search-apex-adb/setup/images/browser.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/browser.png
rename to ai-vector-search-apex-adb/setup/images/browser.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/cellwithcode.png b/ai-vector-search-apex-adb/setup/images/cellwithcode.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/cellwithcode.png
rename to ai-vector-search-apex-adb/setup/images/cellwithcode.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/clickrun.png b/ai-vector-search-apex-adb/setup/images/clickrun.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/clickrun.png
rename to ai-vector-search-apex-adb/setup/images/clickrun.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/compartmentsave.png b/ai-vector-search-apex-adb/setup/images/compartmentsave.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/compartmentsave.png
rename to ai-vector-search-apex-adb/setup/images/compartmentsave.png
diff --git a/ai-vector-search-apex-adb/setup/images/copypreauth.png b/ai-vector-search-apex-adb/setup/images/copypreauth.png
new file mode 100644
index 0000000..1f59a6c
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/copypreauth.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/copytenancyid.png b/ai-vector-search-apex-adb/setup/images/copytenancyid.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/copytenancyid.png
rename to ai-vector-search-apex-adb/setup/images/copytenancyid.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createbucket.png b/ai-vector-search-apex-adb/setup/images/createbucket.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createbucket.png
rename to ai-vector-search-apex-adb/setup/images/createbucket.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createbucketconfig.png b/ai-vector-search-apex-adb/setup/images/createbucketconfig.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createbucketconfig.png
rename to ai-vector-search-apex-adb/setup/images/createbucketconfig.png
diff --git a/ai-vector-search-apex-adb/setup/images/createpolicy.png b/ai-vector-search-apex-adb/setup/images/createpolicy.png
new file mode 100644
index 0000000..8fcc909
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/createpolicy.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createpreauth.png b/ai-vector-search-apex-adb/setup/images/createpreauth.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/createpreauth.png
rename to ai-vector-search-apex-adb/setup/images/createpreauth.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ignorewarning1.png b/ai-vector-search-apex-adb/setup/images/ignorewarning1.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ignorewarning1.png
rename to ai-vector-search-apex-adb/setup/images/ignorewarning1.png
diff --git a/ai-vector-search-apex-adb/setup/images/livelabsshkey.png b/ai-vector-search-apex-adb/setup/images/livelabsshkey.png
new file mode 100644
index 0000000..f9924b0
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/livelabsshkey.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/oci.png b/ai-vector-search-apex-adb/setup/images/oci.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/oci.png
rename to ai-vector-search-apex-adb/setup/images/oci.png
diff --git a/ai-vector-search-apex-adb/setup/images/ocid.png b/ai-vector-search-apex-adb/setup/images/ocid.png
new file mode 100644
index 0000000..9165419
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/ocid.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ocidsave.png b/ai-vector-search-apex-adb/setup/images/ocidsave.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ocidsave.png
rename to ai-vector-search-apex-adb/setup/images/ocidsave.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/open-terminal.png b/ai-vector-search-apex-adb/setup/images/open-terminal.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/open-terminal.png
rename to ai-vector-search-apex-adb/setup/images/open-terminal.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openaikey.png b/ai-vector-search-apex-adb/setup/images/openaikey.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openaikey.png
rename to ai-vector-search-apex-adb/setup/images/openaikey.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openjupyterlab.png b/ai-vector-search-apex-adb/setup/images/openjupyterlab.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openjupyterlab.png
rename to ai-vector-search-apex-adb/setup/images/openjupyterlab.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/opennotebook.png b/ai-vector-search-apex-adb/setup/images/opennotebook.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/opennotebook.png
rename to ai-vector-search-apex-adb/setup/images/opennotebook.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/opennotebooklab1.png b/ai-vector-search-apex-adb/setup/images/opennotebooklab1.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/opennotebooklab1.png
rename to ai-vector-search-apex-adb/setup/images/opennotebooklab1.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openragnotebook.png b/ai-vector-search-apex-adb/setup/images/openragnotebook.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openragnotebook.png
rename to ai-vector-search-apex-adb/setup/images/openragnotebook.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openragwithoracle23ai.png b/ai-vector-search-apex-adb/setup/images/openragwithoracle23ai.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/openragwithoracle23ai.png
rename to ai-vector-search-apex-adb/setup/images/openragwithoracle23ai.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/policyconfiguration.png b/ai-vector-search-apex-adb/setup/images/policyconfiguration.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/policyconfiguration.png
rename to ai-vector-search-apex-adb/setup/images/policyconfiguration.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragdesign.jpg b/ai-vector-search-apex-adb/setup/images/ragdesign.jpg
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragdesign.jpg
rename to ai-vector-search-apex-adb/setup/images/ragdesign.jpg
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragdesign.png b/ai-vector-search-apex-adb/setup/images/ragdesign.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragdesign.png
rename to ai-vector-search-apex-adb/setup/images/ragdesign.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragnotebookopen.png b/ai-vector-search-apex-adb/setup/images/ragnotebookopen.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragnotebookopen.png
rename to ai-vector-search-apex-adb/setup/images/ragnotebookopen.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragwithoracle23ai.png b/ai-vector-search-apex-adb/setup/images/ragwithoracle23ai.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/ragwithoracle23ai.png
rename to ai-vector-search-apex-adb/setup/images/ragwithoracle23ai.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/refresh.jpg b/ai-vector-search-apex-adb/setup/images/refresh.jpg
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/refresh.jpg
rename to ai-vector-search-apex-adb/setup/images/refresh.jpg
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/runjupyter.png b/ai-vector-search-apex-adb/setup/images/runjupyter.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/runjupyter.png
rename to ai-vector-search-apex-adb/setup/images/runjupyter.png
diff --git a/ai-vector-search-apex-adb/setup/images/saveconfig.png b/ai-vector-search-apex-adb/setup/images/saveconfig.png
new file mode 100644
index 0000000..4cc77ca
Binary files /dev/null and b/ai-vector-search-apex-adb/setup/images/saveconfig.png differ
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcell.png b/ai-vector-search-apex-adb/setup/images/selectcell.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcell.png
rename to ai-vector-search-apex-adb/setup/images/selectcell.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcodesnippet.png b/ai-vector-search-apex-adb/setup/images/selectcodesnippet.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcodesnippet.png
rename to ai-vector-search-apex-adb/setup/images/selectcodesnippet.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcodesnippetrun.png b/ai-vector-search-apex-adb/setup/images/selectcodesnippetrun.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/selectcodesnippetrun.png
rename to ai-vector-search-apex-adb/setup/images/selectcodesnippetrun.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/step0.png b/ai-vector-search-apex-adb/setup/images/step0.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/step0.png
rename to ai-vector-search-apex-adb/setup/images/step0.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/step1.png b/ai-vector-search-apex-adb/setup/images/step1.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/step1.png
rename to ai-vector-search-apex-adb/setup/images/step1.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/tenancysearch.png b/ai-vector-search-apex-adb/setup/images/tenancysearch.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/tenancysearch.png
rename to ai-vector-search-apex-adb/setup/images/tenancysearch.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/userprofile.png b/ai-vector-search-apex-adb/setup/images/userprofile.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/userprofile.png
rename to ai-vector-search-apex-adb/setup/images/userprofile.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/zoom.png b/ai-vector-search-apex-adb/setup/images/zoom.png
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/images/zoom.png
rename to ai-vector-search-apex-adb/setup/images/zoom.png
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/setup.md b/ai-vector-search-apex-adb/setup/setup.md
similarity index 70%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/setup.md
rename to ai-vector-search-apex-adb/setup/setup.md
index e3374aa..a03d1b2 100644
--- a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/setup/setup.md
+++ b/ai-vector-search-apex-adb/setup/setup.md
@@ -2,24 +2,36 @@
## Introduction
-Welcome to Lab 1, before we begin the AI RAG steps we will guide you through the steps needed for APEX to access Oracle Object Storage. The lab focuses on two main areas: Identity Setup and Bucket Setup. By the end of this lab, you will have a functional compartment and policies for managing your cloud resources, as well as a properly configured bucket for storing and managing your objects in OCI.
+Welcome to Lab 1. This workshop demonstrates how to set up Oracle Cloud Infrastructure (OCI) resources to enable Oracle APEX to access Oracle Object Storage. The lab focuses on two main areas: Identity Setup and Bucket Setup. By the end of this lab, you will have a functional compartment and policies for managing your cloud resources, as well as a properly configured bucket for storing and managing your objects in OCI.
In the Identity Setup section, you will learn how to create compartments, manage policies, and set up users with the necessary permissions to interact with OCI resources. Following this, the Bucket Setup section will walk you through the process of creating and configuring a storage bucket, essential for managing data and objects in your cloud environment.
-Estimated Time: 10 minutes
+**Estimated Time:** 10 minutes
## Objectives
By completing this lab, you will achieve the following objectives:
-- Create and configure a new compartment for managing resources in OCI.
-- Establish policies to control access and permissions within the compartment.
-- Set up a user specifically for API key management and interaction.
-- Configure API keys for secure access and operations.
-- Obtain necessary OCIDs for compartments, users, and tenancies.
-- Create and configure a storage bucket in OCI.
-- Generate a Pre-Authenticated Request (PAR) for secure bucket access.
+- **Create and configure a new compartment** for managing resources in OCI.
+ - This involves setting up a logical grouping for your resources to enhance management and organization.
+
+- **Establish policies** to control access and permissions within the compartment.
+ - You will define and implement policies to manage who can access and perform actions on your OCI resources.
+- **Set up a user specifically for API key management and interaction.**
+ - This step ensures that there is a dedicated user with appropriate permissions for managing and using API keys securely.
+
+- **Configure API keys for secure access and operations.**
+ - You will generate and set up API keys to enable secure programmatic access to your OCI resources.
+
+- **Obtain necessary OCIDs** for compartments, users, and tenancies.
+ - OCIDs (Oracle Cloud Identifiers) are essential for uniquely identifying your resources in OCI.
+
+- **Create and configure a storage bucket in OCI.**
+ - This section guides you through setting up a storage bucket, a crucial component for storing and managing data in your cloud environment.
+
+- **Generate a Pre-Authenticated Request (PAR) for secure bucket access.**
+ - You will create a PAR to enable secure and temporary access to your storage bucket without requiring further authentication.
### Task 1: Create an OCI Compartment
@@ -33,24 +45,6 @@ By completing this lab, you will achieve the following objectives:
6. Save the compartment OCID for later use.
![compartment save](/images/compartmentsave.png)
-### Task 2: Create the Group and Policy
-
-1. Click the hamburger icon (≡), select Identity, and click Groups.
-2. Click Create Group.
-3. Enter the following information in the corresponding fields:
- 1. **Name**: ProdObjectManagers
- 2. **Description**: Users who can manage objects in compartment PROD
-4. Add the users that you want to the group as well you should see it listed in the configuration box.
-5. Click Create to complete the process.
-
-6. Create the ProdObjectManagementPolicies policy in the root compartment:
-7. Click the hamburger icon (≡), Click Identity & Security, and then click Policies.
- ![Policies](/images/oci.png)
-8. Enter the following information in the corresponding fields:
- - **Name**: ProdObjectManagementPolicies
- - **Description**: Policies for users to manage objects in compartment PROD
- - **Policy Versioning**: Keep Policy Current
-
The members of the ProdObjectManagers group will require the ability to list the buckets in the compartment and manage any objects in these buckets.
9. Add the following statements to allow the respective policy actions:
@@ -59,7 +53,7 @@ The members of the ProdObjectManagers group will require the ability to list the
10. Click Create to complete the process.
![Policies](/images/policyconfiguration.png)
-### Task 3: Create policy to enable access to OCI GenAI
+### Task 2: Create policy to enable access to OCI GenAI
Oracle's GenAI service is an LLM service from Oracle Cloud Infrastructure (OCI). The GenAI service provides access to several LLMs that you can pick from.
@@ -78,7 +72,11 @@ Description: Public Gen AI Policy
Compartment: select your own compartment
-Policy: allow any-user to manage generative-ai-family in compartment \
+```
+
+Policy: allow user to manage generative-ai-family in compartment \
+
+```
3. Click Create.
@@ -86,14 +84,14 @@ Policy: allow any-user to manage generative-ai-family in compartment \
```
-## Task 3: Create function to generate response using LLM
+## Task 3: Option 1 OpenAI - Create function to generate response using OpenAI LLM
The LLM involves processing both the user question and relevant text excerpts to generate responses tailored specifically to the provided context. It's essential to note that the nature of the response is contingent upon the question and the LLM utilized.
@@ -158,8 +159,8 @@ In the code below we are embedding the user question, performing a vector search
Compile the function `generate_text_response2` below. It is called from APEX.
-## OpenAI
-For connecting and authenticating to OpenAI you must have created the login credentials using DBMS\_VECTOR.CREATE\_CREDENTIAL in the previous lab. Note: If you receive an HTTP response error ensure you have enough credits to use OpenAI.
+### OpenAI
+For connecting and authenticating to OpenAI you must have created the login credentials with an OpenAI API key using DBMS\_VECTOR.CREATE\_CREDENTIAL in the previous lab. Note: If you receive an HTTP response error ensure you have enough credits to use OpenAI.
```sql
@@ -240,27 +241,103 @@ EXCEPTION
END;
```
-## OCI GenAI
-To use OCI GenAI, replace the above function params with the params_genai parameters below.
-For connecting and authenticating to OCI GenAI you must have created the login credentials using DBMS\_VECTOR.CREATE\_CREDENTIAL in the previous lab.
- ```
-
- -- Construct oci genai params JSON
-
- params_genai := '
+## Task 3: Option 2 OCI GenAI Service - Create function to generate response using OCI GenAI LLM
+
+The LLM involves processing both the user question and relevant text excerpts to generate responses tailored specifically to the provided context. It's essential to note that the nature of the response is contingent upon the question and the LLM utilized.
+
+LLM prompt engineering enables you to craft input queries or instructions to create more accurate and desirable outputs. The PLSQL uses a SQL CURSOR and CLOBs to generate the LLM prompt based on facts from the similarity search from Oracle Database 23ai.
+
+In the code below we are embedding the user question, performing a vector search in the database for the relevant text chunks using a vector distance function. We pass the doc\_id to select the chunks related to a PDF document we loaded. This improves the accuracy of the LLM response for the question by restricting the result within the content of PDF. We then send the text chunks to LLM to provide the response.
+
+Compile the function `generate_text_response2` below. It is called from APEX.
+
+### OCI GenAI
+For connecting and authenticating to OCI GenAI you must have created the login credentials using DBMS\_VECTOR.CREATE\_CREDENTIAL in the previous lab.
+
+```sql
+
+create or replace FUNCTION generate_text_response2 (
+ user_question VARCHAR2,
+ doc_id NUMBER,
+ topn NUMBER
+) RETURN CLOB IS
+
+ messages CLOB;
+ params CLOB;
+ output CLOB;
+ message_line VARCHAR2(4000);
+ message_cursor SYS_REFCURSOR;
+ user_question_vec vector;
+ pages_1 varchar2(4000);
+ embed_id number ;
+BEGIN
+
+ --vectorize the user_question
+
+ OPEN message_cursor FOR 'WITH a AS (
+ SELECT TO_VECTOR(VECTOR_EMBEDDING(TINYBERT_MODEL USING :user_question AS data)) AS embed
+ FROM DUAL)
+ SELECT EMBED_DATA, embed_id
+ FROM VECTOR_STORE, a
+ WHERE doc_id = :doc_id
+ ORDER BY VECTOR_DISTANCE(EMBED_VECTOR, a.embed, COSINE)
+ FETCH FIRST :topn ROWS ONLY '
+ USING user_question, doc_id, topn;
+
+ --select embed_data from vector_store where doc_id=7;
+ -- Initialize messages CLOB
+ messages := 'Your task is to answer the Question from the give text. ';
+ pages_1 := '--';
+
+ -- Loop through cursor results and construct messages
+ LOOP
+ FETCH message_cursor INTO message_line,embed_id;
+ EXIT WHEN message_cursor%notfound;
+
+ -- Append message line to messages CLOB
+ messages := messages|| '{"message": "'|| message_line|| '"},'|| chr(10);
+ pages_1 := embed_id||','||pages_1;
+
+ END LOOP;
+
+ messages := messages|| '{"Question": "'|| user_question|| '"},'|| chr(10);
+ -- Close the cursor
+ CLOSE message_cursor;
+
+ -- Remove the trailing comma and newline character
+ messages := rtrim(messages, ',' || chr(10));
+
+ -- Construct oci genai params JSON
+ params := '
{
"provider":"ocigenai",
"credential_name": "GENAI_CRED",
- "url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/generateText",
+ "url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/chat",
"model": "cohere.command",
"inferenceRequest": {
"maxTokens": 2000,
"temperature": 1
}
}';
-
- ```
+
+ dbms_output.put_line('------------------------');
+ -- dbms_output.put_line(messages);
+ dbms_output.put_line(pages_1);
+ --dbms_output.put_line(to_char(user_question_vec));
+
+ -- Call UTL function to generate text
+ output := dbms_vector_chain.utl_to_generate_text(messages, json(params));
+
+ -- Return the generated text
+ RETURN output;
+EXCEPTION
+ WHEN OTHERS THEN
+ RETURN sqlerrm || sqlcode;
+END;
+
+```
+
## Conclusion
In this lab we learned how a RAG solution using PLSQL works. The table below lists the vector functions we used.
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/workshops/freetier/index.html b/ai-vector-search-apex-adb/workshops/freetier/index.html
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/workshops/freetier/index.html
rename to ai-vector-search-apex-adb/workshops/freetier/index.html
diff --git a/ai-vector-search-apex-adb/ai-vector-search-apex-adb/workshops/freetier/manifest.json b/ai-vector-search-apex-adb/workshops/freetier/manifest.json
similarity index 100%
rename from ai-vector-search-apex-adb/ai-vector-search-apex-adb/workshops/freetier/manifest.json
rename to ai-vector-search-apex-adb/workshops/freetier/manifest.json