Render captured prompt templates without reloading sources
This commit is contained in:
@@ -2,6 +2,18 @@ package prompt
|
||||
|
||||
import "text/template"
|
||||
|
||||
// CompiledTemplates is the immutable parsed template set for one captured
|
||||
// prompt. Callers must not mutate its templates after handing it to a renderer.
|
||||
type CompiledTemplates struct {
|
||||
Session *template.Template
|
||||
Messages []*template.Template
|
||||
}
|
||||
|
||||
// TemplateLookup provides parsed templates for a captured prompt identity.
|
||||
type TemplateLookup interface {
|
||||
GetCompiledTemplates(id, version string) (CompiledTemplates, bool)
|
||||
}
|
||||
|
||||
// CompileTemplate checks static syntax with the same grammar and function
|
||||
// names as rendering, without evaluating request inputs or variables.
|
||||
func CompileTemplate(name, raw string) (*template.Template, error) {
|
||||
|
||||
Reference in New Issue
Block a user