Adjust the prompt FS layout and test strategy
This commit is contained in:
@@ -197,9 +197,15 @@ func TestProductionPromptAssetsRegisterAndPrepareDndPrompts(t *testing.T) {
|
||||
"dnd.scenes/dnd.scenes.yaml",
|
||||
"dnd.scenes/task.md",
|
||||
"dnd.scenes/instructions.md",
|
||||
"dnd.scenes/sharedassets/common-dnd-system.md",
|
||||
"dnd.scenes/sharedassets/common-dnd-transcript.md",
|
||||
"dnd.scenes/sharedassets/common-dnd-references.md",
|
||||
"dnd.spells/dnd.spells.yaml",
|
||||
"dnd.spells/task.md",
|
||||
"dnd.spells/instructions.md",
|
||||
"dnd.spells/sharedassets/common-dnd-system.md",
|
||||
"dnd.spells/sharedassets/common-dnd-transcript.md",
|
||||
"dnd.spells/sharedassets/common-dnd-references.md",
|
||||
} {
|
||||
if _, err := promptFS.Open(name); err != nil {
|
||||
t.Fatalf("PromptFS().Open(%q) error = %v, want nil", name, err)
|
||||
@@ -220,13 +226,15 @@ func TestProductionPromptAssetsRegisterAndPrepareDndPrompts(t *testing.T) {
|
||||
t.Fatalf("NewEngine() error = %v, want nil", err)
|
||||
}
|
||||
|
||||
sceneTranscript := `{"id":"session-1","segments":[{"id":"u1","text":"We enter the crypt."}]}`
|
||||
scenesPrepared, err := engine.Prepare(context.Background(), scriptorium.RunRequest{
|
||||
PromptID: scenes.PromptID,
|
||||
PromptVersion: scenes.ResponseSchemaVersion,
|
||||
ProfileID: "production-test-profile",
|
||||
Inputs: map[string]scriptorium.ArtifactRef{
|
||||
"transcript": scriptorium.InlineWithURI("file:///session.json", `{"id":"session-1","segments":[{"id":"u1","text":"We enter the crypt."}]}`),
|
||||
"roster": scriptorium.Inline("Aria: cleric"),
|
||||
"transcript": scriptorium.InlineWithURI("file:///session.json", sceneTranscript),
|
||||
"players": scriptorium.Inline("Alice: Aria"),
|
||||
"party": scriptorium.Inline("Aria: cleric"),
|
||||
"glossary": scriptorium.Inline("Brightmantle: temple"),
|
||||
},
|
||||
})
|
||||
@@ -236,17 +244,24 @@ func TestProductionPromptAssetsRegisterAndPrepareDndPrompts(t *testing.T) {
|
||||
if got := len(scenesPrepared.Messages); got != 5 {
|
||||
t.Fatalf("scene message count = %d, want 5", got)
|
||||
}
|
||||
if !strings.Contains(scenesPrepared.Messages[3].Content, "Divide the provided transcript") {
|
||||
t.Fatalf("scene task message missing module text: %q", scenesPrepared.Messages[3].Content)
|
||||
if !strings.Contains(scenesPrepared.Messages[1].Content, sceneTranscript) {
|
||||
t.Fatalf("scene transcript message did not include source input")
|
||||
}
|
||||
for _, want := range []string{"Alice: Aria", "Aria: cleric", "Brightmantle: temple"} {
|
||||
if !strings.Contains(scenesPrepared.Messages[2].Content, want) {
|
||||
t.Fatalf("scene reference message missing %q", want)
|
||||
}
|
||||
}
|
||||
|
||||
spellTranscript := `{"id":"session-1","segments":[{"id":"u1","text":"Mira casts shield."}]}`
|
||||
spellsPrepared, err := engine.Prepare(context.Background(), scriptorium.RunRequest{
|
||||
PromptID: spells.PromptID,
|
||||
PromptVersion: spells.SchemaVersion,
|
||||
ProfileID: "production-test-profile",
|
||||
Inputs: map[string]scriptorium.ArtifactRef{
|
||||
"transcript": scriptorium.InlineWithURI("file:///session.json", `{"id":"session-1","segments":[{"id":"u1","text":"Mira casts shield."}]}`),
|
||||
"roster": scriptorium.Inline("Mira: wizard"),
|
||||
"transcript": scriptorium.InlineWithURI("file:///session.json", spellTranscript),
|
||||
"players": scriptorium.Inline("Dana: Mira"),
|
||||
"party": scriptorium.Inline("Mira: wizard"),
|
||||
"glossary": scriptorium.Inline("Shield: abjuration"),
|
||||
},
|
||||
})
|
||||
@@ -256,8 +271,13 @@ func TestProductionPromptAssetsRegisterAndPrepareDndPrompts(t *testing.T) {
|
||||
if got := len(spellsPrepared.Messages); got != 5 {
|
||||
t.Fatalf("spell message count = %d, want 5", got)
|
||||
}
|
||||
if !strings.Contains(spellsPrepared.Messages[3].Content, "Extract Dungeons & Dragons spell-cast artifacts") {
|
||||
t.Fatalf("spell task message missing module text: %q", spellsPrepared.Messages[3].Content)
|
||||
if !strings.Contains(spellsPrepared.Messages[1].Content, spellTranscript) {
|
||||
t.Fatalf("spell transcript message did not include source input")
|
||||
}
|
||||
for _, want := range []string{"Dana: Mira", "Mira: wizard", "Shield: abjuration"} {
|
||||
if !strings.Contains(spellsPrepared.Messages[2].Content, want) {
|
||||
t.Fatalf("spell reference message missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user