Move location registry reconciliation into shared operations
This commit is contained in:
@@ -12,6 +12,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"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,12 @@ func (c *recordingLocationNormalizerClient) Generate(ctx context.Context, reques
|
||||
return &promptkit.GenerateResponse{Content: response}, nil
|
||||
}
|
||||
|
||||
func newNormalizer(t *testing.T, client promptkit.LLMClient) *Normalizer {
|
||||
type normalizerFixture struct {
|
||||
*Normalizer
|
||||
engine *promptkit.Engine
|
||||
}
|
||||
|
||||
func newNormalizer(t *testing.T, client promptkit.LLMClient) *normalizerFixture {
|
||||
t.Helper()
|
||||
type settings struct {
|
||||
PromptKit promptkit.Settings `yaml:"promptkit"`
|
||||
@@ -70,11 +76,20 @@ func newNormalizer(t *testing.T, client promptkit.LLMClient) *Normalizer {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
normalizer, err := New(engine, Options{})
|
||||
normalizer, err := New(Options{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return normalizer
|
||||
return &normalizerFixture{Normalizer: normalizer, engine: engine}
|
||||
}
|
||||
|
||||
func (fixture *normalizerFixture) Normalize(ctx context.Context, req contracts.TypedNormalizeRequest[dnd.LocationRegistry]) (pipeline.OperationResult[dnd.LocationRegistry], error) {
|
||||
op := req.Operation
|
||||
execution := pipeline.ExecutionContext[dnd.LocationRegistry]{Engine: fixture.engine, Controls: op.Controls, Assess: op.Assess, Execution: op.Execution, ReuseEligible: op.ReuseEligible, Cache: op.Cache}
|
||||
input := contracts.NormalizeInput[dnd.LocationRegistry]{Source: req.Source, LaneID: req.LaneID, MergeOutput: req.MergeOutput, SourceInput: req.SourceInput, SessionID: req.SessionID, References: req.References, LLMProfile: req.LLMProfile, Metadata: req.Metadata}
|
||||
return pipeline.ExecuteOperation(ctx, execution, func(ctx context.Context) (contracts.PreparedOperation[dnd.LocationRegistry], error) {
|
||||
return fixture.Normalizer.PrepareNormalize(ctx, input)
|
||||
})
|
||||
}
|
||||
|
||||
func renderedInput(t *testing.T, request promptkit.GenerateRequest, name string) []byte {
|
||||
|
||||
Reference in New Issue
Block a user