A Prompt is a structured record of the text sent into a model: role-tagged messages, template variables, and a chosen tokenizer. Prompts are hashable, so a run's inputs are part of its fingerprint.
Why prompts are typed
A raw string discards the boundary between system and user turns, silently normalizes whitespace, and hides which tokenizer produced the IDs. A Prompt preserves all three, so two prompts that render to the same string but tokenize differently do not collide.
Shape
prompt.py··python
import neuronscope as ns
p = ns.Prompt.from_messages([
{"role": "system", "content": "You are terse."},
{"role": "user", "content": "Summarize {doc}"},
], variables={"doc": "..."}, tokenizer=model.tokenizer)
print(p.fingerprint().hex[:16])Canonical form
- Roles sorted by turn order, never by dict iteration order.
- Variable substitution applied before hashing, not after.
- Tokenizer fingerprint included — the same text against two vocabularies is two prompts.
Pitfalls
- Passing a raw string to the recorder bypasses prompt semantics — always wrap.
- Changing the tokenizer changes the prompt fingerprint even if IDs happen to match.
- Reusing variable names across nested templates is legal but confusing — prefer explicit namespacing.