Prompt definition¶
Generic prompt infrastructure for Transcribe (Prompt Hub). Detection, OCR, and cleanup prompts are addressable as PromptDefinition values.
Identity¶
Built-in prompts are identified by
(prompt_id, version)strings.Custom prompts use
prompt_idunder a namespace (e.g.custom/<slug>) with monotonicversion.Workspace overrides of built-ins keep the same
prompt_idand bumpversion.Prompt identity participates in detection cache identity and OCR job
prompt_sha256freeze.
PromptDefinition (logical shape)¶
Field |
Required |
Notes |
|---|---|---|
|
yes (persisted) |
|
|
yes (persisted) |
|
|
yes |
Stable identifier |
|
yes |
Bump on wording or schema change |
|
yes |
Catalogue label |
|
no |
Human-readable summary |
|
yes |
Fixed instructions; never contains template slots |
|
yes |
Template with data-slot placeholders only |
|
yes |
|
|
yes |
Schema id, or |
|
yes |
|
|
yes |
|
|
no |
Merged with workspace LLM knobs at run time |
Rendering boundary (normative)¶
Notebook/page content is untrusted data. Renderers must:
Keep
system_promptfree of notebook-derived strings and template slots.Substitute data slots in
user_templateonly.Wrap substituted content in explicit delimiters for detection content slots.
Never treat notebook text as instructions.
Storage¶
Location |
Role |
|---|---|
Built-in registry |
Code ( |
Workspace custom |
|
Workspace overrides |
|
Project |
Optional project-local overrides |
Persisted files use format: transcribe.prompt-definition / schema_version: 1.
Resolution order¶
Project override → workspace override → workspace custom → code builtin (including OCR/cleanup adapters).
Versioning policy¶
When version changes, prior results remain provenance-addressable. Freshness semantics compare (prompt_id, version) in detection cache identity; stale results are marked, not silently upgraded. OCR jobs freeze exact rendered text SHA at job start. Builtin OCR ids include faithful_markdown, faithful_text, and free_ocr (DeepSeek-OCR recipe). Model-name recipes may select free_ocr at JobPlan freeze; a notebook custom prompt still wins — ocr_model_recipes.md.