Add grounded NPC interaction extractor
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
id: dnd.npc_interactions
|
||||
version: "v1"
|
||||
default_profile: gemini-2-flash
|
||||
inputs:
|
||||
- name: transcript
|
||||
required: true
|
||||
content_type: application/json
|
||||
- name: players
|
||||
required: false
|
||||
content_type: text/plain
|
||||
- name: party
|
||||
required: false
|
||||
content_type: text/plain
|
||||
- name: glossary
|
||||
required: false
|
||||
content_type: text/plain
|
||||
- name: npcs
|
||||
required: true
|
||||
content_type: application/json
|
||||
messages:
|
||||
- role: system
|
||||
content_file: ./sharedassets/common-dnd-system.md
|
||||
- role: user
|
||||
content_file: ./sharedassets/common-dnd-extraction-evidence.md
|
||||
- role: user
|
||||
content_file: ./sharedassets/common-dnd-identity.md
|
||||
cache_control:
|
||||
type: ephemeral
|
||||
- role: user
|
||||
content_file: ./sharedassets/common-dnd-references.md
|
||||
cache_control:
|
||||
type: ephemeral
|
||||
- role: user
|
||||
content_file: ./sharedassets/common-dnd-npcs.md
|
||||
cache_control:
|
||||
type: ephemeral
|
||||
- role: user
|
||||
content_file: ./task.md
|
||||
- role: user
|
||||
content_file: ./instructions.md
|
||||
cache_control:
|
||||
type: ephemeral
|
||||
- role: user
|
||||
content_file: ./sharedassets/common-dnd-transcript.md
|
||||
output:
|
||||
format: json
|
||||
validation_mode: json_schema
|
||||
schema_path: dnd_npc_interactions_llm.v1.json
|
||||
repair_attempts: 0
|
||||
@@ -0,0 +1,18 @@
|
||||
Return the interactions array even when no interaction is established. Every
|
||||
record must contain name, kind, and source_refs. Cite transcript ranges that
|
||||
support both the NPC identity and the interaction kind.
|
||||
|
||||
Use exactly one kind per occurrence:
|
||||
|
||||
- mentioned: the NPC is referred to but is not established as present or communicating;
|
||||
- noncombat_presence: the NPC is present and relevant but does not meaningfully participate in dialogue or combat;
|
||||
- dialogue: the NPC speaks, responds, or is directly engaged in a meaningful non-combat exchange;
|
||||
- combat_ally: the NPC actively participates in combat on the party's side;
|
||||
- combat_opponent: the NPC actively participates in combat against the party; or
|
||||
- other: the transcript clearly establishes a direct NPC occurrence that fits none of the preceding kinds.
|
||||
|
||||
When activities overlap, active combat participation outranks dialogue,
|
||||
presence, and mention; dialogue outranks noncombat presence and mention; and
|
||||
noncombat presence outranks mention. Other is only for directly evidenced
|
||||
activity outside those categories. Split an occurrence rather than assigning
|
||||
both combat alignments.
|
||||
@@ -0,0 +1,16 @@
|
||||
Extract Dungeons & Dragons NPC interaction occurrences from the supplied
|
||||
transcript.
|
||||
|
||||
Include an occurrence only when the transcript establishes one supplied NPC,
|
||||
one interaction kind, and a coherent passage supporting both. Use only names
|
||||
from the supplied NPC registry. The registry helps ground identity but never
|
||||
proves that an interaction occurred.
|
||||
|
||||
Do not summarize, infer relationships, sentiment, factions, motives, aliases,
|
||||
or persistent state. Do not identify player characters, anonymous groups, or
|
||||
invented NPCs. Return an empty interactions array when no supplied NPC has an
|
||||
evidenced interaction in this transcript passage.
|
||||
|
||||
Keep occurrences within this transcript chunk. Split records when an NPC's
|
||||
interaction kind changes, when combat alignment changes, or when an NPC is
|
||||
first mentioned and later becomes present.
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "notarius.dnd.npc_interactions.llm",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["interactions"],
|
||||
"properties": {
|
||||
"interactions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["name", "kind", "source_refs"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string"
|
||||
},
|
||||
"source_refs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["start_unit_id", "end_unit_id"],
|
||||
"properties": {
|
||||
"start_unit_id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"end_unit_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user