AI Engineer Portal
Your personal operating system for career transition.
Exercise
Implement a prompt version registry
Implement a Prompt Version Registry
When you run A/B evals or regression tests across prompt versions, you need a lightweight registry that ties eval results back to exactly the prompt text and metadata that generated them.
What to build
Implement PromptRegistry:
-
register(name, template, version, metadata=None) -> str— Returns a deterministicprompt_idas"{name}:{version}". RaisesValueErrorif that prompt_id already exists. -
render(prompt_id, variables: dict) -> str— Substitutes{variable}placeholders in the template. RaisesKeyErrorif a required variable is missing. -
get(prompt_id) -> dict— Returns{"prompt_id", "name", "version", "template", "metadata"}. RaisesKeyErrorif not found. -
list_versions(name) -> list[str]— Returns prompt_ids for all versions of a named prompt, sorted lexicographically. -
diff(prompt_id_a, prompt_id_b) -> dict— Returns{"same": bool, "template_a", "template_b"}showing the two templates side by side.
Constraints
- Standard library only. Templates use Python
str.format_mapstyle{variable}placeholders.
Evaluation / medium / Step 28 of 36
Evaluation and review loops
Separate the scoring logic from the interpretation logic. Your goal is not just a number; it is a useful next action.
- - Produces a useful signal, not decorative output
- - Makes regression review easier
- - Would support a benchmark or observability loop
- - Would this output help decide what to fix next?
- - Are important failure modes visible?
- - Does the score hide any ambiguity I should record?
Practice
Generate a variation
Generate a new exercise variation to deepen understanding or practice a related concept.
Attempt history
Recent submissions
Before you submit, decide what a strong answer should make obvious to the reviewer.
No attempts yet.