Migrate facade tests to the new configuration contracts
This commit is contained in:
@@ -36,7 +36,7 @@ func TestPreparedExecutionFreezesSourcesAndReturnsIndependentDetails(t *testing.
|
||||
t.Fatal(err)
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{
|
||||
{Inputs: profileInputs}, {Inputs: promptInputs}, {Inputs: []configkit.Input{schemaRootInput(schemaSource, ".")}},
|
||||
{Inputs: mountSettingsInputs(profileInputs)}, {Inputs: mountSettingsInputs(promptInputs)}, {Inputs: []configkit.Input{schemaRootInput(schemaSource, ".")}},
|
||||
}}},
|
||||
promptkit.WithArtifactReader(reader),
|
||||
promptkit.WithLLMClient(client),
|
||||
@@ -315,10 +315,10 @@ func TestPreparedExecutionRepairsEmptyBasicOutput(t *testing.T) {
|
||||
engine := newPreparedContractEngine(t, client, "Summarize the source.")
|
||||
prepared, err := engine.PrepareExecution(context.Background(), promptkit.RunRequest{
|
||||
PromptID: "prepared", CaptureExchange: true,
|
||||
Validation: &promptkit.OutputContract{
|
||||
Validation: &promptkit.OutputContractInput{
|
||||
Format: promptkit.FormatMarkdown,
|
||||
ValidationMode: promptkit.ValidationBasic,
|
||||
RepairAttempts: 1,
|
||||
RepairAttempts: new(1),
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -362,7 +362,7 @@ func TestPreparedExecutionIsolatesMutatingClientAcrossRepair(t *testing.T) {
|
||||
Execution: &promptkit.ExecutionTargetOverride{ExtraParams: map[string]any{
|
||||
"nested": map[string]any{"value": "original"},
|
||||
}},
|
||||
Validation: &promptkit.OutputContract{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSONSchema, SchemaPath: "schema.json", RepairAttempts: 1},
|
||||
Validation: &promptkit.OutputContractInput{Format: promptkit.FormatJSON, ValidationMode: promptkit.ValidationJSONSchema, SchemaPath: "schema.json", RepairAttempts: new(1)},
|
||||
AppendedMessages: []promptkit.RenderedMessage{{Role: "user", Content: "appended", CacheControl: &promptkit.CacheControl{Type: promptkit.CacheControlEphemeral, TTL: "1h"}}},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -914,7 +914,7 @@ func newPreparedContractEngine(
|
||||
|
||||
func preparedContractConfig(message string, keyRequired bool) promptkit.Config {
|
||||
return promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
|
||||
Source: configkit.Mapping("prepared execution", map[string]any{
|
||||
Destination: configkit.Keys("promptkit"), Source: configkit.Mapping("prepared execution", map[string]any{
|
||||
"profiles": []any{map[string]any{"id": "profile",
|
||||
"endpoint": "http://example.test/v1", "model": "model", "api_key_required": keyRequired,
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user