A language model (LM) generates or evaluates language from textual context. In DSPy, an LM is represented by an object that selects a model and can be configured for subsequent calls. section 2.4
Configure a model in DSPy
Create an LM object with a model name and API key, then pass it to dspy.configure(). The selected LM is used for subsequent calls until configuration changes. section 2.4
lm = dspy.LM(model='gpt-4o-mini', api_key=OPENAI_API_KEY) dspy.configure(lm=lm)
Shows the two-line setup for selecting and configuring an LM. section 2.4


































































