MCPcopy Create free account
hub / github.com/cel-expr/cel-go / AuthoringPrompt

Function AuthoringPrompt

cel/prompt.go:64–81  ·  view source on GitHub ↗

AuthoringPrompt creates a prompt template from a CEL environment for the purpose of AI-assisted authoring.

(env *Env)

Source from the content-addressed store, hash-verified

62
63// AuthoringPrompt creates a prompt template from a CEL environment for the purpose of AI-assisted authoring.
64func AuthoringPrompt(env *Env) (*Prompt, error) {
65 funcMap := template.FuncMap{
66 "split": splitImpl,
67 "newlineToSpace": func(str string) string { return strings.ReplaceAll(str, "\n", " ") },
68 }
69 tmpl := template.New("cel").Funcs(funcMap)
70 tmpl, err := tmpl.Parse(authoringPrompt)
71 if err != nil {
72 return nil, err
73 }
74 return &Prompt{
75 Persona: defaultPersona,
76 FormatRules: defaultFormatRules,
77 GeneralUsage: defaultGeneralUsage,
78 tmpl: tmpl,
79 env: env,
80 }, nil
81}
82
83// AuthoringPromptWithFieldPaths creates a prompt template from a CEL environment for the purpose of AI-assisted authoring.
84// Includes documentation for all of the reachable field paths in the environment.

Callers 3

TestPromptTemplateFunction · 0.85

Calls 2

NewMethod · 0.80
ParseMethod · 0.65

Tested by 2

TestPromptTemplateFunction · 0.68