Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

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.

Typestr
prompt?str

The template string with {{variable}} placeholders.

Typestr
created_at?str

ISO-8601 creation timestamp.

Typestr
tags?List[str]

Tags on this version (e.g. ["production"]).

TypeList[str]
commit_id?str

Unique identifier for this version.

Typestr
parent_commit_id?Optional[str]

The previous version's commit ID.

TypeOptional[str]
DefaultNone
metadata?Dict[str, str]

Creator information.

TypeDict[str, str]
Defaultfield(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
TypeAny
Default{}

Returns

str - The prompt with all variables substituted.

Was this page helpful?