Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
klazarz committed Aug 20, 2024
2 parents 2f9f361 + 609d53e commit 6806869
Show file tree
Hide file tree
Showing 7 changed files with 554 additions and 73 deletions.
78 changes: 15 additions & 63 deletions 23aifree/vector-search/generate-vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,104 +37,56 @@ This lab assumes you have:
</copy>
```
4. **Grant the DB\_DEVELOPER\_ROLE to dmuser.**
```
<copy>
GRANT DB_DEVELOPER_ROLE TO dmuser identified by Welcome_123456;
</copy>
```
5. **Grant CREATE MINING MODEL privilege to dmuser.**
```
<copy>
GRANT create mining model TO dmuser;
</copy>
```
6. **Create a folder for our vector embedding model in the PDB.**
4. **Create a folder for our vector embedding model in the PDB.**
```
<copy>
CREATE OR REPLACE DIRECTORY DM_DUMP as 'models';
</copy>
```
6. **Grant READ permissions on the DM_DUMP directory to dmuser.**
```
<copy>
GRANT READ ON DIRECTORY DM_DUMP TO dmuser;
</copy>
```
7. **Grant WRITE permissions on the DM_DUMP directory to dmuser.**
```
<copy>
GRANT WRITE ON DIRECTORY DM_DUMP TO dmuser;
</copy>
```
8. **Add quota to tablespace DATA for dmuser.**
```
<copy>
alter user SALES quota 50m on users;
</copy>
```
9. **Copy the absolute file path of the PDB's working directory.** Copy the file path returned by the following command.
5. **Copy the absolute file path of the PDB's working directory.** Copy the file path returned by the following command.
```
<copy>
select directory_path from all_directories where directory_name = 'DM_DUMP';
</copy>
```
10. **Return to the container shell. Move the vector model into the PDB's working directory.**
6. **Return to the container shell. Move the vector model into the PDB's working directory.**
```
<copy>
cp u01/BERT-TINY.onnx <working-directory>
exit
</copy>
```
11. **Return to SQL Developer Web.**
12. **Confirm the model appears in the database directory.**
```
<copy>
SELECT * FROM DBMS_CLOUD.LIST_FILES('DM_DUMP');
</copy>
cp u01/BERT-TINY.onnx </copy> replace-with-working-directory
```
You may proceed to the next lab.
## Task 2: Import the ONNX Model
1. **Return to the container shell.**
7. **Return to SQL Developer Web.**
2. **Connect to the ADB as dmuser.**
8. **Confirm the model appears in the database directory.**
```
<copy>
sqlplus dmuser/Welcome_123456@myatp_low
SELECT * FROM DBMS_CLOUD.LIST_FILES('DM_DUMP');
</copy>
```
3. **Load the ONNX model into the database.**
9. **Load the ONNX model into the database.**
```
<copy>
EXECUTE DBMS_VECTOR.LOAD_ONNX_MODEL('DM_DUMP','BERT-TINY.onnx','doc_model');
</copy>
```
You may now proceed to the next lab.
## Task 3: Generate Vectors From the Data
1. **Extract the product descriptions.**
```
<copy>
create or replace view co.product_descriptions as select product_id, JSON_VALUE(product_details, '$.description') as product_description from co.products;
</copy>
```
## Task 2: Generate Vectors From the Data
2. **Transform the product descriptions into vectors.**
1. **Transform the product descriptions into vectors.**
```
<copy>
create view product_vectors as
select product_id, TO_VECTOR(VECTOR_EMBEDDING(doc_model USING product_description as data)) as embedding from co.product_descriptions;
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 from co.products;
</copy>
```
Expand Down
6 changes: 3 additions & 3 deletions 23aifree/vector-search/intro-vector-search-hol.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ As a retailer, you want customers to easily search your catalog for the clothing
This doesn't mean that our catalog has nothing we could wear to a conference or in a professional setting. Our results are simply limited by traditional search methods. Only searching for a specific word means that we might overlook similar results because they aren't an exact match. Even when we find that exact match, it's still not a guarantee that it'll align with what you meant.
This because we're only looking at the literal value of of our search query and not considering the actual meaning of it. Vector search allows us to query our data based on its actual meaning. Let’s see how it simple it is to vector search the product descriptions instead.
This because we're only looking at the literal value of of our search query and not considering the actual meaning of it. Vector search allows us to query our data based on its actual meaning. In the next lab, we'll embed these terms and perform vector search on them instead.
## Task 3: Perform a Vector Search for Professional Attire
<!-- ## Task 3: Perform a Vector Search for Professional Attire
1. **Click Data Load, in the upper-right.**
![](images/task3.1.png)
Expand Down Expand Up @@ -118,7 +118,7 @@ This because we're only looking at the literal value of of our search query and
ORDER BY VECTOR_DISTANCE(to_vector(embedding), to_vector('[-9.68606323E-002,7.5337708E-002,-1.0658735E-001,-1.38738364E-001,-2.28260402E-002,3.5230644E-002,2.68885796E-003,1.36218229E-002,1.15028154E-002,4.23902161E-002,8.37896764E-002,2.90349014E-002,-1.51465312E-001,1.49059035E-002,1.46184951E-001,-1.77720428E-001,5.30827865E-002,-5.13745425E-003,-7.5569436E-002,1.34732634E-001,5.25507284E-003,3.61185595E-002,2.11690515E-001,5.85873537E-002,-3.19165476E-002,-7.93770403E-002,1.45305004E-002,4.49487194E-002,1.37902955E-002,-1.09221734E-001,-5.7302203E-002,-1.12185463E-001,-6.40390366E-002,6.2864095E-002,4.25061174E-002,-1.19959101E-001,5.48176914E-002,-1.05015293E-001,-1.09484673E-001,-1.26435086E-001,8.88467953E-002,-6.78603202E-002,7.37638995E-002,-5.0049141E-002,6.07395545E-002,-1.30454943E-001,-5.51283062E-002,-1.21642545E-001,-3.97110172E-002,1.46834096E-002,-9.3602553E-002,2.41991818E-001,3.517735E-002,-7.62047153E-003,1.30953774E-001,-1.40298694E-001,9.79949087E-002,-6.78110123E-002,-1.04402095E-001,9.76447538E-002,8.0076322E-002,-1.31879494E-001,-8.34248215E-002,-8.54361951E-002,-1.22926809E-001,-8.59939158E-002,8.22370127E-002,5.52646583E-003,9.4893679E-002,-9.64170173E-002,-3.16511393E-002,-9.48159024E-003,-7.33673051E-002,-3.52119654E-002,-2.69408673E-002,9.13547445E-003,1.26846209E-001,3.09299417E-002,1.38598114E-001,4.07091081E-002,3.46698835E-002,2.05623899E-002,3.31137851E-002,-8.18310399E-003,-6.5582931E-002,-7.39831626E-002,-7.24066142E-003,-6.11410327E-002,1.57419547E-001,-1.34564966E-001,8.96778107E-002,-4.31015593E-004,-1.22770734E-001,7.80297145E-002,5.69474846E-002,8.80813822E-002,3.1488277E-002,-1.51161058E-002,7.1529232E-002,8.24968889E-002,-1.08482465E-001,1.52552053E-002,4.57050614E-002,-1.20126978E-001,9.49510187E-002,-7.69320577E-002,-1.02195516E-001,1.10023908E-001,5.00271246E-002,-1.07030541E-001,7.50863254E-002,5.98394163E-002,5.17932661E-002,5.67459613E-002,6.10302612E-002,8.13639611E-002,-6.97210804E-002,-1.61270708E-001,6.98513016E-002,7.82461837E-002,-1.56437326E-002,1.21171348E-001,6.85361698E-002,-1.86466992E-001,-1.40970141E-001,-1.14370458E-001,-3.85081656E-002,6.8552658E-002]'), EUCLIDEAN )
FETCH EXACT FIRST 10 ROWS ONLY;
</copy>
```
``` -->
## Acknowledgements
- **Authors** - Brianna Ambler, Database Product Management, August 2024
Expand Down
8 changes: 4 additions & 4 deletions 23aifree/workshops/sandbox-aivs-adb/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"filename": "https://oracle-livelabs.github.io/common/labs/remote-desktop/using-novnc-remote-desktop.md"
},
{
"title": "Lab 1: Launch the Oracle Autonomous Database 23ai Free Container",
"description": "Installing and configuring the database",
"title": "Lab 1: Launch the Oracle ADB Free Container Image",
"description": "Installing and configuring the Oracle Database.",
"type": "livelabs",
"filename": "../../adb-free-container-setup/inst-auth-container-setup.md"
},
{
"title": "Lab 2: Explore the Power of Oracle AI Vector Search",
"title": "Lab 2: Perform a Traditional Data Search",
"description": "Understanding the value of Oracle AI Vector Search.",
"type": "livelabs",
"filename": "../../vector-search/intro-vector-search-hol.md"
},
{
"title": "Lab 3: Learn the Vector Search Process on Oracle Database 23ai",
"title": "Lab 3: Perform a Similarity Search with Oracle AI Vector Search",
"description": "Explains how to vectorize your data.",
"type": "livelabs",
"filename": "../../vector-search/generate-vectors.md"
Expand Down
85 changes: 85 additions & 0 deletions db-23ai-fundamentals/intro/green-button-setup-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Get Started with Livelabs

## Introduction

Welcome to your LiveLabs Sandbox environment. In order to start your workshop, you need to login to our LiveLabs Sandbox.

In this lab, we are going to show you where you can find the login information and how to log in to the LiveLabs Sandbox.

Estimated Time: 5 minutes


### Objectives

* View login information to LiveLabs Sandbox
* Login to LiveLabs Sandbox

### Prerequisites

* Requested a Green Button environment

## Task 1: Log in to the Oracle Cloud Console

1. Click the **View Login Info** link in the banner.

![Click View Login Info.](./images/ll-view-login-info.png " ")

This panel displays important information that you will need throughout this workshop.

![The Workshop is displayed.](./images/ll-reservation-information.png " ")

2. Click **Copy Password** to copy your initial password, and then click **Launch OCI**.

3. On the Sign In page, in the **Oracle Cloud Infrastructure Direct Sign-In** section, your assigned username is already displayed in the **User Name** field. Paste your password in the **Password** field, and then click **Sign In**.

![The Oracle Cloud Infrastructure Direct Sign-In section with the populated username and password is displayed. The Sign In button is highlighted.](./images/ll-signin.png " ")

4. The **Change Password** dialog box is displayed. Paste your assigned password that you copied in the **Current Password**. Enter a new password in the **New Password** and **Confirm New Password** fields, and then click **Save New Password**. Make a note of your new password as you will need it in this workshop.

![The completed Change Password dialog box is displayed. The Save New Password button is highlighted.](./images/ll-change-password.png " ")

The **Oracle Cloud Console** Home page is displayed. Make sure that the displayed region is the same that was assigned to you in the **Reservation Information** panel of the **Run Workshop *workshop-name*** page, **Canada Southeast (Toronto)** in this example.

![The Oracle Cloud Console Home page is displayed with the LiveLabs assigned region highlighted.](images/console-home.png)

>**Note:** Bookmark the workshop page for quicker access.

## Task 2: Navigate to the Autonomous Database

1. You should be already logged in to the Console using the instructions in the **Task 1** in this lab.

2. Open the **Navigation** menu and click **Oracle Database**. Under **Oracle Database**, click **Autonomous Database**. The **Autonomous Databases** page should be displayed; however, your assigned resources for this workshop are all in your assigned LiveLabs compartment (that is displayed in the **Reservation Information** panel) and not in the **root** tenancy. The following expected warning message is displayed.

![Warning that you might get if you are in the root compartment and not in your own LiveLabs assigned compartment.](./images/wrong-compartment.png " ")

3. To select your assigned LiveLabs compartment, click the **Compartment** drop-down list in the **List Scope** section on the left. Enter your LiveLabs assigned compartment name in the **Compartment** text field to search for it which should look something like **LL#####-COMPARTMENT** where the **#####** is a unique five-digit number. Alternatively, you can drill-down on the **Livelabs** node and select your assigned compartment. When your assigned compartment is displayed in the list of compartments, select it. In addition, make sure that your LiveLabs assigned region from the **Run Workshop *workshop-name*** page is selected in Console's banner.

![The Data Catalogs page in your assigned LiveLabs compartment is displayed. The training-dcat-instance Data Catalog instance provided for you is displayed on this page.](./images/ll-select-compartment.png " ")

>**Note:** Refer to the **Reservation Information** panel that you can access from the **Run Workshop *workshop-name*** tab for information about your assigned resources.
![The LL assigned resources are displayed in the **Reservation Information** panel.](./images/ll-resources.png " ")

4. On the **Autonomous Databases** page, click your ADB instance.
![On the Autonomous Databases page, the Autonomous Database that is assigned to your LiveLabs workshop reservation is displayed.](./images/ll-adb-page.png " ")

5. On the **Autonomous Database details** page, click the **Database actions** drop-down list, and then click **SQL**.

![The Database Actions button is highlighted.](./images/sql.png " ")

You may now proceed to the next lab.

## Learn More

* [Oracle Cloud Infrastructure Documentation](https://docs.cloud.oracle.com/en-us/iaas/Content/GSG/Concepts/baremetalintro.htm)
* [Using Oracle Autonomous Database Serverless](https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/index.html)

## Acknowledgements

* **Author:** Killian Lynch, Oracle Database Product Manager
* **Contributors:**
* Mike Matthews, Autonomous Database Product Management
* Marty Gubar, Autonomous Database Product Management
* Lauran K. Serhal, Consulting User Assistance Developer
* **Last Updated By/Date:** Killian Lynch, April 2024
45 changes: 45 additions & 0 deletions db-23ai-fundamentals/intro/json-dv-intro-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Introduction

## About the Workshop

This workshop briefly introduces you to the JSON Duality View feature.

### **JSON Duality**

JSON Relational Duality is a landmark capability in Oracle Database 23ai providing game-changing flexibility and simplicity for Oracle Database developers. This breakthrough innovation overcomes the historical challenges developers have faced when building applications, using relational or document models.

“JSON Relational Duality in Oracle Database 23ai brings substantial simplicity and flexibility to modern app dev,” said Carl Olofson, research Vice President, Data Management Software, IDC. “It addresses the age-old object - relational mismatch problem, offering an option for developers to pick the best storage and access formats needed for each use case without having to worry about data structure, data mapping, data consistency, or performance tuning. No other specialized document databases offer such a revolutionary solution.”

JSON Relational Duality helps to converge the benefits of both document and relational worlds. Developers now get the flexibility and data access benefits of the JSON document model, plus the storage efficiency and power of the relational model. The new feature enabling this convergence is JSON Relational Duality View (Will be referred below as Duality View).

Key benefits of JSON Relational Duality:
- Experience extreme flexibility in building apps using Duality View. Developers can access the same data relationally or as hierarchical documents based on their use case and are not forced into making compromises because of the limitations of the underlying database. Build document-centric apps on relational data or create SQL apps on documents.
- Experience simplicity by retrieving and storing all the data needed for an app in a single database operation. Duality Views provide fully updateable JSON views over data. Apps can read a document, make necessary changes, and write the document back without worrying about underlying data structure, mapping, consistency, or performance tuning.
- Enable flexibility and simplicity in building multiple apps on same data. Developers can use the power of Duality View to define multiple JSON Views across overlapping groups of tables. This flexible data modeling makes building multiple apps against the same data easy and efficient.
- Duality Views eliminate the inherent problem of data duplication and data inconsistency in document databases. Duality Views are fully ACID (atomicity, consistency, isolation, durability) transactions across multiple documents and tables. It eliminates data duplication across documents data, whereas consistency is maintained automatically.
- Build apps that support high concurrency access and updates. Traditional locks don’t work well for modern apps. A new lock-free concurrency control provided with Duality View supports high concurrency updates. The new-lock free concurrency control also works efficiently for interactive applications since the data is not locked during human thinking time.

Estimated Time: 20 minutes

### **Objectives**

This workshop aims to provide hands-on experience with JSON-relational duality views, demonstrating how to get the strengths of both JSON and relational data models. You will learn how to create, query, and update JSON-relational duality views using SQL and REST.

### **Prerequisites**

This workhop assumes you have:

* Oracle Database 23ai



## **Learn More**

* [JSON Relational Duality: The Revolutionary Convergence of Document, Object, and Relational Models](https://blogs.oracle.com/database/post/json-relational-duality-app-dev)
* [JSON Duality View documentation](http://docs.oracle.com)
* [Blog: Key benefits of JSON Relational Duality] (https://blogs.oracle.com/database/post/key-benefits-of-json-relational-duality-experience-it-today-using-oracle-database-23c-free-developer-release)

## Acknowledgements
* **Author** - Kaylien Phan, William Masdon
* **Contributors** - David Start, Ranjan Priyadarshi
* **Last Updated By/Date** - Kaylien Phan, Database Product Management, April 2023
Loading

0 comments on commit 6806869

Please sign in to comment.