Migrate native PromptKit test fixtures
This commit is contained in:
@@ -18,8 +18,7 @@ import (
|
||||
)
|
||||
|
||||
const adapterPrompt = `prompts:
|
||||
briefing:
|
||||
version: "1"
|
||||
- id: briefing
|
||||
default_profile: default
|
||||
inputs:
|
||||
- name: topic
|
||||
@@ -36,8 +35,7 @@ const adapterPrompt = `prompts:
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
empty:
|
||||
version: "1"
|
||||
- id: empty
|
||||
default_profile: default
|
||||
messages:
|
||||
- role: user
|
||||
@@ -46,10 +44,10 @@ const adapterPrompt = `prompts:
|
||||
format: text
|
||||
validation_mode: none
|
||||
backends:
|
||||
local:
|
||||
- id: local
|
||||
endpoint: "https://example.invalid/v1"
|
||||
profiles:
|
||||
default:
|
||||
- id: default
|
||||
backend: local
|
||||
model: example
|
||||
temperature: 0
|
||||
@@ -61,15 +59,14 @@ profiles:
|
||||
visible: true
|
||||
null_value: null
|
||||
sequence: [first, null, 3]
|
||||
requires-key:
|
||||
- id: requires-key
|
||||
backend: local
|
||||
model: example
|
||||
api_key_required: true
|
||||
`
|
||||
|
||||
const adapterRequirementsPrompt = `prompts:
|
||||
briefing:
|
||||
version: "1"
|
||||
- id: briefing
|
||||
default_profile: default
|
||||
session_id: '{{input "session-only"}} {{.session_variable}}'
|
||||
messages:
|
||||
@@ -79,10 +76,10 @@ const adapterRequirementsPrompt = `prompts:
|
||||
format: text
|
||||
validation_mode: none
|
||||
backends:
|
||||
local:
|
||||
- id: local
|
||||
endpoint: "https://example.invalid/v1"
|
||||
profiles:
|
||||
default:
|
||||
- id: default
|
||||
backend: local
|
||||
model: example
|
||||
`
|
||||
@@ -101,13 +98,22 @@ func adapterEngineFrom(t *testing.T, label, configuration string, options ...pro
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
||||
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
||||
}}, options...)
|
||||
}}, append([]promptkit.Option{promptkit.WithBundledOpenRouter(false)}, options...)...)
|
||||
if err != nil {
|
||||
t.Fatalf("construct PromptKit fixture: %v", err)
|
||||
}
|
||||
return engine
|
||||
}
|
||||
|
||||
func bundledEngine(t *testing.T) *promptkit.Engine {
|
||||
t.Helper()
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{})
|
||||
if err != nil {
|
||||
t.Fatalf("construct bundled PromptKit fixture: %v", err)
|
||||
}
|
||||
return engine
|
||||
}
|
||||
|
||||
type recordingSmokeClient struct {
|
||||
request promptkit.GenerateRequest
|
||||
response *promptkit.GenerateResponse
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.maximumdirect.net/ckconfig"
|
||||
"go.maximumdirect.net/ckprompt"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.yaml.in/yaml/v4"
|
||||
)
|
||||
|
||||
@@ -224,8 +224,7 @@ func TestPublicConfigDiffDiscoveryAndNarrowedCapabilities(t *testing.T) {
|
||||
func comparisonEngine(t *testing.T, greeting string) *promptkit.Engine {
|
||||
t.Helper()
|
||||
configuration := `prompts:
|
||||
briefing:
|
||||
version: "1"
|
||||
- id: briefing
|
||||
default_profile: default
|
||||
messages:
|
||||
- role: user
|
||||
@@ -234,10 +233,10 @@ func comparisonEngine(t *testing.T, greeting string) *promptkit.Engine {
|
||||
format: text
|
||||
validation_mode: none
|
||||
backends:
|
||||
local:
|
||||
- id: local
|
||||
endpoint: "https://example.invalid/v1"
|
||||
profiles:
|
||||
default:
|
||||
- id: default
|
||||
backend: local
|
||||
model: example
|
||||
`
|
||||
@@ -248,7 +247,7 @@ profiles:
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}})
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}}, promptkit.WithBundledOpenRouter(false))
|
||||
if err != nil {
|
||||
t.Fatalf("construct comparison engine: %v", err)
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.maximumdirect.net/ckconfig"
|
||||
"go.maximumdirect.net/ckprompt"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
type compositionInput struct{ Campaign commandkit.Supplied[string] }
|
||||
@@ -144,8 +144,7 @@ func TestPromptKitAliasesComposeWithInstalledOperations(t *testing.T) {
|
||||
func TestPublicConfigurationAndDefinitionFamiliesRemainIndependent(t *testing.T) {
|
||||
inputs, err := promptkit.FilesystemInputs("composition fixture", fstest.MapFS{
|
||||
"config/prompts.yml": &fstest.MapFile{Data: []byte(`prompts:
|
||||
briefing:
|
||||
version: "1"
|
||||
- id: briefing
|
||||
default_profile: default
|
||||
messages:
|
||||
- role: user
|
||||
@@ -154,17 +153,17 @@ func TestPublicConfigurationAndDefinitionFamiliesRemainIndependent(t *testing.T)
|
||||
format: text
|
||||
validation_mode: none
|
||||
backends:
|
||||
local:
|
||||
- id: local
|
||||
endpoint: "https://example.invalid/v1"
|
||||
profiles:
|
||||
default:
|
||||
- id: default
|
||||
backend: local
|
||||
model: example
|
||||
`)}}, "config")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}})
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}}, promptkit.WithBundledOpenRouter(false))
|
||||
if err != nil {
|
||||
t.Fatalf("construct engine: %v", err)
|
||||
}
|
||||
|
||||
@@ -9,15 +9,14 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.maximumdirect.net/ckconfig"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.yaml.in/yaml/v4"
|
||||
)
|
||||
|
||||
const requirementsCommandPrompt = `prompts:
|
||||
briefing:
|
||||
version: "2"
|
||||
- id: briefing
|
||||
default_profile: editorial
|
||||
session_id: '{{input "session-only"}} {{.session_variable}}'
|
||||
messages:
|
||||
@@ -26,8 +25,7 @@ const requirementsCommandPrompt = `prompts:
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
required-variable:
|
||||
version: "1"
|
||||
- id: required-variable
|
||||
default_profile: editorial
|
||||
messages:
|
||||
- role: user
|
||||
@@ -35,7 +33,7 @@ const requirementsCommandPrompt = `prompts:
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
ambiguous-first:
|
||||
- id: ambiguous-first
|
||||
default_profile: editorial
|
||||
messages:
|
||||
- role: user
|
||||
@@ -43,7 +41,7 @@ const requirementsCommandPrompt = `prompts:
|
||||
output:
|
||||
format: text
|
||||
validation_mode: none
|
||||
ambiguous-second:
|
||||
- id: ambiguous-second
|
||||
default_profile: editorial
|
||||
messages:
|
||||
- role: user
|
||||
@@ -52,10 +50,10 @@ const requirementsCommandPrompt = `prompts:
|
||||
format: text
|
||||
validation_mode: none
|
||||
backends:
|
||||
local:
|
||||
- id: local
|
||||
endpoint: "https://example.invalid/v1"
|
||||
profiles:
|
||||
editorial:
|
||||
- id: editorial
|
||||
backend: local
|
||||
model: example
|
||||
api_key_required: true
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
"go.maximumdirect.net/ckconfig"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
configkit "go.maximumdirect.net/configkit"
|
||||
promptkit "go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
type validationFailOnGenerate struct{ calls int }
|
||||
@@ -37,7 +37,7 @@ func validationTestEngine(t *testing.T, configuration string, options ...promptk
|
||||
}
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
||||
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
||||
}}, options...)
|
||||
}}, append([]promptkit.Option{promptkit.WithBundledOpenRouter(false)}, options...)...)
|
||||
if err != nil {
|
||||
t.Fatalf("construct PromptKit validation fixture: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user