ze.get_prompt
to fetch team-managed prompts by slug
, pinned by version
or movable tag
. You can template variables, specify fallbacks, and associate results with a tuning task for observability.
Quick start
API
Version vs tag
- If
version
is provided, it is used andtag
is ignored. - If
version
is omitted, the effective tag istag
or a default resolved from the environment.
Default tag resolution
- Explicit env override:
ZEROEVAL_PROMPT_TAG
. - Else, if
ZEROEVAL_ENV == "production"
→production
; otherwise →latest
.
Variables and templating
- Use double braces in prompt content:
{{variable_name}}
. - If
variables
is provided andrender=True
, placeholders are replaced with their values. missing="error"
raises if a placeholder has no value;missing="leave"
leaves it intact.
Task association (autotune-friendly)
Passtask_name
to decorate p.content
so downstream LLM calls are traced to that task. The decoration includes prompt identifiers so spans link to the exact version.
Fallback content
Providefallback
to ensure resiliency if the prompt is missing or the network fails. The returned Prompt.source
will be "fallback"
in that case.
Namespace helper
ze.prompts.get("slug", **kwargs)
is a thin wrapper around ze.get_prompt
.
Examples
- Fetch latest (non-prod) or production (prod):
- Pin to a specific version:
- Render variables:
- Associate with a task for autotune: