Carry optional prompt labels through results
This commit is contained in:
@@ -52,7 +52,7 @@ func BenchmarkCompiledRendering(b *testing.B) {
|
||||
small := newCompiledRenderingBenchmarkCase(b,
|
||||
"small_message", "", []string{"Summary for {{.audience}}."},
|
||||
&domain.PromptDefinition{
|
||||
ID: "compiled-render-benchmark", Version: "v1",
|
||||
ID: "compiled-render-benchmark", Version: stringPointerForTest("v1"),
|
||||
Templates: []domain.PromptMessageTemplate{{Role: "user", Content: "Summary for {{.audience}}."}},
|
||||
}, nil, map[string]string{"audience": "project leads"},
|
||||
len("Summary for project leads."),
|
||||
@@ -68,7 +68,7 @@ func BenchmarkCompiledRendering(b *testing.B) {
|
||||
}
|
||||
largeContent := `{{input "document"}}`
|
||||
largeDefinition := &domain.PromptDefinition{
|
||||
ID: "compiled-render-benchmark", Version: "v1",
|
||||
ID: "compiled-render-benchmark", Version: stringPointerForTest("v1"),
|
||||
Inputs: []domain.PromptInput{{Name: "document"}},
|
||||
Templates: []domain.PromptMessageTemplate{{Role: "user", Content: largeContent}},
|
||||
}
|
||||
@@ -91,7 +91,7 @@ func BenchmarkCompiledRendering(b *testing.B) {
|
||||
`{{input "document"}}|{{input "document"}}`,
|
||||
}
|
||||
repeatedDefinition := &domain.PromptDefinition{
|
||||
ID: "compiled-render-benchmark", Version: "v1", SessionID: repeatedSession,
|
||||
ID: "compiled-render-benchmark", Version: stringPointerForTest("v1"), SessionID: repeatedSession,
|
||||
Inputs: []domain.PromptInput{{Name: "document"}},
|
||||
Templates: []domain.PromptMessageTemplate{
|
||||
{Role: "system", Content: repeatedMessages[0]},
|
||||
@@ -141,7 +141,7 @@ func BenchmarkRetainedRenderedOutput(b *testing.B) {
|
||||
bodyText := string(body)
|
||||
content := `{{input "document"}}`
|
||||
definition := &domain.PromptDefinition{
|
||||
ID: "retained-render-benchmark", Version: "v1",
|
||||
ID: "retained-render-benchmark", Version: stringPointerForTest("v1"),
|
||||
Inputs: []domain.PromptInput{{Name: "document"}},
|
||||
Templates: []domain.PromptMessageTemplate{{Role: "user", Content: content}},
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ func TestCompiledRendererKeepsConcurrentRequestsIndependent(t *testing.T) {
|
||||
},
|
||||
})
|
||||
definition := &domain.PromptDefinition{
|
||||
ID: promptID, Version: version, SessionID: "session-{{.request}}",
|
||||
ID: promptID, Version: stringPointerForTest(version), SessionID: "session-{{.request}}",
|
||||
Inputs: []domain.PromptInput{{Name: "document"}},
|
||||
Templates: []domain.PromptMessageTemplate{{Role: "user", Content: `request={{.request}};document={{input "document"}}`}},
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ func AnalyzeRequirements(
|
||||
result := domain.RequirementInspection{Complete: true}
|
||||
if definition != nil {
|
||||
result.PromptID = definition.ID
|
||||
result.PromptVersion = definition.Version
|
||||
result.PromptVersion = copyString(definition.Version)
|
||||
}
|
||||
walker := &requirementWalker{
|
||||
ctx: ctx,
|
||||
|
||||
@@ -108,7 +108,7 @@ func TestRequirementWalkerDoesNotRescanNestedUnsupportedNames(t *testing.T) {
|
||||
|
||||
func TestAnalyzeRequirementsCollectsDeclaredAndLiteralInputs(t *testing.T) {
|
||||
description := "retained metadata"
|
||||
definition := &domain.PromptDefinition{ID: "capture", Version: "v1"}
|
||||
definition := &domain.PromptDefinition{ID: "capture", Version: stringPointerForTest("v1")}
|
||||
snapshot := RequirementSnapshot{
|
||||
Inputs: []InputMetadata{
|
||||
{Name: "optional", ContentType: stringPointerForTest("text/plain"), Description: &description},
|
||||
@@ -123,7 +123,7 @@ func TestAnalyzeRequirementsCollectsDeclaredAndLiteralInputs(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if result.PromptID != "capture" || result.PromptVersion != "v1" || !result.Complete || len(result.Issues) != 0 {
|
||||
if result.PromptID != "capture" || result.PromptVersion == nil || *result.PromptVersion != "v1" || !result.Complete || len(result.Issues) != 0 {
|
||||
t.Fatalf("unexpected result identity or completeness: %+v", result)
|
||||
}
|
||||
wantNames := []string{"extra", "optional", "transcript", "unused"}
|
||||
|
||||
Reference in New Issue
Block a user