Skip to contents

gptr_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(), a gptr_session (its frozen prompt and first message) or NULL (what a new session would freeze now with the current settings); for print(), a gptr_prompt_view.

preset

NULL or 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

TRUE to 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.

Examples

v = gptr_prompt(preset = "minimal")
v$sections
#>       name tier tokens
#> 1 preamble   T0     42
#> 2    tools   T0     86
#> 3    rules   T0    348
#> 4    modes   T0     84
#> 5  context   T0    152