Skip to content

Commit 5b39752

Browse files
committed
init
1 parent 3e92546 commit 5b39752

25 files changed

+365
-894
lines changed

build_and_run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

3-
source env.properties
3+
source ~/Downloads/env.properties
4+
#source env.properties
45

56
#The following is temporary until release is available in maven and only required to be called once...
67
#mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=oci-java-sdk-generativeai-3.25.1-preview1-20230906.204234-1.jar

env.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
#export OBJECTSTORAGE_NAMESPACE="myobjectstorenamespacename"
1212
#export OBJECTSTORAGE_BUCKETNAME="myobjectstorebucketname"
1313
#export ORDS_ENDPOINT_ANALYZE_IMAGE_OBJECTSTORE="myordsendpoint"
14+
#export ORDS_ENDPOINT_ANALYZE_AUDIO_OBJECTSTORE="myordsendpoint"
1415
#export ORDS_ENDPOINT_EXECUTE_DYNAMIC_SQL="myordsendpoint"
15-
#export OCI_VISION_SERVICE_ENDPOINT="https://vision.aiservice.us-chicago-1.oci.oraclecloud.com"
16+
#export OCI_VISION_SERVICE_ENDPOINT="https://vision.aiservice.myregion.oci.oraclecloud.com"
17+
#export OCI_SPEECH_SERVICE_ENDPOINT="https://speech.aiservice.myregion.oci.oraclecloud.com"
18+
#export OCI_GENAI_SERVICE_ENDPOINT="https://vision.aiservice.us-chicago-1.oci.oraclecloud.com"
1619

