Tighten D&D prompt contracts and tests
This commit is contained in:
@@ -42,33 +42,6 @@ func TestRegisterPromptAssetsAndPrepareNPCPrompt(t *testing.T) {
|
||||
if prepared.PromptID != PromptID || prepared.OutputContract.SchemaPath != "dnd_npcs_llm.v1.json" {
|
||||
t.Fatalf("prepared prompt = %#v, want NPC prompt identity and wiring", prepared)
|
||||
}
|
||||
referenceIndex := -1
|
||||
transcriptIndex := -1
|
||||
for index, message := range prepared.Messages {
|
||||
if strings.Contains(message.Content, "npc-player") {
|
||||
referenceIndex = index
|
||||
}
|
||||
if strings.Contains(message.Content, "npc-transcript") {
|
||||
transcriptIndex = index
|
||||
}
|
||||
}
|
||||
instructionsIndex := len(prepared.Messages) - 1
|
||||
if referenceIndex < 0 || transcriptIndex <= referenceIndex || transcriptIndex >= instructionsIndex {
|
||||
t.Fatalf("message order = references %d, transcript %d, instructions %d; want that order", referenceIndex, transcriptIndex, instructionsIndex)
|
||||
}
|
||||
for _, index := range []int{referenceIndex, transcriptIndex, instructionsIndex} {
|
||||
if cache := prepared.Messages[index].CacheControl; cache == nil || cache.Type != promptkit.CacheControlEphemeral {
|
||||
t.Fatalf("message %d cache control = %#v, want ephemeral", index, cache)
|
||||
}
|
||||
}
|
||||
for index, message := range prepared.Messages {
|
||||
if index != referenceIndex && strings.Contains(message.Content, "npc-player") {
|
||||
t.Errorf("message %d unexpectedly rendered campaign-reference input", index)
|
||||
}
|
||||
if index != transcriptIndex && strings.Contains(message.Content, "npc-transcript") {
|
||||
t.Errorf("message %d unexpectedly rendered transcript input", index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromptMetadataAndDiagnosticsDoNotContainRawAssets(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user