Prompt
A versioned prompt template with variable substitution.
Prompts are stored and versioned on the Judgment platform. Use
{{variable}} placeholders in the template, then call .compile()
to substitute values at runtime. Each version gets a unique commit_id
and can be tagged (e.g. "production", "staging").
prompt = client.prompts.get(name="system-prompt", tag="production")
text = prompt.compile(product="Acme Search", tone="friendly")
print(text)
Attributes
PropType
name?str
Prompt name.
Type
strprompt?str
The template string with {{variable}} placeholders.
Type
strcreated_at?str
ISO-8601 creation timestamp.
Type
strtags?List[str]
Tags on this version (e.g. ["production"]).
Type
List[str]commit_id?str
Unique identifier for this version.
Type
strparent_commit_id?Optional[str]
The previous version's commit ID.
Type
Optional[str]Default
Nonemetadata?Dict[str, str]
Creator information.
Type
Dict[str, str]Default
field(default_factory=dict)compile()
Fill in template variables and return the final prompt string.
ValueError: If a required variable is not provided.
prompt = client.prompts.get(name="system-prompt", tag="production")
# Template: "You are a {{tone}} assistant for {{product}}."
text = prompt.compile(tone="helpful", product="Acme Search")
# "You are a helpful assistant for Acme Search."
def compile(**kwargs) -> str:
Parameters
PropType
kwargs?Any
Type
AnyDefault
{}Returns
str - The prompt with all variables substituted.