Recognize spells from shared glossary documents

This commit is contained in:
2026-11-29 18:04:00 +00:00
parent d406aa6cd2
commit f84e737b2a
12 changed files with 215 additions and 558 deletions

View File

@@ -47,7 +47,7 @@ func referenceSlots() []contracts.ReferenceSlot {
slots = append(slots, contracts.ReferenceSlot{
Name: spellcatalog.SpellCatalogReferenceSlot,
Description: "Optional canonical spell-name catalog used for extraction grounding.",
AcceptedMediaTypes: []string{"application/json"},
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml"},
MaxBytes: 1048576,
}, contracts.ReferenceSlot{
Name: NPCRegistryReferenceSlot,

View File

@@ -142,7 +142,7 @@ func TestExtractUsesAliasRecognitionToRequestCanonicalSpellNames(t *testing.T) {
}
func TestExtractAliasOnlyCatalogChangesPromptMaterial(t *testing.T) {
aliasReference := spellCatalogReference(`{"schema_version":"notarius.dnd.spell-catalog-overlay.v1","catalogs":[{"id":"campaign.example","ruleset":"dnd-5e-2014","source":{"title":"Private campaign source","version":"1","url":"file:///private-source.json","license":"private"},"spells":[{"name":"Cure Wounds","aliases":["Campaign Woundweave"]}]}]}`)
aliasReference := spellCatalogReference(`{"schema_version":"maximumdirect.glossary.v1","collections":{"spells":{"entries":[{"id":"cure","name":"Cure Wounds","category":"spell","aliases":["Campaign Woundweave"]}]}}}`)
baseClient := &fakeSpellsLLMClient{response: extractionResponse{SpellCasts: []spellCastResponse{}}}
aliasClient := &fakeSpellsLLMClient{response: extractionResponse{SpellCasts: []spellCastResponse{}}}
baseExtractor := newExtractor(t, baseClient)

View File

@@ -63,7 +63,7 @@ func TestModuleSpec(t *testing.T) {
{
Name: "spell_catalog",
Description: "Optional canonical spell-name catalog used for extraction grounding.",
AcceptedMediaTypes: []string{"application/json"},
AcceptedMediaTypes: []string{"application/json", "application/x-yaml", "application/yaml"},
MaxBytes: 1048576,
},
},

View File

@@ -162,7 +162,7 @@ func spellCatalogReference(content string) contracts.ReferenceSet {
}
func overlaySpellCatalogReference() contracts.ReferenceSet {
return spellCatalogReference(`{"schema_version":"notarius.dnd.spell-catalog-overlay.v1","catalogs":[{"id":"campaign.example","ruleset":"dnd-5e-2014","source":{"title":"Private campaign source","version":"1","url":"file:///private-source.json","license":"private"},"spells":[{"name":"Aegis of Emberfall","aliases":["Emberfall Aegis"]}]}]}`)
return spellCatalogReference(`{"schema_version":"maximumdirect.glossary.v1","collections":{"spells":{"entries":[{"id":"aegis","name":"Aegis of Emberfall","category":"spell","aliases":["Emberfall Aegis"]}]}}}`)
}
type fakeSpellsLLMClient struct {