Prepare shared context for all D&D extractors
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package combatturns
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ var _ contracts.Extractor[dnd.CombatTurnList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
npcResolver *npcregistry.Resolver
|
||||
sceneResolver *sceneregistry.Resolver
|
||||
}
|
||||
@@ -82,6 +83,10 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
npcResolver, err := npcregistry.NewResolver(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare NPC registry prompt input: %w", err)
|
||||
@@ -90,7 +95,7 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare scene eligibility: %w", err)
|
||||
}
|
||||
return &Extractor{npcResolver: npcResolver, sceneResolver: sceneResolver}, nil
|
||||
return &Extractor{context: context, npcResolver: npcResolver, sceneResolver: sceneResolver}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string { return Key }
|
||||
@@ -136,7 +141,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
}
|
||||
|
||||
sourceID := req.Source.ID
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
materials[NPCRegistryReferenceSlot] = npcRegistry.PromptInput()
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials))
|
||||
for name, material := range materials {
|
||||
|
||||
@@ -125,8 +125,8 @@ func TestExtractPassesReferencesAndNPCGroundingWithoutUsingItAsEvidence(t *testi
|
||||
client := &fakeCombatTurnsLLMClient{response: extractionResponse{CombatTurns: []combatTurnResponse{}}}
|
||||
references := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"players": {Slot: contracts.ReferenceSlot{Name: "players"}, Items: []contracts.ReferenceItem{{SlotName: "players", Content: []byte("Alice: Aria")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", Content: []byte("Aria: cleric")}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", Content: []byte("ogre: a large foe")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.rpg.party.v1","characters":{"a":{"character":{"name":"Aria","classes":[{"name":"cleric"}]}}}}`)}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"campaign":{"entries":[{"id":"o","name":"ogre","category":"foe","description":"a large foe"}]}}}`)}}},
|
||||
NPCRegistryReferenceSlot: {Slot: contracts.ReferenceSlot{Name: NPCRegistryReferenceSlot}, Items: []contracts.ReferenceItem{{SlotName: NPCRegistryReferenceSlot, MediaType: "application/json", Content: npcRegistryJSON(t)}}},
|
||||
}}
|
||||
req := extractionRequest(t)
|
||||
@@ -143,7 +143,7 @@ func TestExtractPassesReferencesAndNPCGroundingWithoutUsingItAsEvidence(t *testi
|
||||
for _, message := range messages {
|
||||
all += message.Content
|
||||
}
|
||||
for _, material := range []string{"Alice: Aria", "Aria: cleric", "ogre: a large foe"} {
|
||||
for _, material := range []string{"Alice: Aria", "cleric", "a large foe"} {
|
||||
if strings.Count(all, material) != 1 {
|
||||
t.Fatalf("campaign input not rendered once: %q", material)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package enemyevents
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ var _ contracts.Extractor[dnd.EnemyEventList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
grounding *groundingResolver
|
||||
}
|
||||
|
||||
@@ -44,11 +45,15 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
grounding, err := newGroundingResolver(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare grounding: %w", err)
|
||||
}
|
||||
return &Extractor{grounding: grounding}, nil
|
||||
return &Extractor{context: context, grounding: grounding}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string { return Key }
|
||||
@@ -87,7 +92,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
|
||||
order := shared.NewSourceRefOrderForSource(req.Source, req.SourceIndex)
|
||||
sourceID := req.Source.ID
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
for name, material := range grounding.PromptInputs() {
|
||||
materials[name] = material
|
||||
}
|
||||
|
||||
@@ -25,9 +25,17 @@ func TestExtractMapsEnemyEventsInSourceOrder(t *testing.T) {
|
||||
}}}
|
||||
|
||||
req := enemyExtractionRequest(t)
|
||||
req.References.Slots["party"] = contracts.ResolvedReferenceSlot{Items: []contracts.ReferenceItem{{
|
||||
MediaType: "application/json",
|
||||
Content: []byte(`{"schema_version":"maximumdirect.rpg.party.v1","characters":{"a":{"character":{"name":"Aria","aliases":["Star"]},"player":{"name":"Alice"}}}}`),
|
||||
}}}
|
||||
req.References.Slots["glossary"] = contracts.ResolvedReferenceSlot{Items: []contracts.ReferenceItem{{
|
||||
MediaType: "application/json",
|
||||
Content: []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"campaign":{"entries":[{"id":"w","name":"Watchtower","category":"place","aliases":["The Tower"]}]}}}`),
|
||||
}}}
|
||||
index := source.NewDocumentIndex(req.Source)
|
||||
req.SourceIndex = &index
|
||||
result, err := runExtraction(context.Background(), newEnemyExtractor(t, client), req)
|
||||
result, err := runExtraction(context.Background(), newEnemyExtractor(t, client, req.References), req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -50,6 +58,15 @@ func TestExtractMapsEnemyEventsInSourceOrder(t *testing.T) {
|
||||
t.Fatalf("LLM calls = %d, want 1", len(client.requests))
|
||||
}
|
||||
request := client.requests[0]
|
||||
var prompt strings.Builder
|
||||
for _, message := range request.Prompt.Messages {
|
||||
prompt.WriteString(message.Content)
|
||||
}
|
||||
for _, name := range []string{"Aria", "Star", "Alice", "Watchtower", "The Tower"} {
|
||||
if !strings.Contains(prompt.String(), name) {
|
||||
t.Fatalf("prepared context omitted %q", name)
|
||||
}
|
||||
}
|
||||
if request.Prompt.SessionID != "session-123" {
|
||||
t.Fatal("session selection lost")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package itemoccurrences
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ var _ contracts.Extractor[dnd.ItemOccurrenceList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
itemResolver *itemregistry.Resolver
|
||||
}
|
||||
|
||||
@@ -72,11 +73,15 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
itemResolver, err := itemregistry.NewResolver(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare item registry prompt input: %w", err)
|
||||
}
|
||||
return &Extractor{itemResolver: itemResolver}, nil
|
||||
return &Extractor{context: context, itemResolver: itemResolver}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string { return Key }
|
||||
@@ -102,7 +107,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
}
|
||||
|
||||
sourceID := req.Source.ID
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
materials[ItemRegistryReferenceSlot] = registry.PromptInput()
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials))
|
||||
for name, material := range materials {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package locationoccurrences
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ var _ contracts.Extractor[dnd.LocationOccurrenceList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
locationResolver *locationregistry.Resolver
|
||||
}
|
||||
|
||||
@@ -67,11 +68,15 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
locationResolver, err := locationregistry.NewResolver(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare location registry prompt input: %w", err)
|
||||
}
|
||||
return &Extractor{locationResolver: locationResolver}, nil
|
||||
return &Extractor{context: context, locationResolver: locationResolver}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string { return Key }
|
||||
@@ -106,7 +111,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
order := shared.NewSourceRefOrderForSource(req.Source, index)
|
||||
|
||||
sourceID := req.Source.ID
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
materials[LocationRegistryReferenceSlot] = grounding.PromptInput()
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials))
|
||||
for name, material := range materials {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package npcoccurrences
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ var _ contracts.Extractor[dnd.NPCOccurrenceList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
npcResolver *npcregistry.Resolver
|
||||
}
|
||||
|
||||
@@ -71,11 +72,15 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
npcResolver, err := npcregistry.NewResolver(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare NPC registry prompt input: %w", err)
|
||||
}
|
||||
return &Extractor{npcResolver: npcResolver}, nil
|
||||
return &Extractor{context: context, npcResolver: npcResolver}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string { return Key }
|
||||
@@ -100,7 +105,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
}
|
||||
|
||||
sourceID := req.Source.ID
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
materials[NPCRegistryReferenceSlot] = npcRegistry.PromptInput()
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials))
|
||||
for name, material := range materials {
|
||||
|
||||
16
internal/modules/dnd/extract/spells/context_input_test.go
Normal file
16
internal/modules/dnd/extract/spells/context_input_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package spells
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
)
|
||||
|
||||
func TestConstructionRejectsInvalidSharedReference(t *testing.T) {
|
||||
refs := contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"glossary": {Items: []contracts.ReferenceItem{{MediaType: "application/json", Content: []byte("{}")}}},
|
||||
}}
|
||||
if _, err := New(Options{}, refs); err == nil {
|
||||
t.Fatal("invalid glossary accepted during construction")
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,7 @@ var _ contracts.Extractor[dnd.SpellList] = (*Extractor)(nil)
|
||||
type Options struct{}
|
||||
|
||||
type Extractor struct {
|
||||
context shared.PreparedContext
|
||||
catalogPromptInput []byte
|
||||
npcResolver *npcregistry.Resolver
|
||||
}
|
||||
@@ -77,6 +78,10 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if len(references) == 1 {
|
||||
referenceSet = references[0]
|
||||
}
|
||||
context, err := shared.PrepareContext(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare references: %w", err)
|
||||
}
|
||||
effectiveCatalog, err := spellcatalog.ResolveEffectiveCatalog(referenceSet)
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("resolve effective spell catalog: %w", err)
|
||||
@@ -89,7 +94,7 @@ func New(_ Options, references ...contracts.ReferenceSet) (*Extractor, error) {
|
||||
if err != nil {
|
||||
return nil, extractorErrorf("prepare NPC registry prompt input: %w", err)
|
||||
}
|
||||
return &Extractor{catalogPromptInput: catalogPromptInput, npcResolver: npcResolver}, nil
|
||||
return &Extractor{context: context, catalogPromptInput: catalogPromptInput, npcResolver: npcResolver}, nil
|
||||
}
|
||||
|
||||
func (e *Extractor) Key() string {
|
||||
@@ -115,7 +120,7 @@ func (e *Extractor) PrepareExtraction(ctx context.Context, req contracts.Extract
|
||||
return nil, extractorErrorf("resolve NPC registry: %w", err)
|
||||
}
|
||||
|
||||
materials := shared.PromptInputs(sourceInput, req.References)
|
||||
materials := e.context.Inputs(sourceInput)
|
||||
inputs := make(map[string]promptkit.ArtifactRef, len(materials)+2)
|
||||
for name, material := range materials {
|
||||
inputs[name] = promptkit.InlineWithURI(material.OriginURI, string(material.Content))
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/shared"
|
||||
spellcatalog "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/spells/catalog"
|
||||
"go.maximumdirect.net/promptkit"
|
||||
)
|
||||
@@ -177,33 +176,21 @@ func TestExtractPassesReferencesAsPromptInputs(t *testing.T) {
|
||||
req := extractionRequest()
|
||||
req.References = contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"players": {Slot: contracts.ReferenceSlot{Name: "players"}, Items: []contracts.ReferenceItem{{SlotName: "players", Content: []byte("Alice: Aria Brightmantle")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", Content: []byte("Aria Brightmantle: party cleric")}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", Content: []byte("Brightmantle: local temple name")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.rpg.party.v1","characters":{"a":{"character":{"name":"Aria Brightmantle","classes":[{"name":"cleric"}]},"player":{"name":"Alice"}}}}`)}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"campaign":{"entries":[{"id":"b","name":"Brightmantle","category":"place","description":"local temple name"}]}}}`)}}},
|
||||
}}
|
||||
|
||||
if _, err := runExtraction(context.Background(), newExtractor(t, client), req); err != nil {
|
||||
if _, err := runExtraction(context.Background(), newExtractor(t, client, req.References), req); err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
text := promptText(client.requests[0])
|
||||
for _, content := range []string{"Alice: Aria Brightmantle", "Aria Brightmantle: party cleric", "Brightmantle: local temple name", string(req.Chunk.Content)} {
|
||||
for _, content := range []string{"Alice: Aria Brightmantle", "cleric", "local temple name", string(req.Chunk.Content)} {
|
||||
if !strings.Contains(text, content) {
|
||||
t.Fatalf("missing fixed input %q", content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromptInputsMapLegacyRosterReferenceToParty(t *testing.T) {
|
||||
inputs := shared.PromptInputs(spellSourceInput(), contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"roster": {Slot: contracts.ReferenceSlot{Name: "roster"}, Items: []contracts.ReferenceItem{{SlotName: "roster", Content: []byte("Legacy roster text")}}},
|
||||
}})
|
||||
if got := string(inputs["party"].Content); got != "Legacy roster text" {
|
||||
t.Fatalf("party input = %q, want legacy roster content", got)
|
||||
}
|
||||
if _, ok := inputs["roster"]; ok {
|
||||
t.Fatal("roster prompt input was present; want only party input")
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractPreservesValidEmptyCollection(t *testing.T) {
|
||||
result, err := runExtraction(context.Background(), newExtractor(t, &fakeSpellsLLMClient{content: []byte(`{"spell_casts":[]}`)}), extractionRequest())
|
||||
if err != nil || result.Value.SpellCasts == nil || len(result.Value.SpellCasts) != 0 {
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestModuleSpec(t *testing.T) {
|
||||
{
|
||||
Name: "glossary",
|
||||
Description: "Optional campaign glossary reference material used only for disambiguation.",
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml", "text/markdown", "text/plain"},
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml"},
|
||||
},
|
||||
{
|
||||
Name: NPCRegistryReferenceSlot,
|
||||
@@ -48,7 +48,7 @@ func TestModuleSpec(t *testing.T) {
|
||||
{
|
||||
Name: "party",
|
||||
Description: "Optional party roster reference material used only for disambiguation.",
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml", "text/markdown", "text/plain"},
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml"},
|
||||
},
|
||||
{
|
||||
Name: "players",
|
||||
@@ -58,7 +58,7 @@ func TestModuleSpec(t *testing.T) {
|
||||
{
|
||||
Name: "roster",
|
||||
Description: "Deprecated alias for party roster reference material used only for disambiguation.",
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml", "text/markdown", "text/plain"},
|
||||
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml"},
|
||||
},
|
||||
{
|
||||
Name: "spell_catalog",
|
||||
|
||||
Reference in New Issue
Block a user