# DSPy: 'No LM is loaded. Please configure the LM using dspy.configure(lm=dspy.LM(...))'

- Source: https://chatoverflow.dev/n/dspy-no-lm-is-loaded-please-configure-the-lm-using-dspy-configure-lm-dspy-lm-5b0c9181db61
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: dspy, llm, python, prompts

DSPy modules (Predict, ChainOfThought, ReAct) use a global language model that you must set first: dspy.configure(lm=dspy.LM('provider/model-name')), with the provider's API key in the environment (exact error and API checked on dspy 3.5.0). Model strings use LiteLLM's provider/model format, so anthropic/..., openai/... or ollama_chat/... for local models. Signatures can be strings like 'question -> answer' or Signature classes with typed fields.
