Store one prompt definition per ID
This commit is contained in:
@@ -86,11 +86,12 @@ func reliabilityConfig(backends, profiles map[string]any) promptkit.Config {
|
||||
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{"1": map[string]any{
|
||||
"prompts": map[string]any{"prompt": map[string]any{
|
||||
"version": "1",
|
||||
"default_profile": "profile-a",
|
||||
"messages": []any{map[string]any{"role": "user", "content": "hello"}},
|
||||
"output": map[string]any{"format": "text", "validation_mode": "none"},
|
||||
}}},
|
||||
}},
|
||||
})}}}
|
||||
}
|
||||
|
||||
@@ -252,14 +253,14 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
|
||||
t.Setenv(envName, "first-key")
|
||||
source := fstest.MapFS{"prompt.yaml": &fstest.MapFile{Data: []byte(`prompts:
|
||||
prompt:
|
||||
"1":
|
||||
default_profile: profile
|
||||
messages:
|
||||
- role: user
|
||||
content: original message
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
version: "1"
|
||||
default_profile: profile
|
||||
messages:
|
||||
- role: user
|
||||
content: original message
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
`)}}
|
||||
var calls int
|
||||
var auth, content []string
|
||||
@@ -306,14 +307,14 @@ func TestPreparedRetriesFreezeSourceAndCredentialAtExecution(t *testing.T) {
|
||||
}
|
||||
source["prompt.yaml"] = &fstest.MapFile{Data: []byte(`prompts:
|
||||
prompt:
|
||||
"1":
|
||||
default_profile: profile
|
||||
messages:
|
||||
- role: user
|
||||
content: changed message
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
version: "1"
|
||||
default_profile: profile
|
||||
messages:
|
||||
- role: user
|
||||
content: changed message
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
`)}
|
||||
result, err := engine.RunPrepared(context.Background(), prepared)
|
||||
if err != nil || result == nil || calls != 2 {
|
||||
|
||||
Reference in New Issue
Block a user