refs #739: generalize game target profile guidance
This commit is contained in:
31
database/adb/84_sgmp_none_scope_common_object_guidance.sql
Normal file
31
database/adb/84_sgmp_none_scope_common_object_guidance.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
-- NONE means "no selected game", not "no executable query".
|
||||
-- Keep the boundary example scoped to its logical object role so it cannot
|
||||
-- be generalized to approved common-object questions.
|
||||
|
||||
UPDATE sg_qa_vector_example
|
||||
SET object_role = 'GAME_USER_MASTER',
|
||||
answer_text = 'This boundary applies only to a game-scoped user-master operation. '
|
||||
|| 'When no game identifier is resolved, do not select a prefix-specific user-master object. '
|
||||
|| 'This does not prohibit an approved common-object query.',
|
||||
inspection_note = 'Canonical boundary for an unscoped game-user-master request. '
|
||||
|| 'It applies only to GAME_USER_MASTER and must not suppress common-object queries.'
|
||||
WHERE example_id = 5
|
||||
AND reference_kind = 'NO_TARGET';
|
||||
|
||||
-- Populate logical roles from verified SQL. This is prompt metadata only;
|
||||
-- runtime physical-object selection remains governed by the query plan.
|
||||
UPDATE sg_qa_vector_example
|
||||
SET object_role = CASE
|
||||
WHEN REGEXP_LIKE(answer_sql, 'COMN_SALES_TXN', 'i') THEN 'SALES_TRANSACTION'
|
||||
WHEN REGEXP_LIKE(answer_sql, 'COMN_REFUND_TXN', 'i') THEN 'REFUND_TRANSACTION'
|
||||
WHEN REGEXP_LIKE(answer_sql, 'COMN_CHARACTER_MST', 'i') THEN 'GAME_CHARACTER_MASTER'
|
||||
WHEN REGEXP_LIKE(answer_sql, 'COMN_USER_MST', 'i') THEN 'GAME_USER_MASTER'
|
||||
ELSE object_role
|
||||
END
|
||||
WHERE reference_status = 'APPROVED'
|
||||
AND object_role IS NULL;
|
||||
|
||||
COMMENT ON COLUMN sg_qa_vector_example.object_role IS
|
||||
'Logical business object role used to bound Few-shot interpretation. It is not a runtime physical-object selector.';
|
||||
|
||||
COMMIT;
|
||||
39
database/adb/85_sgmp_no_target_null_value_template.sql
Normal file
39
database/adb/85_sgmp_no_target_null_value_template.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
-- A no-target aggregate is a successful empty-value result, not a no-row
|
||||
-- execution failure. Keep the output alias from the verified logical metric.
|
||||
|
||||
DECLARE
|
||||
v_input CLOB;
|
||||
v_embedding VECTOR;
|
||||
BEGIN
|
||||
SELECT TO_CLOB('Question: ') || question
|
||||
|| TO_CLOB(CHR(10) || 'Answer SQL: SELECT CAST(NULL AS NUMBER) AS "USER_COUNT" FROM DUAL')
|
||||
|| TO_CLOB(CHR(10) || 'Answer: This boundary applies only to a game-scoped user-master operation. '
|
||||
|| 'When no game identifier is resolved, do not select a prefix-specific user-master object. '
|
||||
|| 'Return USER_COUNT as NULL. This does not prohibit an approved common-object query.')
|
||||
INTO v_input
|
||||
FROM sg_qa_vector_example
|
||||
WHERE example_id = 5;
|
||||
v_embedding := DBMS_VECTOR.UTL_TO_EMBEDDING(
|
||||
v_input,
|
||||
JSON(sg_qa_vector_params('search_document'))
|
||||
);
|
||||
|
||||
UPDATE sg_qa_vector_example
|
||||
SET answer_sql = 'SELECT CAST(NULL AS NUMBER) AS "USER_COUNT" FROM DUAL',
|
||||
answer_text = 'This boundary applies only to a game-scoped user-master operation. '
|
||||
|| 'When no game identifier is resolved, do not select a prefix-specific user-master object. '
|
||||
|| 'Return USER_COUNT as NULL. This does not prohibit an approved common-object query.',
|
||||
embedding_input = v_input,
|
||||
embedding = v_embedding,
|
||||
embedding_model = 'cohere.embed-v4.0',
|
||||
inspection_note = 'Canonical GAME_USER_MASTER boundary: no game target returns a NULL metric value, '
|
||||
|| 'not an execution error and not a default game selection.',
|
||||
verified_at = SYSTIMESTAMP,
|
||||
verified_by = 'SGMP_POC_REVIEW'
|
||||
WHERE example_id = 5
|
||||
AND reference_status = 'APPROVED'
|
||||
AND reference_kind = 'NO_TARGET'
|
||||
AND object_role = 'GAME_USER_MASTER';
|
||||
COMMIT;
|
||||
END;
|
||||
/
|
||||
18
database/adb/86_sgmp_game_scope_profile_guidance.sql
Normal file
18
database/adb/86_sgmp_game_scope_profile_guidance.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- General target-contract guidance belongs to the Select AI profile, not application branches.
|
||||
-- It contains no current game, prefix, ID, or physical object name.
|
||||
|
||||
BEGIN
|
||||
DBMS_CLOUD_AI.SET_ATTRIBUTE(
|
||||
profile_name => 'SGMP_POC_OCI_GPT54MINI',
|
||||
attribute_name => 'additional_instructions',
|
||||
attribute_value => q'~Generate Oracle SQL only for the listed approved objects. Do not reference external tables. Use English aliases only. Use database comments and annotations as the source of business rules.
|
||||
|
||||
When an authoritative game query plan is supplied in the user request, use its targets and statuses as the only game-scope source; do not independently rematch a game, infer a default game, or substitute one target's object for another. A plan with no selected game does not by itself prohibit a query: use an approved common object when it can answer the operation. If an operation inherently requires a game-scoped logical object and the relevant plan target is unresolved or its physical object is unavailable, return an appropriate zero-row result. A zero-row result is not a synthetic row containing a NULL value and is not an execution failure. For multiple or all resolved targets, use the supplied target identifiers to group a common object when applicable, or combine only the supplied available objects. Never invent identifiers, prefixes, or physical object names.~'
|
||||
);
|
||||
END;
|
||||
/
|
||||
|
||||
SELECT attribute_name, attribute_value
|
||||
FROM user_cloud_ai_profile_attributes
|
||||
WHERE profile_name = 'SGMP_POC_OCI_GPT54MINI'
|
||||
AND attribute_name = 'additional_instructions';
|
||||
Reference in New Issue
Block a user