Skip to main content

Module system_prompt

Module system_prompt 

Source
Expand description

The system prompt: named sections the transcript holds and later patches.

Port of packages/coding-agent/src/core/system-prompt.ts in pi v1.0.0. The preamble and the documentation section name yapi, and the section points to the local docs, or to the published ones without a local copy.

Functions§

build_sections
The prompt’s sections in order, with docs in the documentation section. preamble is plain text. Every other section is wrapped in a tag of its name.
diff_sections
The section patch from what the model has to what it should have: changed or new sections, and None for removed ones. None when nothing changed.
render
The prompt as plain text, as the transcript renders it.
valid_section_name
Whether a custom section name is valid: a lowercase letter, then lowercase letters, digits, _ or -, and not preamble.