add OCI GenAI game mention extraction function
This commit is contained in:
20
database/adb/80_sg_game_mention_extract.sql
Normal file
20
database/adb/80_sg_game_mention_extract.sql
Normal 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;
|
||||||
|
/
|
||||||
Reference in New Issue
Block a user