Consolidate generated text test ownership
This commit is contained in:
@@ -222,6 +222,7 @@ func TestSchemasAreCanonicalAndIndependent(t *testing.T) {
|
||||
if schema.Type != "object" || schema.AdditionalProperties || strings.Join(schema.Required, ",") != "summary,forecast_discussion,precipitation_timing" {
|
||||
t.Fatalf("schema = %#v, want strict generated-text object", schema)
|
||||
}
|
||||
assertGeneratedTextSchemaShape(t, id, schema.Properties)
|
||||
if _, ok := schema.Properties["confidence"]; ok {
|
||||
t.Fatalf("schema properties = %#v, do not want retired confidence field", schema.Properties)
|
||||
}
|
||||
@@ -237,6 +238,34 @@ func TestSchemasAreCanonicalAndIndependent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func assertGeneratedTextSchemaShape(t *testing.T, id string, properties map[string]any) {
|
||||
t.Helper()
|
||||
for _, name := range []string{"summary", "precipitation_timing"} {
|
||||
property, ok := properties[name].(map[string]any)
|
||||
if !ok || property["type"] != "string" {
|
||||
t.Fatalf("schema property %q = %#v, want string", name, properties[name])
|
||||
}
|
||||
}
|
||||
|
||||
discussion, ok := properties["forecast_discussion"].(map[string]any)
|
||||
if !ok {
|
||||
t.Fatalf("schema forecast_discussion = %#v, want property", properties["forecast_discussion"])
|
||||
}
|
||||
if id == "hourly" {
|
||||
if discussion["type"] != "string" || discussion["maxLength"] != float64(12_000) {
|
||||
t.Fatalf("hourly forecast_discussion = %#v, want bounded string", discussion)
|
||||
}
|
||||
return
|
||||
}
|
||||
if discussion["type"] != "array" || discussion["minItems"] != float64(1) || discussion["maxItems"] != float64(12) {
|
||||
t.Fatalf("%s forecast_discussion = %#v, want bounded non-empty array", id, discussion)
|
||||
}
|
||||
items, ok := discussion["items"].(map[string]any)
|
||||
if !ok || items["type"] != "string" || items["maxLength"] != float64(4_000) {
|
||||
t.Fatalf("%s forecast_discussion items = %#v, want bounded strings", id, discussion["items"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestPromptkitInspectsEmbeddedPromptsOffline(t *testing.T) {
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{},
|
||||
promptkit.WithPromptFS(promptassets.PromptFS(), "."),
|
||||
|
||||
Reference in New Issue
Block a user