Migrate maintained D&D examples to native configuration
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
func TestProductionEnemyEventConfigurationResolvesGeneratedHandoffs(t *testing.T) {
|
||||
components := productionTestComponents(t)
|
||||
configPath := writeEnemyEventContractConfig(t)
|
||||
configPath := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
loaded, err := config.Load(configPath, config.LoadOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -83,15 +83,16 @@ func TestProductionEnemyEventConfigurationResolvesGeneratedHandoffs(t *testing.T
|
||||
}
|
||||
}
|
||||
|
||||
func TestNativeOrderedDNDRunPublishesRegistryBackedEntityOccurrences(t *testing.T) {
|
||||
configPath := writeEnemyEventContractConfig(t)
|
||||
func TestMaintainedCompleteInvocationPublishesRegistryBackedEntityOccurrences(t *testing.T) {
|
||||
t.Setenv("OPENROUTER_API_KEY", "notarius-test-credential")
|
||||
configPath := repositoryPath("examples", "dnd-complete", "config.yml")
|
||||
outputRoot := filepath.Join(t.TempDir(), "output")
|
||||
client := &enemyEventLLMClient{}
|
||||
options := productionRunOptions(t, client)
|
||||
var stdout, stderr strings.Builder
|
||||
code := RunWithOptions([]string{
|
||||
"run", "dnd-session", "--config", configPath,
|
||||
"--input-file", repositoryPath("examples", "dnd-complete-transcript.json"),
|
||||
"--input-file", repositoryPath("examples", "dnd-complete", "transcript.json"),
|
||||
"--cache", "bypass", "--output-dir", outputRoot,
|
||||
"--llm-session-id", "enemy-event-session", "--format", "json",
|
||||
}, &stdout, &stderr, options)
|
||||
@@ -188,83 +189,6 @@ func TestNativeOrderedDNDRunPublishesRegistryBackedEntityOccurrences(t *testing.
|
||||
}
|
||||
}
|
||||
|
||||
func writeEnemyEventContractConfig(t *testing.T) string {
|
||||
t.Helper()
|
||||
return writeProductionContractConfig(t, fmt.Sprintf(`version: 6
|
||||
pipelines:
|
||||
dnd-session:
|
||||
cache: bypass
|
||||
input: {module: seriatim}
|
||||
chunk: {module: dnd/scenes}
|
||||
references:
|
||||
party: {path: %q}
|
||||
glossary: {path: %q}
|
||||
output:
|
||||
module: json
|
||||
options:
|
||||
include_chunk_map: true
|
||||
evidence_context:
|
||||
enabled: true
|
||||
window_units: 3
|
||||
lanes: [item-occurrences, item-registry, location-registry, location-occurrences, npc-registry, spells, combat-turns, npc-occurrences, enemy-events]
|
||||
steps:
|
||||
- id: describe-session
|
||||
artifacts:
|
||||
item-registry:
|
||||
extract: {module: dnd/item-registry}
|
||||
normalize: {module: dnd/item-registry}
|
||||
npc-registry:
|
||||
extract: {module: dnd/npc-registry}
|
||||
normalize: {module: dnd/npc-registry}
|
||||
location-registry:
|
||||
extract: {module: dnd/location-registry}
|
||||
normalize: {module: dnd/location-registry}
|
||||
scene-descriptions:
|
||||
extract: {module: dnd/scene-descriptions}
|
||||
normalize: {module: dnd/scene-descriptions}
|
||||
- id: extract-events
|
||||
references:
|
||||
location_registry: {artifact: {step: describe-session, lane: location-registry}}
|
||||
npc_registry: {artifact: {step: describe-session, lane: npc-registry}}
|
||||
scene_descriptions: {artifact: {step: describe-session, lane: scene-descriptions}}
|
||||
item_registry: {artifact: {step: describe-session, lane: item-registry}}
|
||||
artifacts:
|
||||
item-occurrences:
|
||||
extract: {module: dnd/item-occurrences}
|
||||
normalize: {module: dnd/item-occurrences}
|
||||
spells:
|
||||
extract:
|
||||
module: dnd/spells
|
||||
references:
|
||||
spell_catalog: {path: %q}
|
||||
normalize:
|
||||
module: dnd/spells
|
||||
references:
|
||||
spell_catalog: {path: %q}
|
||||
combat-turns:
|
||||
extract: {module: dnd/combat-turns}
|
||||
normalize: {module: dnd/combat-turns}
|
||||
npc-occurrences:
|
||||
extract: {module: dnd/npc-occurrences}
|
||||
normalize: {module: dnd/npc-occurrences}
|
||||
location-occurrences:
|
||||
extract: {module: dnd/location-occurrences}
|
||||
normalize: {module: dnd/location-occurrences}
|
||||
- id: track-enemies
|
||||
references:
|
||||
npc_registry: {artifact: {step: describe-session, lane: npc-registry}}
|
||||
scene_descriptions: {artifact: {step: describe-session, lane: scene-descriptions}}
|
||||
combat_turns: {artifact: {step: extract-events, lane: combat-turns}}
|
||||
npc_occurrences: {artifact: {step: extract-events, lane: npc-occurrences}}
|
||||
artifacts:
|
||||
enemy-events:
|
||||
extract: {module: dnd/enemy-events}
|
||||
normalize: {module: dnd/enemy-events}
|
||||
`+productionProviderConfiguration,
|
||||
repositoryPath("examples", "dnd-party.txt"), repositoryPath("examples", "dnd-glossary.txt"),
|
||||
repositoryPath("examples", "dnd-spell-catalog.json"), repositoryPath("examples", "dnd-spell-catalog.json")))
|
||||
}
|
||||
|
||||
type enemyEventLLMClient struct {
|
||||
mu sync.Mutex
|
||||
requests []promptkit.GenerateRequest
|
||||
|
||||
Reference in New Issue
Block a user