Test-driven Prompt Engineering
Similar to test-driven development (TDD) in software engineering, test-driven prompt engineering involves writing and running evaluations against new prompt versions before they are used in production. This proactive testing ensures that new prompts meet predefined criteria and behave as expected, minimizing the risk of unintended consequences. Setting up automatic evaluations on a specific prompt template is easy. When creating a new version, after adding a commit message, you will be prompted to select an evaluation pipeline to run. After doing this once, every new prompt template you create will run this pipeline by default.Testing Strategies
Backtesting
Backtesting involves running new prompt versions against a dataset compiled from historical production data. This strategy provides a real-world context for evaluating prompts, allowing you to assess how new versions would have performed under past conditions. It’s an effective way to detect potential regressions and validate improvements, ensuring that updates enhance rather than detract from the user experience. To set up backtests, follow the steps below: 1. Create a historical dataset Create a dataset using a search query. For example, I might want to create a dataset using all logged requests:- That use
my_prompt_templateversion 6 or version 5 - That were made in the last 2 months
- That were using the tag
prod - That users gave a 👍 response to

