This is a PoC using ADB (Autonomous Database) and Generative AI from Oracle Cloud.
- Generate SQL queries from natural language
- Execute SQL queries on ADB
- Display results in a web interface
uv sync- Create databases using DDL
src/sql/oracle_ddl.sql - Migrate data from exported parquet files to ADB by running
uv run src/utils/import_parquet_to_oracle.py
- Create API Key at
https://cloud.oracle.com/identity/domains/my-profile/auth-tokens?region=ap-osaka-1 - Download the private key (.pem)
- Create folder
~/.ociif it doesn't exist, createconfigfile in the folder and add the following: (We can click on view configuration file button of that key)
[DEFAULT]
user=ocid1.user.oc1..aaaaaaaaavxuh54wqwjenxphssv3vey4ob37eci627kkyhnknktvtxq2s2ya
fingerprint=3b:37:91:d6:e7:f9:fa:be:f3:17:af:64:03:32:fa:36
tenancy=ocid1.tenancy.oc1..aaaaaaaacixtzv2xnngnowsyd37bncbkjatyig7bk32uldjvy6qq34zyapga
region=ap-singapore-1
key_file=<path to your private keyfile> # TODO
Each profile can be used to run different models, so that we can compare / test different models.
- Create Policy so that any users of ADB can use Generative AI Service with this Statement:
allow any-user to manage generative-ai-family in compartment okini-data-platform-poc
- Create Credential
BEGIN
DBMS_CLOUD.CREATE_CREDENTIAL(
credential_name => 'OCI_CRED',
user_ocid => 'ocid1.user.oc1..aaaaaaaaavxuh54wqwjenxphssv3vey4ob37eci627kkyhnknktvtxq2s2ya',
tenancy_ocid => 'ocid1.tenancy.oc1..aaaaaaaacixtzv2xnngnowsyd37bncbkjatyig7bk32uldjvy6qq34zyapga',
private_key => '-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
OCI_API_KEY',
fingerprint => '...'
);
END;
/
- Create Profile for each model
begin
-- Drop the profile in case it already exists
dbms_cloud_ai.drop_profile(
profile_name => 'genai_llama33',
force => true
); -- Create an AI profile that uses the default LLAMA model on OCI
dbms_cloud_ai.create_profile(
profile_name => 'genai_llama33',
attributes =>
'{"provider": "oci",
"credential_name": "OCI_CRED",
"region": "ap-osaka-1",
"comments":"true",
"object_list": [
{"owner": "POC", "name": "users"},
{"owner": "POC", "name": "booking_payment"},
{"owner": "POC", "name": "bookings_prod"},
{"owner": "POC", "name": "rating"},
{"owner": "POC", "name": "review"}
]
}'
);
end;
/