Skip to content

Commit

Permalink
LL ID #3984: Minor Fixes & Updates (#665)
Browse files Browse the repository at this point in the history
* 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 <william.masdon@oracle.com>
Co-authored-by: Hope Fisher <127253314+hope-fisher@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 30, 2024
1 parent d205bee commit a7321c3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
</copy>
```
![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.

```
Expand Down Expand Up @@ -137,15 +137,14 @@ 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.
```
<copy>
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"
</copy>
```
![Configure the APEX images.](images/apex-configuration.png)

## 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)
Expand All @@ -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.<br/>

**Username -** admin<br/>
**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)

Expand Down
1 change: 1 addition & 0 deletions 23aifree/introduction/intro-aivs-adb.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_**

Expand Down
17 changes: 9 additions & 8 deletions 23aifree/vector-search/similarity-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,32 @@ 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).
```
<copy>
EXECUTE DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','all-MiniLM-L12-v2.onnx','doc_model');
</copy>
```
![Load the embedding-model.](images/load-model.png)

You may now proceed to the next lab.

## Task 2: Generate, Store, & Query Vector Data

1. **Generate and store the product description vectors.**
```
<copy>
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;
</copy>
```
![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).
```
<copy>
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;
Expand All @@ -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".**
```
<copy>
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;
Expand All @@ -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!**
<!-- ## Task 3: Combine Business Data with Similarity Search -->
You may now proceed to the next lab.
<!-- You may now proceed to the next lab. -->

## Acknowledgements
- **Authors** - Brianna Ambler, Database Product Management
Expand Down
10 changes: 8 additions & 2 deletions 23aifree/vector-search/traditional-search.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ 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'.
```
<copy>
podman exec -it oracle_adb-free_1 sqlplus admin/Welcome_12345@myatp_low
</copy>
```
![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).

```
<copy>
Expand Down Expand Up @@ -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!
```
<copy>
SELECT product_name, JSON_SERIALIZE(product_details PRETTY) as product_details
FROM co.products;
</copy>
```
![View the product details.](images/view-product-details.png)

4. **Traditionally search your catalog for the word "professional".**
Expand Down

0 comments on commit a7321c3

Please sign in to comment.