Remove prompt version selectors

This commit is contained in:
2026-10-17 05:47:14 +00:00
parent d40a010538
commit 8cbb7c0daf
36 changed files with 182 additions and 253 deletions

View File

@@ -19,8 +19,7 @@ var (
)
type rendererBenchmarkIdentity struct {
id string
version string
id string
}
type rendererBenchmarkLookup struct {
@@ -28,8 +27,8 @@ type rendererBenchmarkLookup struct {
templates CompiledTemplates
}
func (lookup rendererBenchmarkLookup) GetCompiledTemplates(id, version string) (CompiledTemplates, bool) {
if id != lookup.identity.id || version != lookup.identity.version {
func (lookup rendererBenchmarkLookup) GetCompiledTemplates(id string) (CompiledTemplates, bool) {
if id != lookup.identity.id {
return CompiledTemplates{}, false
}
return lookup.templates, true
@@ -148,7 +147,7 @@ func BenchmarkRetainedRenderedOutput(b *testing.B) {
}
compiled := CompiledTemplates{Messages: []*template.Template{mustCompileRendererBenchmarkTemplate(b, content)}}
renderer := NewCompiledRenderer(rendererBenchmarkLookup{
identity: rendererBenchmarkIdentity{id: definition.ID, version: definition.Version},
identity: rendererBenchmarkIdentity{id: definition.ID},
templates: compiled,
})
inputs := map[string]*domain.Artifact{"document": {Name: "document", Body: body}}
@@ -228,7 +227,7 @@ func newCompiledRenderingBenchmarkCase(
return compiledRenderingBenchmarkCase{
name: name,
renderer: NewCompiledRenderer(rendererBenchmarkLookup{
identity: rendererBenchmarkIdentity{id: definition.ID, version: definition.Version},
identity: rendererBenchmarkIdentity{id: definition.ID},
templates: compiled,
}),
definition: definition, inputs: inputs, vars: vars, ctx: context.Background(),

View File

@@ -59,7 +59,7 @@ func (r *goRenderer) Render(ctx context.Context, definition *domain.PromptDefini
var compiled CompiledTemplates
if r.templates != nil {
var found bool
compiled, found = r.templates.GetCompiledTemplates(definition.ID, definition.Version)
compiled, found = r.templates.GetCompiledTemplates(definition.ID)
if !found || len(compiled.Messages) != len(definition.Templates) {
return nil, fmt.Errorf("%w: captured templates are unavailable", ErrRenderFailure)
}

View File

@@ -518,8 +518,7 @@ func TestCompiledRendererKeepsConcurrentRequestsIndependent(t *testing.T) {
t.Fatalf("compile message template: %v", err)
}
renderer := NewCompiledRenderer(compiledRendererTestLookup{
id: promptID,
version: version,
id: promptID,
templates: CompiledTemplates{
Session: sessionTemplate,
Messages: []*template.Template{messageTemplate},
@@ -562,12 +561,12 @@ func TestCompiledRendererKeepsConcurrentRequestsIndependent(t *testing.T) {
}
type compiledRendererTestLookup struct {
id, version string
templates CompiledTemplates
id string
templates CompiledTemplates
}
func (lookup compiledRendererTestLookup) GetCompiledTemplates(id, version string) (CompiledTemplates, bool) {
if id != lookup.id || version != lookup.version {
func (lookup compiledRendererTestLookup) GetCompiledTemplates(id string) (CompiledTemplates, bool) {
if id != lookup.id {
return CompiledTemplates{}, false
}
return lookup.templates, true

View File

@@ -27,7 +27,7 @@ type RequirementSnapshot struct {
// TemplateLookup provides parsed templates for a captured prompt identity.
type TemplateLookup interface {
GetCompiledTemplates(id, version string) (CompiledTemplates, bool)
GetCompiledTemplates(id string) (CompiledTemplates, bool)
}
// CompileTemplate checks static syntax with the same grammar and function