From a7321c347bdc9869d86d0f34e36ba067325c6769 Mon Sep 17 00:00:00 2001 From: Brianna Ambler <84342965+Brianna-Ambler@users.noreply.github.com> Date: Fri, 30 Aug 2024 10:23:58 -0500 Subject: [PATCH] LL ID #3984: Minor Fixes & Updates (#665) * Self-QA Updates Adding workshop changes to further align with the Self-QA checklist. * Update adb-free-container-setup.md * Post-Testing Edits V1 * Update adb-free-container-setup.md * Post-Testing Changes V2 * Updating Screenshots * WMSID# 11693: Adding the initial workshop structure. * Update adb-free-container-setup.md * Update adb-free-container-setup.md * [WMS ID #11029] DB Collective - JSON Duality Search * WMS ID #11029: Minor fix * Update manifest.json * LL ID #4004: Add JSON Duality Intro * LL ID# 4004: Minor Updates * LL ID #4004: Minor updates. * WMS ID #11693: Revising the workshop structure. * WMS ID# 11693 * HOL 46 * DB Collective - JSON Updates * LL ID #4004: DB Collective Changes * OCW & DB Collective Updates * Update new-duality-views-15.md * Update new-duality-views-15.md * Update new-duality-views-15.md * Update new-duality-views-15.md * Update new-duality-views-15.md * Update new-duality-views-15.md * LL ID #3984: Formatting Changes * HOL 46 Technical Fixes * Update inst-auth-container-setup.md * DB Collective + OCW 24 Updates * Update manifest.json * LL ID #3984: Screenshots & Minor Fixes * LL ID #3984 - Minor Updates & Fixes --------- Co-authored-by: William Masdon Co-authored-by: Hope Fisher <127253314+hope-fisher@users.noreply.github.com> --- .../inst-auth-container-setup.md | 9 ++++----- 23aifree/introduction/intro-aivs-adb.md | 1 + 23aifree/vector-search/similarity-search.md | 17 +++++++++-------- 23aifree/vector-search/traditional-search.md | 10 ++++++++-- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/23aifree/adb-free-container-setup/inst-auth-container-setup.md b/23aifree/adb-free-container-setup/inst-auth-container-setup.md index 4e2ad325..7191d381 100644 --- a/23aifree/adb-free-container-setup/inst-auth-container-setup.md +++ b/23aifree/adb-free-container-setup/inst-auth-container-setup.md @@ -33,15 +33,15 @@ In the LiveLabs Sandbox, we will download the image from an OCI bucket. However, ## Downloading both the container and workshop resources. wget https://objectstorage.ca-toronto-1.oraclecloud.com/p/GDCjmPfuRMx-juvDGT0Mn7ZsaI_O5y_PsGg41xcLVVl8vewGOm6Ns4zeLsTPAr3p/n/c4u04/b/apex-images/o/configuration-files.zip -P /tmp - # Opening the zip file. + ## Opening the zip file. unzip -q /tmp/configuration-files.zip + chmod -R 777 mount-files ``` ![Download container image](images/download-configuration-files.png) - 2. **Load the image into the podman catalog. (~5 mins)** Podman-load copies the image from the local docker archive into the podman container storage. This will take about 5 minutes--let's review the YAML file in the meantime. ``` @@ -137,7 +137,6 @@ In the LiveLabs Sandbox, we will download the image from an OCI bucket. However, 9. **Configure the APEX image.** We'll first need to redirect APEX to use the images behind our firewall. Run this command in the terminal to do so. This is only required for APEX use in Livelabs. ``` - podman exec -it oracle_adb-free_1 chmod 777 /u01/scripts/db-config.sh podman exec -it oracle_adb-free_1 /bin/sh -c "/u01/scripts/db-config.sh" ``` @@ -145,7 +144,7 @@ In the LiveLabs Sandbox, we will download the image from an OCI bucket. However, ## Task 2: Access APEX & SQL Developer Web -Oracle Autonomous Database Free has APEX and ORDS (a.k.a Database Actions) preinstalled. Let's see how you can get started! +Oracle Autonomous Database Free has ORDS preinstalled. Let's see how you can get started! 1. **Open new Chrome window.** ![Open new Chrome window.](images/new-chrome-window.png) @@ -165,7 +164,7 @@ Oracle Autonomous Database Free has APEX and ORDS (a.k.a Database Actions) prein 4. **Sign into SQL Developer Web.** Use the database admin login credentials below.
**Username -** admin
- **Password -** Welcome_12345 (or the custom password you specified in Task 1, Step 5.) + **Password -** Welcome_12345 ![Sign into DB Actions](images/sign-in-ords.png) diff --git a/23aifree/introduction/intro-aivs-adb.md b/23aifree/introduction/intro-aivs-adb.md index 31e4b5ef..0317f76c 100644 --- a/23aifree/introduction/intro-aivs-adb.md +++ b/23aifree/introduction/intro-aivs-adb.md @@ -11,6 +11,7 @@ Oracle Autonomous Database provides an easy-to-use, fully autonomous database th The Oracle Autonomous Database Free Container Image provides an alternative to run Autonomous Database in a container in your own environment, without requiring access to Oracle Cloud Infrastructure Console or to the internet. When you run Autonomous Database in a container, the container provides a local, isolated environment with additional options for development, testing, and exploration of Oracle Autonomous Database features. +Learrn more about the Oracle Autonomous Database Free container image [here](https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/autonomous-docker-container.html) **_Estimated Time: 90 minutes_** diff --git a/23aifree/vector-search/similarity-search.md b/23aifree/vector-search/similarity-search.md index 367b2cbe..70747d7e 100644 --- a/23aifree/vector-search/similarity-search.md +++ b/23aifree/vector-search/similarity-search.md @@ -72,7 +72,7 @@ This lab assumes you have: ``` ![Confirm model in database directory.](images/list-db-dir-files.png) -8. **Load the ONNX model into the database.** +8. **Load the ONNX model into the database.** Learn more on how to use this function and the model requirements [here](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_vector1.html#GUID-7F1D7992-D8F7-4AD9-9BF6-6EFFC1B0617A). ``` EXECUTE DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','all-MiniLM-L12-v2.onnx','doc_model'); @@ -80,7 +80,7 @@ This lab assumes you have: ``` ![Load the embedding-model.](images/load-model.png) -You may now proceed to the next lab. + ## Task 2: Generate, Store, & Query Vector Data @@ -88,16 +88,16 @@ You may now proceed to the next lab. ``` CREATE TABLE product_vectors AS - SELECT product_id, product_name, JSON_VALUE(product_details, '$.description') AS product_description, TO_VECTOR(VECTOR_EMBEDDING(doc_model USING JSON_VALUE(product_details, '$.description') AS data)) AS embedding + SELECT product_id, product_name, JSON_VALUE(product_details, '$.description') AS product_description, VECTOR_EMBEDDING(doc_model USING JSON_VALUE(product_details, '$.description') AS data) AS embedding FROM co.products; ``` ![Generate description vectors.](images/generate-vectors.png) -2. **Retrieve the 5 products most similar to the word professional using vector search."** +2. **Using vector search, retrieve the 5 products most similar to the word "professional".** By default, VECTOR_DISTANCE uses the cosine formula as it's distance metric, but you can change the metric as you see fit. We recommend using the metric suggested by the embedding model, in this case it was cosine. Learn more about distance metrics [here](https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/vector-distance-metrics.html). ``` - SELECT product_name, product_description, VECTOR_DISTANCE(embedding, TO_VECTOR(VECTOR_EMBEDDING(doc_model USING 'professional' AS data))) AS vector_distance + SELECT product_name, product_description, VECTOR_DISTANCE(embedding, VECTOR_EMBEDDING(doc_model USING 'professional' AS data)) AS vector_distance FROM product_vectors ORDER BY vector_distance FETCH EXACT FIRST 5 ROWS ONLY; @@ -107,10 +107,10 @@ You may now proceed to the next lab. This is a vast improvement from the empty result set we got from our traditional search! We can see that the similarity search has returned clothing items described with words contextually similar to "professional". ![Similarity search on the word professional.](images/similarity-search-professional.png) -3. **Search for product description vectors based on their similarity to the word "slacks".** +3. **Using vector search, retrieve the 5 products most similar to the word "slacks".** ``` - SELECT product_name, product_description, VECTOR_DISTANCE(embedding, TO_VECTOR(VECTOR_EMBEDDING(doc_model USING 'slacks' AS data))) AS vector_distance + SELECT product_name, product_description, VECTOR_DISTANCE(embedding, VECTOR_EMBEDDING(doc_model USING 'slacks' AS data)) AS vector_distance FROM product_vectors ORDER BY vector_distance FETCH EXACT FIRST 5 ROWS ONLY; @@ -120,8 +120,9 @@ You may now proceed to the next lab. Once again--big improvements! Notice that the model was able to relate slacks to other bottoms, and use the term's professional context to find other formal wear. So, despite there not being a product description containing the word "slacks", viable results are still returned due to their similarity to the query. ![Similarity search on the word slacks.](images/similarity-search-slacks.png) +**You've completed the workshop!** -You may now proceed to the next lab. + ## Acknowledgements - **Authors** - Brianna Ambler, Database Product Management diff --git a/23aifree/vector-search/traditional-search.md b/23aifree/vector-search/traditional-search.md index 53fe66a4..46c301ba 100644 --- a/23aifree/vector-search/traditional-search.md +++ b/23aifree/vector-search/traditional-search.md @@ -25,7 +25,7 @@ This lab assumes you have: 1. **Return to the terminal.** ![Return to terminal.](images/return-to-terminal.png) -2. **Connect to the database.** +2. **Connect to the database.** You can connect to the database using any of the TNS aliases listed in 'tnsnames.ora", using the following format: 'user'/'password'@'tns_alias'. ``` podman exec -it oracle_adb-free_1 sqlplus admin/Welcome_12345@myatp_low @@ -33,7 +33,7 @@ This lab assumes you have: ``` ![Connect to database.](images/connect-to-adb.png) -3. **Install the sample schema.** You'll be installing Oracle's "Customer Orders" sample schema, which stores the data, objects, and relations necessary for a typical retail store. This schema mas been modified to include English product descriptions for us to vectorize later. +3. **Install the sample schema.** You'll be installing Oracle's "Customer Orders" sample schema, which stores the data, objects, and relations necessary for a typical retail store. This schema mas been modified to include English product descriptions for us to vectorize later. Find out more about Oracle's sample schemas [here](https://docs.oracle.com/en/database/oracle/oracle-database/19/comsc/introduction-to-sample-schemas.html). ``` @@ -63,6 +63,12 @@ As a retailer, you want customers to easily search your catalog for the clothing ![View the products table.](images/view-products.png) 3. **View the product details.** The product details are stored as a JSON document. Let's see what details are in here! + ``` + + SELECT product_name, JSON_SERIALIZE(product_details PRETTY) as product_details + FROM co.products; + + ``` ![View the product details.](images/view-product-details.png) 4. **Traditionally search your catalog for the word "professional".**