Construct prompt engines from shared configuration
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/appconfig"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
|
||||
ck "go.maximumdirect.net/configkit"
|
||||
@@ -33,11 +33,11 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
|
||||
} {
|
||||
t.Run(tc.dir+"/"+tc.main, func(t *testing.T) {
|
||||
main := filepath.Join(root, tc.dir, tc.main)
|
||||
loaded, err := config.Load(ck.Input{Source: ck.File(main)}, tc.overlay)
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, tc.overlay)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
loaded.Config.Reporting.Enabled = false
|
||||
loaded.Config.Application.Reporting.Enabled = false
|
||||
var calls atomic.Int32
|
||||
var mu sync.Mutex
|
||||
var models, prompts []string
|
||||
@@ -83,7 +83,7 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
|
||||
if _, err := executePipeline(context.Background(), inputs, prepared, source.Canonical(), func(error) {}, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if int(calls.Load()) != len(loaded.Config.Pipeline.Stages) {
|
||||
if int(calls.Load()) != len(loaded.Config.Application.Pipeline.Stages) {
|
||||
t.Fatalf("provider calls=%d", calls.Load())
|
||||
}
|
||||
if tc.dir == "service" && (len(models) != 1 || models[0] != "example-testing-model") {
|
||||
@@ -120,7 +120,7 @@ func TestExamplePromptEditIsCapturedOnNextLoad(t *testing.T) {
|
||||
}
|
||||
}
|
||||
inspect := func() string {
|
||||
loaded, err := config.Load(ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/appconfig"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/normalization"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/outputschema"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/reporting"
|
||||
@@ -41,7 +42,7 @@ func runProcess(inv commandkit.Invocation, input processInput) commandkit.Outcom
|
||||
if errors.As(err, &secretsErr) {
|
||||
return commandkit.Failure(secretsErr.Error()).WithCause(err)
|
||||
}
|
||||
if inv.Context.Err() != nil || llm.IsAssetError(err) {
|
||||
if inv.Context.Err() != nil || appconfig.IsAssetError(err) {
|
||||
return commandkit.Failure("Could not prepare processing.").WithCause(err)
|
||||
}
|
||||
return commandkit.Usage(err.Error()).WithCause(err)
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/config"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/appconfig"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/diagnostics"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/schema"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
|
||||
@@ -101,7 +101,7 @@ pipeline:
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
loaded, err := config.Load(ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -114,8 +114,8 @@ pipeline:
|
||||
t.Fatal(err)
|
||||
}
|
||||
inputs := &processInputs{Configuration: loaded, Runtime: runtime, Source: source}
|
||||
loaded.Config.Diagnostics.WorkDir = dir
|
||||
loaded.Config.Reporting.StdoutDir = dir
|
||||
loaded.Config.Application.Diagnostics.WorkDir = dir
|
||||
loaded.Config.Application.Reporting.StdoutDir = dir
|
||||
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(dir, "transcript.json"), Debug: commandkit.Supplied[bool]{Value: true}}, inputs, &bytes.Buffer{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -213,7 +213,7 @@ func TestRecoverableModelFailureKeepsNormalizedTranscript(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
loaded, err := config.Load(ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -229,7 +229,7 @@ func TestRecoverableModelFailureKeepsNormalizedTranscript(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
inputs := &processInputs{Configuration: loaded, Runtime: runtime, Source: source}
|
||||
loaded.Config.Reporting.StdoutDir = dir
|
||||
loaded.Config.Application.Reporting.StdoutDir = dir
|
||||
prepared, err := prepareProcess(context.Background(), processInput{Transcript: filepath.Join(dir, "transcript.json")}, inputs, &bytes.Buffer{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user