I am a big fan and active user of instructor to make interactions with inherently probabilistic LMs more structured and reliable in the form of their output. Without approaches like this, making LMs work reliably in certain production settings would be a true nightmare.
This is a really cool intro video by Connor Shorten (of Weaviate) to structured outputs in general and specifically using instructor and DSPy. DSPy is another cool project and idea that, simply put, makes working with LM-based systems feel again like ML engineering and not like a game of tipping LMs to produce the right output or threatening to harm a kitten (aka prompt engineering).
So I recommend watching this video. In particular, pay attention to:
- the example of the structure outputs (using instructor) in the beginning,
- DSPy’s approach to structured outputs using DSPy’s TypedPredictor,
- how to use DSPy’s Assertions and Guardrails to implement a similar, (in the Mistral case) more robust behavior.
There is a lot going on in this video, so maybe I will try to break these topics down in a future post.