add OCI GenAI game mention extraction function

This commit is contained in:
devmrko
2026-07-27 14:12:37 +09:00
parent bd651eb66f
commit ed3139f9f7

View File

@@ -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;
/