Design a Prompt Playground
Problem Statement
Design a prompt engineering playground similar to ChatGPT Playground or Anthropic Console. This is a product-focused system design question from a client engineer's perspective, emphasizing UX flows, client state management, streaming, performance, and how the frontend collaborates with backend services.
What is Prompt Engineering?
Prompt engineering is the process of iterating on input prompts to make a model better at performing specific tasks. Unlike conversational chat, playgrounds focus on stateless runs: each run is independent, but a single run can include multi-message context (system + user + assistant examples).
Example Workflow
A user wants to generate a recipe. They might:
- Start simple: "Write me a recipe"
- Iterate to improve: "You are a great chef who has written many cookbooks. Write me a recipe for..."
- Add examples: Include sample good/bad recipes for the model to learn from
- Keep refining until they get the desired output
- Save the successful prompt for future use
Disclaimer: This is a sample solution to help you get started. To better prepare for the interview, you should think through the question yourself and try to come up with your own solution. System design questions are open-ended and have multiple valid approaches.