ai.internal.make_role

Construct a typed role marker for structural prompt assembly. The `${role(...)}` desugar in an LLM prompt body lowers to this call.

Reference version

Signature

function ai.internal.make_role(
name: string,
metadata: map<string, baml.json.json> = …
) -> ai.Role throws never

Construct a typed role marker for structural prompt assembly. The ${role(...)} desugar in an LLM prompt body lowers to this call.

metadata is free-form per-message data, which reaches the client as ai.PromptMessage.metadata. The built-in clients do not read it.

Source:<builtin>/ai/ns_internal/prompt.bamlbytes 2598–2764