From ed3139f9f79cdd13c44871d6af6c4f8fedc08bc3 Mon Sep 17 00:00:00 2001 From: devmrko Date: Mon, 27 Jul 2026 14:12:37 +0900 Subject: [PATCH] add OCI GenAI game mention extraction function --- sql/adb/80_sg_game_mention_extract.sql | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sql/adb/80_sg_game_mention_extract.sql diff --git a/sql/adb/80_sg_game_mention_extract.sql b/sql/adb/80_sg_game_mention_extract.sql new file mode 100644 index 0000000..871c7a7 --- /dev/null +++ b/sql/adb/80_sg_game_mention_extract.sql @@ -0,0 +1,20 @@ +-- OCI GenAI chat extraction. This function returns JSON only; it never chooses tables. +CREATE OR REPLACE FUNCTION sg_game_extract_mentions(p_question IN CLOB) + RETURN CLOB AUTHID DEFINER +IS + v_prompt CLOB; + v_result CLOB; +BEGIN + v_prompt := 'Extract only game-name mentions from the user question. ' + || 'Return exactly one JSON object with keys game_mentions (array of strings) ' + || 'and scope_hint (GLOBAL, SINGLE_GAME, MULTI_GAME, ALL_GAMES, UNKNOWN). ' + || 'Do not resolve names to IDs and do not generate SQL. Question: ' + || DBMS_LOB.SUBSTR(p_question, 4000, 1); + v_result := DBMS_CLOUD_AI.GENERATE( + prompt => v_prompt, + profile_name => 'SGMP_POC_OCI_GPT54MINI', + action => 'chat' + ); + RETURN v_result; +END; +/