Document D&D extractor contract

This commit is contained in:
2026-07-24 14:46:19 +00:00
parent 1aa30a73db
commit a1b76093ce
4 changed files with 48 additions and 8 deletions

View File

@@ -14,7 +14,6 @@ import (
)
const Key = "dnd/spells"
const ArtifactType = "dnd.spell_cast"
const SchemaVersion = "v1"
const mappingPolicy = "dnd.spells.extract_mapping.v2"
@@ -122,6 +121,9 @@ func (e *Extractor) ReferenceSlots() []contracts.ReferenceSlot {
}
func (e *Extractor) ManifestMetadata() map[string]any {
if e == nil {
return nil
}
metadata := map[string]any{
"prompt_id": PromptID,
"prompt_version": SchemaVersion,

View File

@@ -174,6 +174,13 @@ func TestExtractorManifestMetadataIncludesLLMSchemaProvenance(t *testing.T) {
}
}
func TestNilExtractorManifestMetadata(t *testing.T) {
var extractor *Extractor
if metadata := extractor.ManifestMetadata(); metadata != nil {
t.Fatalf("nil extractor metadata = %#v, want nil", metadata)
}
}
func TestExtractPassesReferencesAsPromptInputs(t *testing.T) {
client := &fakeSpellsLLMClient{response: extractionResponse{SpellCasts: []spellCastResponse{}}}
req := extractionRequest()