Migrate facade tests to the new configuration contracts
This commit is contained in:
@@ -48,7 +48,7 @@ func TestPublicRetryRepairSequenceKeepsUsageAndEventsConsistent(t *testing.T) {
|
||||
req := simpleGenerationRequest()
|
||||
notifications := 0
|
||||
req.OnPrepared = func(context.Context, promptkit.PreparedRun) { notifications++ }
|
||||
req.Validation = &promptkit.OutputContract{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: 1}
|
||||
req.Validation = &promptkit.OutputContractInput{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: new(1)}
|
||||
req.Observer = func(event promptkit.ExecutionEvent) { events = append(events, event) }
|
||||
result, err := engine.Run(context.Background(), req)
|
||||
if err != nil || result == nil || !result.Validation.IsValid || calls != 4 || notifications != 1 {
|
||||
@@ -96,7 +96,7 @@ func reliabilityConfig(backends, profiles map[string]any) promptkit.Config {
|
||||
}
|
||||
return result
|
||||
}
|
||||
return promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{Source: configkit.Mapping("reliable execution", map[string]any{
|
||||
return promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{Destination: configkit.Keys("promptkit"), Source: configkit.Mapping("reliable execution", map[string]any{
|
||||
"backends": records(backends),
|
||||
"profiles": records(profiles),
|
||||
"prompts": []any{map[string]any{"id": "prompt",
|
||||
@@ -164,7 +164,7 @@ func TestProfilesSharingBackendCoordinateRetryRepairAndAdmission(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second)
|
||||
defer cancel()
|
||||
resultA := make(chan capacityRunResult, 1)
|
||||
requestA := promptkit.RunRequest{PromptID: "prompt", Validation: &promptkit.OutputContract{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: 1}}
|
||||
requestA := promptkit.RunRequest{PromptID: "prompt", Validation: &promptkit.OutputContractInput{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSON, RepairAttempts: new(1)}}
|
||||
go runCapacityRequest(engine, ctx, requestA, resultA)
|
||||
select {
|
||||
case <-firstA:
|
||||
@@ -301,8 +301,8 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
|
||||
endpoint, model := "https://example.invalid/v1", "model"
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{
|
||||
Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{
|
||||
{Inputs: inputs},
|
||||
{Inputs: []configkit.Input{{Source: promptkit.ProfileSource("profile", []promptkit.ProfileConfig{
|
||||
{Inputs: mountSettingsInputs(inputs)},
|
||||
{Inputs: []configkit.Input{{Destination: configkit.Keys("promptkit"), Source: promptkit.ProfileSource("profile", []promptkit.ProfileConfig{
|
||||
{ID: "profile", Endpoint: &endpoint, Model: &model},
|
||||
})}}},
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user