Update public preparation and execution fixtures

This commit is contained in:
2026-11-02 12:53:00 +00:00
parent 3e67743fbf
commit f661176b06
6 changed files with 71 additions and 72 deletions

View File

@@ -83,11 +83,21 @@ func TestPublicRetryRepairSequenceKeepsUsageAndEventsConsistent(t *testing.T) {
}
func reliabilityConfig(backends, profiles map[string]any) promptkit.Config {
records := func(values map[string]any) []any {
result := make([]any, 0, len(values))
for id, value := range values {
record := map[string]any{"id": id}
for key, field := range value.(map[string]any) {
record[key] = field
}
result = append(result, record)
}
return result
}
return promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{Source: configkit.Mapping("reliable execution", map[string]any{
"backends": backends,
"profiles": profiles,
"prompts": map[string]any{"prompt": map[string]any{
"version": "1",
"backends": records(backends),
"profiles": records(profiles),
"prompts": []any{map[string]any{"id": "prompt",
"default_profile": "profile-a",
"messages": []any{map[string]any{"role": "user", "content": "hello"}},
"output": map[string]any{"format": "text", "validation_mode": "none"},
@@ -252,8 +262,7 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
const envName = "PROMPTKIT_PREPARED_RETRY_KEY"
t.Setenv(envName, "first-key")
source := fstest.MapFS{"prompt.yaml": &fstest.MapFile{Data: []byte(`prompts:
prompt:
version: "1"
- id: prompt
default_profile: profile
messages:
- role: user
@@ -291,8 +300,8 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
engine, err := promptkit.NewEngine(promptkit.Config{
Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{
{Inputs: inputs},
{Inputs: []configkit.Input{{Source: promptkit.ProfileSource("profile", map[string]promptkit.ProfileConfig{
"profile": {Endpoint: &endpoint, Model: &model},
{Inputs: []configkit.Input{{Source: promptkit.ProfileSource("profile", []promptkit.ProfileConfig{
{ID: "profile", Endpoint: &endpoint, Model: &model},
})}}},
}},
HTTPClient: &http.Client{Transport: transport}, TransientRetries: &one,
@@ -306,8 +315,7 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
t.Fatal(err)
}
source["prompt.yaml"] = &fstest.MapFile{Data: []byte(`prompts:
prompt:
version: "1"
- id: prompt
default_profile: profile
messages:
- role: user