Skip to content

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.

new Prompt(environment, includeFieldPaths?): Prompt

Creates a prompt associated with an environment.

Env

Environment supplies the variables, functions, macros, and types documented by the prompt.

boolean = false

IncludeFieldPaths controls whether reachable structure fields are documented.

Prompt

formatRules: string = DefaultFormatRules

FormatRules indicate how the LLM should generate its output.


generalUsage: string = DefaultGeneralUsage

GeneralUsage specifies additional context on how CEL should be used.


persona: string = DefaultPersona

Persona indicates something about the kind of user making the request.

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.

string

string