Prompt
Prompt represents the core components of an LLM prompt based on a CEL environment.
All public fields may be overwritten before rendering the prompt to a human-readable string.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Prompt(
environment,includeFieldPaths?):Prompt
Creates a prompt associated with an environment.
Parameters
Section titled “Parameters”environment
Section titled “environment”Environment supplies the variables, functions, macros, and types documented by the prompt.
includeFieldPaths?
Section titled “includeFieldPaths?”boolean = false
IncludeFieldPaths controls whether reachable structure fields are documented.
Returns
Section titled “Returns”Prompt
Properties
Section titled “Properties”formatRules
Section titled “formatRules”formatRules:
string=DefaultFormatRules
FormatRules indicate how the LLM should generate its output.
generalUsage
Section titled “generalUsage”generalUsage:
string=DefaultGeneralUsage
GeneralUsage specifies additional context on how CEL should be used.
persona
Section titled “persona”persona:
string=DefaultPersona
Persona indicates something about the kind of user making the request.
Methods
Section titled “Methods”render()
Section titled “render()”render(
userPrompt):string
Render renders the user prompt with the associated context from the prompt template for use with LLM generators.
User-supplied input is appended as a literal string value. Template action delimiters
such as {{.Persona}} in the user prompt are never evaluated as template directives.
Parameters
Section titled “Parameters”userPrompt
Section titled “userPrompt”string
Returns
Section titled “Returns”string