Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e2572dc
My changes1
lfoinding Mar 28, 2025
b73bf77
Json challenge
lfoinding Mar 28, 2025
0888d81
Merge remote-tracking branch 'upstream/main'
lfoinding Mar 31, 2025
08af45f
New Json handson
lfoinding Mar 31, 2025
930a165
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 1, 2025
357ffec
Complete
lfoinding Apr 1, 2025
b2f4f3f
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 7, 2025
618db61
Business Requirements updates
lfoinding Apr 7, 2025
8a7b50d
Manifest
lfoinding Apr 7, 2025
254e297
Merge branch 'main' into main
lfoinding Apr 7, 2025
99fd48b
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 14, 2025
92ded22
Feedback updates
lfoinding Apr 14, 2025
5a68955
Editing-out name
lfoinding Apr 16, 2025
775d6a7
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 16, 2025
f95336c
Updating Dom's name
lfoinding Apr 16, 2025
9cd1f4b
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 16, 2025
67b9ee3
updated screenshots for Dom
lfoinding Apr 16, 2025
a4e364a
Merge branch 'main' into main
lfoinding Apr 17, 2025
ee1cead
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 23, 2025
da2bc2f
New Manifest for paramount
lfoinding Apr 23, 2025
4d450ef
Removed est. time in Intro
lfoinding Apr 25, 2025
05c16f1
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 25, 2025
2d2f3f0
Adding Feature PM's
lfoinding Apr 25, 2025
0fbc825
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 29, 2025
108e275
updated introduction.md
lfoinding Apr 29, 2025
74476c9
Merge remote-tracking branch 'upstream/main'
lfoinding Apr 29, 2025
cb600ec
Added par file (zip file of code)
lfoinding Apr 30, 2025
b95e923
Merge remote-tracking branch 'upstream/main'
lfoinding May 9, 2025
5863e31
Merge remote-tracking branch 'upstream/main'
lfoinding May 13, 2025
fee36be
Merge remote-tracking branch 'upstream/main'
lfoinding Jun 2, 2025
409809c
adding videos
lfoinding Jun 3, 2025
90c4280
#4195
lfoinding Jun 26, 2025
3f53bb4
Merge remote-tracking branch 'upstream/main'
lfoinding Jul 1, 2025
6275a8c
WMS: 11850
lfoinding Jul 2, 2025
43ffff6
Merge remote-tracking branch 'upstream/main'
lfoinding Jul 2, 2025
487767f
Merge remote-tracking branch 'upstream/main'
lfoinding Aug 14, 2025
1a6dd13
Merge branch 'oracle-livelabs:main' into main
lfoinding Aug 15, 2025
1698be3
11850: Finance lab 4 update
lfoinding Sep 12, 2025
7640744
Lab 4 RAG Updated
lfoinding Sep 14, 2025
59accd6
Merge remote-tracking branch 'upstream/main'
lfoinding Sep 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
146 changes: 146 additions & 0 deletions dev-ai-app-dev-finance/dev-guide-ai-finance/ai-answers/ai-answers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# Code with AI Vector Search step-by-step

## Introduction

In this coding challenge, you’ll focus on **AI Vector Search**. Your mission is to implement a key update to change the way similarities are calculated, improving the accuracy of predictions.

At SeerEquites, the data science team has been using Cosine similarity to assess similarities between customer profiles and predict loan risks. While effective in some contexts, the team recently realized that Cosine similarity wasn’t capturing the full picture of their customers financial profiles.

**Why switch to Euclidean distance?**

Cosine similarity is great when you care about the pattern or direction of someone’s data — not how big or small the numbers are. But in finance, the actual size of the numbers often matters a lot.

Let’s say you’re comparing two customers based on their debt, income, and credit usage. These numbers matter significantly, and big differences can indicate very different levels of risk.

Here’s an example:

* Both customers have the same debt-to-income ratio of 2:1.

* But one earns $20,000 a year, while the other earns $200,000.

Cosine similarity would say these customers are quite similar, because their ratios follow the same pattern. But that’s misleading — the person earning $20,000 is much riskier.

That’s where Euclidean distance comes in. Unlike Cosine similarity, Euclidean distance looks at the actual difference in the numbers. In this case, it would correctly flag that these customers are not similar in a meaningful way, since the scale of their incomes is vastly different.

In finance, where decisions are often made based on key figures like income, debt, and credit usage, Euclidean distance is often a better tool. It takes the size of the numbers into account, which is crucial for making accurate risk predictions.

In this lab, you’ll update the code to switch the similarity measure from Cosine to Euclidean. This change will improve the system’s ability to assess loan risks more accurately, providing more reliable insights for decision-making.

This is your opportunity to sharpen your skills, explore the power of AI-driven search, and make a meaningful impact on a application. Let’s get started!

Estimated Time: 30 minutes

### Objectives

In this lab, you will:
* Enhance your understanding of AI Vector Search by applying it to a developer coding challenge.
* Gain hands-on experience with integrating AI Vector Search and refining application features to meet specific development requirements.

### Prerequisites

This lab assumes you have:
* An Oracle Cloud account
* Successfully completed Lab 1: Run the Demo
* Successfully completed Lab 3: Connect to Development Environment

## Task 1: Challenge Requirements