1720
## The following are only applicable when using Kubernetes...
1821
#export KUBECONFIG=~/.kube/config-mykubeconfig
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
--run as aiuser
2+
3+
CREATE TABLE aivision_results
4+
(id RAW (16) NOT NULL,
5+
date_loaded TIMESTAMP WITH TIME ZONE,
6+
label varchar2(20),
7+
jsondata CLOB
8+
CONSTRAINT ensure_aivision_results_json CHECK (jsondata IS JSON));
9+
create index aivisionresultsindex on aivision_results(jsondata) indextype is ctxsys.context;
10+
--select index_name, index_type, status from user_indexes where index_name = 'AIVISIONAIRESULTSINDEX';
11+
--select idx_name, idx_table, idx_text_name from ctx_user_indexes;
12+
--select token_text from dr$aivisionresultsindex$i;
13+
14+
15+
CREATE TABLE aispeech_results
16+
(id RAW (16) NOT NULL,
17+
date_loaded TIMESTAMP WITH TIME ZONE,
18+
label varchar2(20),
19+
jsondata CLOB
20+
CONSTRAINT aispeech_results_json CHECK (jsondata IS JSON));
21+
create index aispeechresultsindex on aispeech_results(jsondata) indextype is ctxsys.context;
22+
--select index_name, index_type, status from user_indexes where index_name = 'AISPEECHRESULTSINDEX';
23+
--select idx_name, idx_table, idx_text_name from ctx_user_indexes;
24+
--select token_text from dr$aispeechresultsindex$i;
25+
26+
CREATE OR REPLACE FUNCTION execute_dynamic_sql(p_sql IN VARCHAR2) RETURN VARCHAR2 IS
27+
v_result VARCHAR2(4000);
28+
BEGIN
29+
EXECUTE IMMEDIATE p_sql INTO v_result;
30+
RETURN v_result;
31+
EXCEPTION
32+
WHEN OTHERS THEN
33+
RETURN SQLERRM;
34+
END execute_dynamic_sql;
35+
/
36+
37+
BEGIN
38+
ORDS.ENABLE_OBJECT(
39+
P_ENABLED => TRUE,
40+
P_SCHEMA => 'AIUSER',
41+
P_OBJECT => 'EXECUTE_DYNAMIC_SQL',
42+
P_OBJECT_TYPE => 'FUNCTION',
43+
P_OBJECT_ALIAS => 'EXECUTE_DYNAMIC_SQL',
44+
P_AUTO_REST_AUTH => FALSE
45+
);
46+
COMMIT;
47+
END;
48+
49+
--Easy Text Search over Multiple Tables and Views with DBMS_SEARCH in 23c
50+
--workshop: https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/view-workshop?wid=3721
51+
52+
BEGIN
53+
dbms_cloud.create_credential (
54+
credential_name => 'OCI_KEY_CRED',
55+
user_ocid => 'ocid1.user.oc1..[youruserocid]',
56+
tenancy_ocid => 'ocid1.tenancy.oc1..[yourtenancyocid]',
57+
private_key => '[yourprivatekey you can read this from file or put the contents of your pem without header, footer, and line wraps]'
58+
fingerprint => '[7f:yourfingerprint]'
59+
);
60+
END;
61+
62+
63+
create or replace FUNCTION call_analyze_image_api_objectstore (
64+
p_endpoint VARCHAR2,
65+
p_compartment_ocid VARCHAR2,
66+
p_namespaceName VARCHAR2,
67+
p_bucketName VARCHAR2,
68+
p_objectName VARCHAR2,
69+
p_featureType VARCHAR2,
70+
p_label VARCHAR2
71+
) RETURN CLOB IS
72+
resp DBMS_CLOUD_TYPES.resp;
73+
json_response CLOB;
74+
BEGIN
75+
resp := DBMS_CLOUD.send_request(
76+
credential_name => 'OCI_KEY_CRED',
77+
uri => p_endpoint || '/20220125/actions/analyzeImage',
78+
method => 'POST',
79+
body => UTL_RAW.cast_to_raw(
80+
JSON_OBJECT(
81+
'features' VALUE JSON_ARRAY(
82+
JSON_OBJECT('featureType' VALUE p_featureType)
83+
),
84+
'image' VALUE JSON_OBJECT(
85+
'source' VALUE 'OBJECT_STORAGE',
86+
'namespaceName' VALUE p_namespaceName,
87+
'bucketName' VALUE p_bucketName,
88+
'objectName' VALUE p_objectName
89+
),
90+
'compartmentId' VALUE p_compartment_ocid
91+
)
92+
)
93+
);
94+
json_response := DBMS_CLOUD.get_response_text(resp);
95+
-- dbms_output.put_line('json_response: ' || json_response);
96+
INSERT INTO aivision_results VALUES (SYS_GUID(), SYSTIMESTAMP, p_label, json_response );
97+
RETURN json_response;
98+
EXCEPTION
99+
WHEN OTHERS THEN
100+
RAISE;
101+
END call_analyze_image_api_objectstore;
102+
/
103+
104+
BEGIN
105+
ORDS.ENABLE_OBJECT(
106+
P_ENABLED => TRUE,
107+
P_SCHEMA => 'AIUSER',
108+
P_OBJECT => 'CALL_ANALYZE_IMAGE_API_OBJECTSTORE',
109+
P_OBJECT_TYPE => 'FUNCTION',
110+
P_OBJECT_ALIAS => 'call_analyze_image_api_objectstore',
111+
P_AUTO_REST_AUTH => FALSE
112+
);
113+
COMMIT;
114+
END;
115+
/

sql/conversation.sql

Lines changed: 0 additions & 27 deletions
This file was deleted.

sql/create_aijs_user.sql

Lines changed: 0 additions & 23 deletions
This file was deleted.

sql/dbms_sendrequest_speechai_call_objectstore_function.sql

Lines changed: 0 additions & 54 deletions
This file was deleted.

sql/dbms_sendrequest_visionai_call_inline_function.sql

Lines changed: 0 additions & 49 deletions
This file was deleted.

sql/dbms_sendrequest_visionai_call_objectstore_function.sql

Lines changed: 0 additions & 53 deletions
This file was deleted.

sql/mlejs_openai_sproc.sql

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)