assemble_prompt

assemble_prompt#

rapidtools.gui.assemble_prompt(spec: PromptSpec) → str[source]#

Render a PromptSpec in the layout of the rapidtools sample prompts.

The result has these blocks, each omitted when it has nothing to say: TASK, ANALYSIS STEPS, ANALYSIS EDGE CASES, REQUIRED OUTPUT FORMAT, the rubric under rubric_title and CONTEXT AND BACKGROUND.

Parameters:

spec (PromptSpec) – The specification to render.

Returns:

str – The prompt text.

Example

>>> from rapidtools.gui.prompt_builder import (
...     OutputField, PromptSpec, assemble_prompt
... )
>>>
>>> text = assemble_prompt(PromptSpec(
...     asset='vehicle', imagery='street',
...     objective='classify the condition of the marked vehicle',
...     fields=[OutputField('Condition', options=['intact', 'damaged'])],
... ))
>>> 'Condition: [intact, damaged]' in text
True