1 Introduction to prompt programming and DSPy
This chapter covers
- The concept of prompt programming
- The DSPy framework
- A comparison of prompt programming and prompt engineering
- The limitations of prompt engineering
The initial phase of building large language model (LLM)–based applications has an almost intoxicating effect. You can write a prompt asking to summarize an article and get it done in an instant. However, when inspecting the summary, you might find it missed the most important fact. So you try to change the prompt and check again. This time it misses a different fact. Does this hit-and-miss process sound familiar?
Language models (LMs) can be sensitive to the specific prompts we give them; even slightly different prompts can elicit different responses, and some may be much more effective than others. So when developing LM-based applications, we often have to test and evaluate many variations before we can identify high-quality prompts. This is typically a trial-and-error process, and it is usually difficult and time consuming.