|
|
|
|
@@ -34,11 +34,12 @@ func TestPromptAssetsDeclareTheFourGeneratedTextPrompts(t *testing.T) {
|
|
|
|
|
path string
|
|
|
|
|
id string
|
|
|
|
|
schemaID string
|
|
|
|
|
profile string
|
|
|
|
|
}{
|
|
|
|
|
{"daily/daily_generated_text.yml", "weather.daily_generated_text", "daily"},
|
|
|
|
|
{"today/today_generated_text.yml", "weather.today_generated_text", "today"},
|
|
|
|
|
{"tomorrow/tomorrow_generated_text.yml", "weather.tomorrow_generated_text", "tomorrow"},
|
|
|
|
|
{"hourly/hourly_generated_text.yml", "weather.hourly_generated_text", "hourly"},
|
|
|
|
|
{"daily/daily_generated_text.yml", "weather.daily_generated_text", "daily", "weather-balanced"},
|
|
|
|
|
{"today/today_generated_text.yml", "weather.today_generated_text", "today", "weather-balanced"},
|
|
|
|
|
{"tomorrow/tomorrow_generated_text.yml", "weather.tomorrow_generated_text", "tomorrow", "weather-balanced"},
|
|
|
|
|
{"hourly/hourly_generated_text.yml", "weather.hourly_generated_text", "hourly", "weather-light"},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
definitions := 0
|
|
|
|
|
@@ -67,8 +68,8 @@ func TestPromptAssetsDeclareTheFourGeneratedTextPrompts(t *testing.T) {
|
|
|
|
|
if err := yaml.Unmarshal(data, &definition); err != nil {
|
|
|
|
|
t.Fatalf("decode prompt definition: %v", err)
|
|
|
|
|
}
|
|
|
|
|
if definition.ID != tc.id || definition.Version != "1.0.1" || definition.DefaultProfile != "gemini-flash-latest" {
|
|
|
|
|
t.Fatalf("definition = %#v, want %s version 1.0.1 and gemini-flash-latest", definition, tc.id)
|
|
|
|
|
if definition.ID != tc.id || definition.Version != "1.1.0" || definition.DefaultProfile != tc.profile {
|
|
|
|
|
t.Fatalf("definition = %#v, want %s version 1.1.0 and profile %s", definition, tc.id, tc.profile)
|
|
|
|
|
}
|
|
|
|
|
if len(definition.Inputs) != 1 || definition.Inputs[0].Name != "data_package" || !definition.Inputs[0].Required || definition.Inputs[0].ContentType != "application/yaml" {
|
|
|
|
|
t.Fatalf("inputs = %#v, want one required YAML data_package", definition.Inputs)
|
|
|
|
|
@@ -123,21 +124,39 @@ func TestPromptkitInspectsEmbeddedPromptsOffline(t *testing.T) {
|
|
|
|
|
engine, err := promptkit.NewEngine(promptkit.Config{},
|
|
|
|
|
promptkit.WithPromptFS(promptassets.PromptFS(), "."),
|
|
|
|
|
promptkit.WithSchemaFS(promptassets.SchemaFS(), "."),
|
|
|
|
|
promptkit.WithFallbackProfileFS(promptassets.ProfileFS(), "."),
|
|
|
|
|
)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("NewEngine() error = %v", err)
|
|
|
|
|
}
|
|
|
|
|
for _, id := range []string{"weather.daily_generated_text", "weather.today_generated_text", "weather.tomorrow_generated_text", "weather.hourly_generated_text"} {
|
|
|
|
|
t.Run(id, func(t *testing.T) {
|
|
|
|
|
inspection, err := engine.InspectPrompt(context.Background(), id, "1.0.1")
|
|
|
|
|
for _, want := range []struct {
|
|
|
|
|
id string
|
|
|
|
|
profile string
|
|
|
|
|
model string
|
|
|
|
|
}{
|
|
|
|
|
{"weather.daily_generated_text", "weather-balanced", "~google/gemini-flash-latest"},
|
|
|
|
|
{"weather.today_generated_text", "weather-balanced", "~google/gemini-flash-latest"},
|
|
|
|
|
{"weather.tomorrow_generated_text", "weather-balanced", "~google/gemini-flash-latest"},
|
|
|
|
|
{"weather.hourly_generated_text", "weather-light", "deepseek/deepseek-v4-flash"},
|
|
|
|
|
} {
|
|
|
|
|
t.Run(want.id, func(t *testing.T) {
|
|
|
|
|
inspection, err := engine.InspectPrompt(context.Background(), want.id, "1.1.0")
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatalf("InspectPrompt() error = %v", err)
|
|
|
|
|
}
|
|
|
|
|
if inspection.PromptID != id || inspection.PromptVersion != "1.0.1" || inspection.DefaultProfileID != "gemini-flash-latest" {
|
|
|
|
|
if inspection.PromptID != want.id || inspection.PromptVersion != "1.1.0" || inspection.DefaultProfileID != want.profile {
|
|
|
|
|
t.Fatalf("inspection = %#v", inspection)
|
|
|
|
|
}
|
|
|
|
|
profile, err := engine.InspectProfile(context.Background(), inspection.DefaultProfileID)
|
|
|
|
|
if err != nil || profile.EffectiveModelParams.Model != want.model {
|
|
|
|
|
t.Fatalf("profile/error = %#v/%v, want model %q", profile, err, want.model)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
profile, err := engine.InspectProfile(context.Background(), "weather-deep")
|
|
|
|
|
if err != nil || profile.EffectiveModelParams.Model != "~anthropic/claude-sonnet-latest" {
|
|
|
|
|
t.Fatalf("weather-deep profile/error = %#v/%v", profile, err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestEmbeddedProfilesAreCompleteAndInspectable(t *testing.T) {
|
|
|
|
|
|