Route spell extraction through core preparation with remaining extractors pending

This commit is contained in:
2026-11-25 15:24:50 +00:00
parent bab7b2305f
commit ccecf13a4c
24 changed files with 306 additions and 148 deletions

View File

@@ -13,6 +13,7 @@ import (
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
spellcatalog "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/spells/catalog"
)
@@ -112,13 +113,27 @@ func mismatchedSourceInputRequest(req contracts.TypedExtractionRequest[dnd.Spell
return req
}
func newExtractor(t *testing.T, client promptkit.LLMClient, references ...contracts.ReferenceSet) *Extractor {
type extractionFixture struct {
*Extractor
engine *promptkit.Engine
}
func newExtractor(t *testing.T, client promptkit.LLMClient, references ...contracts.ReferenceSet) *extractionFixture {
t.Helper()
extractor, err := New(newSpellEngine(t, client), Options{}, references...)
extractor, err := New(Options{}, references...)
if err != nil {
t.Fatalf("New() error = %v, want nil", err)
}
return extractor
return &extractionFixture{Extractor: extractor, engine: newSpellEngine(t, client)}
}
func runExtraction(ctx context.Context, fixture *extractionFixture, req contracts.TypedExtractionRequest[dnd.SpellList]) (pipeline.OperationResult[dnd.SpellList], error) {
operation := req.Operation
execution := pipeline.ExecutionContext[dnd.SpellList]{Engine: fixture.engine, Controls: operation.Controls, Assess: operation.Assess, Execution: operation.Execution, ReuseEligible: operation.ReuseEligible, Cache: operation.Cache}
input := contracts.ExtractionInput{Source: req.Source, Chunk: req.Chunk, SourceInput: req.SourceInput, SessionID: req.SessionID, References: req.References, LLMProfile: req.LLMProfile, Metadata: req.Metadata, AmbientContext: req.AmbientContext}
return pipeline.ExecuteOperation(ctx, execution, func(ctx context.Context) (contracts.PreparedOperation[dnd.SpellList], error) {
return fixture.Extractor.PrepareExtraction(ctx, input)
})
}
func spellCatalogReference(content string) contracts.ReferenceSet {