Skip to content

upgrading the Select-AI-demonstration and oci-genai-demonstration sol… #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2022, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

.terraform
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--

# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2023 Oracle and/or its affiliates. All rights reserved.
Copyright © 2025 Oracle and/or its affiliates. All rights reserved.

The Universal Permissive License (UPL), Version 1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ Query and save the recommendations

Oracle Cloud provides an amazing platform to productively deliver secure, insightful, scalable and performant solutions. MovieStream designed their solution leveraging the world class Oracle Autonomous Database and Oracle Cloud Infrastructure (OCI) Data Lake services. Their data architecture is following the Oracle Reference Architecture [_Enterprise Data Warehousing - an Integrated Data Lake_](https://docs.oracle.com/en/solutions/oci-curated-analysis/index.html) - which is used by Oracle customers around the world. It's worthwhile to review the architecture so you can understand the value of integrating the data lake and data warehouse - as it enables you to answer more complex questions using all your data.

## Important - please deploy the solution in one of the listed regions below as the GenAI it's only available in this regions. If you deploy it in other regions, the solution will not work. If you don't have any of the regions available in your tenancy, please subscribe to one of them.


Some regions don't offer all the models. See the region for each pretrained model to find out which models are available in a region near you.

| Region Name | Location | Region Identifier | Region Key |
|--------------------------|----------|-------------------|------------|
| Brazil East (Sao Paulo) | Sao Paulo | sa-saopaulo-1 | GRU |
| Germany Central (Frankfurt) | Frankfurt | eu-frankfurt-1 | FRA |
| Japan Central (Osaka) | Osaka | ap-osaka-1 | KIX |
| UK South (London) | London | uk-london-1 | LHR |
| US Midwest (Chicago) | Chicago | us-chicago-1 | ORD |


## <a name="deliverables"></a>Deliverables
----------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

data "oci_identity_availability_domains" "ADs" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

# Create ADW Database with Endpoint in private subnet or public ADW
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

locals {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

output "atp_db_id" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

variable "adw_params" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

# Autonomous Database Outputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

terraform {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

resource "null_resource" "sqlcl-create-usr" {
Expand All @@ -8,7 +8,8 @@ resource "null_resource" "sqlcl-create-usr" {
echo 'Download the apex applications'
chmod 777 ./scripts/
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f101.sql -P ./scripts/
# wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f101.sql -P ./scripts/
wget https://github.com/oracle-devrel/oracle-autonomous-database-samples/blob/main/apex/select-ai-chat/f101.sql?raw=true -P ./scripts/
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f100-genai-project.sql -P ./scripts/
# install the data
Expand All @@ -25,6 +26,9 @@ resource "null_resource" "sqlcl-create-usr" {
sql -cloudconfig wallet_${var.db_name}.zip moviestream/watchS0meMovies#@'${local.conn_db}' @./scripts/install-apex-app.sql
rm -rf tables.sql
rm -rf ./scripts/f100-genai-project.sql
rm -rf ./scripts/f101.sql?raw=true
rm -rf ./scripts/install-apex-app.sql
EOT
}
depends_on = [module.adb]
Expand All @@ -33,4 +37,9 @@ depends_on = [module.adb]
resource "local_file" "this" {
content = templatefile("./scripts/tables.sql.tmpl", { tag = var.tag, run_post_load_procedures = var.run_post_load_procedures, llm_secret = var.llm_secret })
filename = "./tables.sql"
}

resource "local_file" "this2" {
content = templatefile("./scripts/install-apex-app.sql.tmpl", { region = var.region })
filename = "./scripts/install-apex-app.sql"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

title: "Deploy ChatDB - Autonomous Database Select AI demonstration"
Expand Down Expand Up @@ -91,7 +91,7 @@ variables:
enum:
- LICENSE_INCLUDED
- BRING_YOUR_OWN_LICENSE
default: LICENSE_INCLUDED
default: BRING_YOUR_OWN_LICENSE
required: true
visible:
eq:
Expand All @@ -109,8 +109,8 @@ variables:
description: "A valid Oracle Database version for Autonomous Database"
type: enum
enum:
- "19c"
default: "19c"
- "23ai"
default: "23ai"
required: true
visible: true
db_size_in_tbs:
Expand Down Expand Up @@ -165,7 +165,7 @@ variables:
title: The number of ECPUs cores to be made available to the database
description: "The number of ECPU cores to enable. For ECPUs count needs to be minimum 2 and maximum 512 ECPUs"
type: string
default: 4
default: 2
required: true
visible:
eq:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- **Copyright © 2023, Oracle and/or its affiliates.
-- **Copyright © 2025, Oracle and/or its affiliates.
-- **All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BEGIN

END;
/
@./scripts/f101.sql
@./scripts/f101.sql?raw=true

-- GenAI Projects App
BEGIN
Expand All @@ -38,23 +38,25 @@ END;
/
@./scripts/f100-genai-project.sql

-- Setup Select AI. Create 2 profiles. One for chat and the other for GenAI projects
-- Setup Select AI. Create profile.
declare
v_region varchar2(100) := '${region}'; -- Default region
begin
admin.workshop.write('Setup ai profile for chat', 2);
admin.workshop.write('Setup ai profile', 2);

-- Chat
dbms_cloud_ai.drop_profile(
profile_name => 'openai_gpt35',
profile_name => 'genai',
force => true
);

dbms_cloud_ai.create_profile(
profile_name => 'openai_gpt35',
profile_name => 'genai',
attributes =>
'{"provider": "openai",
"credential_name": "OPENAI_CRED",
'{"provider": "oci",
"credential_name": "OCI$RESOURCE_PRINCIPAL",
"comments":"true",
"temperature":0.2,
"region":"' || v_region || '",
"object_list": [
{"owner": "MOVIESTREAM", "name": "GENRE"},
{"owner": "MOVIESTREAM", "name": "CUSTOMER"},
Expand All @@ -64,23 +66,7 @@ begin
{"owner": "MOVIESTREAM", "name": "ACTORS"}
]
}'
);

admin.workshop.write('Setup GenAI projects AI profile', 2);

-- GenAI projects
dbms_cloud_ai.drop_profile(
profile_name => 'genai',
force => true
);

dbms_cloud_ai.create_profile(
profile_name => 'genai',
attributes =>
'{"provider": "oci",
"credential_name": "OCI$RESOURCE_PRINCIPAL"
}'
);
);

end;
/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- **Copyright © 2023, Oracle and/or its affiliates.
-- **Copyright © 2025, Oracle and/or its affiliates.
-- **All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.

-- Tables will be installed in the current schema
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2023, Oracle and/or its affiliates.
# Copyright © 2025, Oracle and/or its affiliates.
# All rights reserved. Licensed under the Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl.


Expand All @@ -13,12 +13,12 @@ variable "tenancy_ocid" {

variable "region" {
type = string
# default = ""
default = "us-chicago-1"
}

variable "compartment_id" {
type = string
# default = ""
default = ""
}

variable "user_ocid" {
Expand Down Expand Up @@ -55,7 +55,7 @@ variable "db_compute_model" {

variable "db_compute_count" {
type = number
default = 4
default = 2
}

variable "db_size_in_tbs" {
Expand All @@ -70,7 +70,7 @@ variable "db_workload" {

variable "db_version" {
type = string
default = "19c"
default = "23ai"
}

variable "db_enable_auto_scaling" {
Expand All @@ -85,7 +85,7 @@ variable "db_is_free_tier" {

variable "db_license_model" {
type = string
default = "LICENSE_INCLUDED"
default = "BRING_YOUR_OWN_LICENSE"
}

variable "db_data_safe_status" {
Expand All @@ -110,7 +110,8 @@ variable "db_database_management_status" {

variable "llm_secret" {
type = string
default = "null"
# default = "null"
default = ""
}

variable "tag" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ Query and save the recommendations
Oracle Cloud provides an amazing platform to productively deliver secure, insightful, scalable and performant solutions. MovieStream designed their solution leveraging the world class Oracle Autonomous Database and Oracle Cloud Infrastructure (OCI) Data Lake services. Their data architecture is following the Oracle Reference Architecture [_Enterprise Data Warehousing - an Integrated Data Lake_](https://docs.oracle.com/en/solutions/oci-curated-analysis/index.html) - which is used by Oracle customers around the world. It's worthwhile to review the architecture so you can understand the value of integrating the data lake and data warehouse - as it enables you to answer more complex questions using all your data.


## Important - please deploy the solution in one of the listed regions below as the GenAI it's only available in this regions. If you deploy it in other regions, the solution will not work. If you don't have any of the regions available in your tenancy, please subscribe to one of them.


Some regions don't offer all the models. See the region for each pretrained model to find out which models are available in a region near you.

| Region Name | Location | Region Identifier | Region Key |
|--------------------------|----------|-------------------|------------|
| Brazil East (Sao Paulo) | Sao Paulo | sa-saopaulo-1 | GRU |
| Germany Central (Frankfurt) | Frankfurt | eu-frankfurt-1 | FRA |
| Japan Central (Osaka) | Osaka | ap-osaka-1 | KIX |
| UK South (London) | London | uk-london-1 | LHR |
| US Midwest (Chicago) | Chicago | us-chicago-1 | ORD |



## <a name="deliverables"></a>Deliverables
----------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ resource "null_resource" "sqlcl-create-usr" {

echo 'Download the apex applications'
chmod 777 ./scripts/
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f101.sql -P ./scripts/
# wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f101.sql -P ./scripts/
wget https://github.com/oracle-devrel/oracle-autonomous-database-samples/blob/main/apex/select-ai-chat/f101.sql?raw=true -P ./scripts/
wget https://objectstorage.us-ashburn-1.oraclecloud.com/p/6Oy9O8JVmddTzPQ8PsavtpzByQhjo4jGP1mRC3MK3o7QE7vGXKb8573-6etTdGUy/n/c4u04/b/building_blocks_utilities/o/select-ai-apex-demo/f100-genai-project.sql -P ./scripts/

# install the data
Expand All @@ -24,7 +25,9 @@ resource "null_resource" "sqlcl-create-usr" {
echo 'Start running install-apex-app.sql script to install the apex app'
sql -cloudconfig wallet_${var.db_name}.zip moviestream/watchS0meMovies#@'${local.conn_db}' @./scripts/install-apex-app.sql

rm -rf tables.sql
rm -rf tables.sql
rm -rf ./scripts/f100-genai-project.sql
rm -rf ./scripts/f101.sql?raw=true
EOT
}
depends_on = [module.adb]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ variables:
enum:
- LICENSE_INCLUDED
- BRING_YOUR_OWN_LICENSE
default: LICENSE_INCLUDED
default: BRING_YOUR_OWN_LICENSE
required: true
visible:
eq:
Expand All @@ -108,9 +108,8 @@ variables:
description: "A valid Oracle Database version for Autonomous Database"
type: enum
enum:
- "19c"
- "23ai"
default: "19c"
default: "23ai"
required: true
visible: true
db_size_in_tbs:
Expand Down Expand Up @@ -165,7 +164,7 @@ variables:
title: The number of ECPUs cores to be made available to the database
description: "The number of ECPU cores to enable. For ECPUs count needs to be minimum 2 and maximum 512 ECPUs"
type: string
default: 4
default: 2
required: true
visible:
eq:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ BEGIN

END;
/
@./scripts/f101.sql
@./scripts/f101.sql?raw=true

-- GenAI Projects App
BEGIN
Expand Down
Loading