Show the frozen system prompt, tool array and first message
Source:R/prompt-sections.R
gptr_prompt.Rdgptr_prompt() shows what gptr sends before the conversation: the two system blocks (T0,
the static sections; T1, the machine and project sections), the tool array and the first
user message, with an estimated token count per section. It makes no model call and writes
nothing: a preview never consumes a pending plan and queues no message for the model.
Usage
gptr_prompt(x = NULL, preset = NULL, tokens = TRUE)
# S3 method for class 'gptr_prompt_view'
print(x, ...)Arguments
- x
For
gptr_prompt(), agptr_session(its frozen prompt and first message) orNULL(what a new session would freeze now with the current settings); forprint(), agptr_prompt_view.- preset
NULLor a preset name ("minimal","standard","readonly","extended", or one registered by a plugin or for the session) to preview instead of the frozen or configured one.- tokens
TRUEto add estimated token counts per section.- ...
Unused.
Value
A gptr_prompt_view: a list with system (list(t0, t1)), tools_json (the tool
array as JSON text), first_message (text), sections (data frame name, tier,
tokens) and total_tokens; the attributes preset and tool_names name the preset and
the declared tools. print() shows each part with its token estimate and returns x
invisibly.
Details
For a session, the view shows its frozen blocks (restored from its gptr.frozen entry when
needed) and the text of its first user message, context blocks included. With preset, for a
session that has not frozen its prompt yet, or for one whose next run freezes a fresh prompt
(resumed from a file of another project or one that git tracks), it composes what would be
frozen now.