Based on the data scientists' evaluation, the company has decided to switch from using Cosine similarity to Euclidean distance. This change aims to enhance the system’s ability to assess loan risks more accurately, ultimately providing more reliable insights to support better decision-making.

Follow the prompts below to update the code based on the new company standard.

## Task 2: Launch the Application

1. Select the **Launcher** tab and open the **terminal**

![Open Terminal](./images/open-terminal.png " ")

2. Copy the ./run.sh command and paste it into the terminal.

````bash
$<copy>
./run.sh
</copy>
````

3. Click the URL displayed in the terminal to launch the SeerEquities Loan Management application.

![Click the URL](./images/click-url.png " ")

4. Enter in a username and click **Login**.

![Login](./images/login.png " ")

## Task 3: View the current AI chat bot return variables using Cosine

1. On the Dashboard page, from the pending review list, select the Customer ID for **James Smith**.

![Select James Smith](./images/james-smith.png " ")

2. This will display the customers loan application details. In approximately 15 seconds, the AI generated loan recommendations will be displayed.

![James Smith AI generated recommendations](./images/ai-exercise.png " ")

3. Ask the following question to the AI Chat bot.

````text
<copy>
What about a 4th loan?
</copy>
````

Note how the return variables are shown:

![AI Loan chatbot](./images/cosine-ai.png " ")

## Task 4: Modify the Customers.py File

1. Click **Pages**.

![Click Pages](./images/click-pages.png " ")

2. Select the **Customers.py** file.

![Click Customers.py](./images/customers-py.png " ")

3. Update the Customers.py file to make the necessary changes in the code at lines 845 and 846

![Update Customers.py](./images/euclidean-2.png " ")

4. Save the Customers.py file.

![Save Customers.py](./images/save-customers-py.png " ")

## Task 5: View results in the Loan application

1. On the Dashboard page, from the pending review list, select the Customer ID for **James Smith**.

![Select James Smith](./images/james-smith.png " ")

2. This will display the customers loan application details. In approximately 15 seconds, the AI generated loan recommendations will be displayed.

![James Smith AI generated recommendations](./images/ai-exercise.png " ")

3. Ask the following question to the AI Chat bot.

````text
<copy>
What about a 4th loan?
</copy>
````
4. View the new prompt return from the AI chat bot

![AI Chatbot](./images/euclidean-2-ai.png " ")



**Congratulations, you have successfully completed the AI Vector Search Challenge!** By switching to Euclidean distance, SeerEquites ensures more precise loan risk evaluations and improves the overall effectiveness of their loan management system.

## Learn More

* [Oracle Database 23ai Documentation](https://docs.oracle.com/en/database/oracle/oracle-database/23/)

## Acknowledgements
* **Authors** - Linda Foinding, Francis Regalado
* **Contributors** - Kamryn Vinson, Eddie Ambler, Kevin Lazarz
* **Last Updated By/Date** - Kamryn Vinson, April 2025
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/* NOTE: Files cannot contain empty lines (line breaks) */
/* Specify the base URL that you copied from your files in OCI Object Storage in the define base_URL line below*/
/* change idthydc0kinr to your real namespace. The name is case-sensitive. */
/* change ADWCLab to your real bucket name. The name is case-sensitive. */
/* change us-phoenix-1 to your real region name. The name is case-sensitive. */
/* you can find these values on the OCI Console .. Storage .. Object Storage screen */
set define on
define base_URL='https://objectstorage.us-phoenix-1.oraclecloud.com/n/idthydc0kinr/b/ADWCLab/o'
/* copy Channels table */
begin
dbms_cloud.copy_data(
table_name =>'CHANNELS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/chan_v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true')
);
end;
/
/* copy Countries table */
begin
dbms_cloud.copy_data(
table_name =>'COUNTRIES',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/coun_v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true')
);
end;
/
/* Copy customers */
begin
dbms_cloud.copy_data(
table_name =>'CUSTOMERS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/cust1v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true', 'dateformat' value 'YYYY-MM-DD-HH24-MI-SS')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'SUPPLEMENTARY_DEMOGRAPHICS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/dem1v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'SALES',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/dmsal_v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true', 'dateformat' value 'YYYY-MM-DD')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'PRODUCTS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/prod1v3.dat',
format => json_object('delimiter' value '|', 'quote' value '^', 'ignoremissingcolumns' value 'true', 'dateformat' value 'YYYY-MM-DD-HH24-MI-SS', 'blankasnull' value 'true')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'PROMOTIONS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/prom1v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true', 'dateformat' value 'YYYY-MM-DD-HH24-MI-SS', 'blankasnull' value 'true')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'SALES',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/sale1v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true', 'dateformat' value 'YYYY-MM-DD', 'blankasnull' value 'true')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'TIMES',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/time_v3.dat',
format => json_object('ignoremissingcolumns' value 'true', 'removequotes' value 'true', 'dateformat' value 'YYYY-MM-DD-HH24-MI-SS', 'blankasnull' value 'true')
);
end;
/
begin
dbms_cloud.copy_data(
table_name =>'COSTS',
credential_name =>'OBJ_STORE_CRED',
file_uri_list =>'&base_URL/costs.dat',
format => json_object('ignoremissingcolumns' value 'true', 'dateformat' value 'YYYY-MM-DD', 'blankasnull' value 'true')
);
end;
/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading