A persona_frame bundles the brief a model reads (text, the only thing
the model sees) with the provenance that makes a synthetic persona
inspectable: its source, the scope conditions it is meant to hold under,
the attributes that were varied to produce it, an optional variant_of
parent hash, and a stable content hash (via hash_persona()). A frame is a
drop-in replacement for a plain-string persona anywhere agent() accepts
one: as.character() returns its text, and the Agent reads text
directly while keeping the frame for provenance.
Usage
persona_frame(
text,
source = NULL,
scope = NULL,
attributes = NULL,
variant_of = NULL,
id = NULL
)
# S3 method for class 'persona_frame'
print(x, ...)
# S3 method for class 'persona_frame'
as.character(x, ...)Arguments
- text
The persona brief (character scalar): who this person is, what they want, how they speak. The only field the model sees.
- source
Where the brief came from, e.g.
"synthetic","interview-grounded","literature", orNULLif unrecorded.- scope
Optional named list of scope conditions the persona is meant to hold under (e.g.
list(country = "US", year = 2024)); recorded as provenance, not enforced.- attributes
Optional named list of the dimensions varied to produce this brief (e.g.
list(age = "52", risk = "cautious")).- variant_of
Optional parent persona hash this frame was derived from.
- id
Optional explicit identifier; ignored for hashing (the
hashis always content-derived) but kept on the object when supplied.- x
A
persona_frame.- ...
Ignored.
Value
An object of class persona_frame: a list with text, source,
scope, attributes, variant_of, id, and hash.
Details
Provenance, not authority: a persona is a prompt with a provenance record, never a
claim that the model speaks for the people it sketches. Pair with
persona_audit() before trusting a brief, and with persona_variants() to
turn one frame into a designed set.
Examples
p <- persona_frame(
"A retired schoolteacher who reads the local paper and distrusts polls.",
source = "synthetic",
scope = list(country = "US"))
print(p)
as.character(p) # the brief, usable wherever a string persona is
if (FALSE) { # \dontrun{
cfg <- LLMR::llm_config("groq", "openai/gpt-oss-20b")
a <- agent("Voter", cfg, persona = p) # the frame is accepted directly
a$persona_frame()$hash # provenance is preserved
} # }