Adjust relationship prompt to infer connections from character traits
This commit is contained in:
parent
10a85e76d6
commit
49a86c622a
1 changed files with 12 additions and 9 deletions
|
|
@ -36,18 +36,21 @@ ENTITY_EXTRACT_PROMPT = (
|
|||
)
|
||||
|
||||
RELATIONSHIP_EXTRACT_PROMPT = (
|
||||
"You are a knowledge graph relationship extraction engine. Given a text section, a list of known entities, "
|
||||
"and an ontology schema, extract all relationships between the entities.\n\n"
|
||||
"ONTOLOGY SCHEMA (edge types):\n%s\n\n"
|
||||
"You are a knowledge graph relationship inference engine. Given a text section describing characters/entities "
|
||||
"in a social simulation, a list of known entities, and relationship types, infer all plausible relationships.\n\n"
|
||||
"RELATIONSHIP TYPES:\n%s\n\n"
|
||||
"KNOWN ENTITIES:\n%s\n\n"
|
||||
"RULES:\n"
|
||||
"1. Find relationships between the known entities that match the edge_types defined above.\n"
|
||||
"2. Each relationship needs: name (must match an edge_type name), source (entity name), target (entity name), "
|
||||
"fact (1 sentence describing the specific relationship found in the text).\n"
|
||||
"1. Infer relationships between the known entities based on their described traits, roles, goals, and behaviors.\n"
|
||||
"2. Each relationship needs: name (must match a relationship type name above), source (entity name), target (entity name), "
|
||||
"fact (1 sentence explaining WHY this relationship is likely based on the text).\n"
|
||||
"3. Both source and target MUST be from the known entities list.\n"
|
||||
"4. Only extract relationships explicitly stated or strongly implied in the text.\n"
|
||||
"5. Extract ALL relationships you can find — be thorough.\n"
|
||||
"6. If no relationships are found, return an empty array.\n\n"
|
||||
"4. Include both explicit relationships AND strongly implied ones based on complementary/conflicting traits.\n"
|
||||
" Examples of inference: if player A 'trades supplies' and player B 'buys tools', infer TRADE_WITH.\n"
|
||||
" If player A 'mediates conflicts' and player B 'causes chaos', infer OPPOSES.\n"
|
||||
" If two players share goals or would naturally work together, infer COLLABORATES_WITH.\n"
|
||||
"5. Be thorough — extract as many plausible relationships as the text supports.\n"
|
||||
"6. Do NOT invent relationships with no textual basis. Each fact must reference something from the text.\n\n"
|
||||
'Return JSON: a single key "relationships" with an array of objects, each having keys: name, source, target, fact.'
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue