High severity beginner · Fix: 2-5 min

ValueError

instructor.exceptions.ValueError

What this error means
The Instructor SDK requires a defined response_model field to parse LLM outputs, and this error occurs when that field is missing or not specified.

Stack trace

traceback
ValueError: Missing required 'response_model' field in Instructor call configuration
  File "/usr/local/lib/python3.10/site-packages/instructor/sdk.py", line 123, in call
    raise ValueError("Missing required 'response_model' field")
QUICK FIX
Add the response_model parameter with the correct output schema to your Instructor call immediately.

Why it happens

The Instructor SDK expects a response_model field to be explicitly defined to know how to parse and validate the LLM's output. If this field is omitted, the SDK cannot process the response, causing a ValueError.

Detection

Check your Instructor call configuration for the presence of the response_model field before making the API call, or catch ValueError exceptions and log the missing field error.

Causes & fixes

1

The response_model field is not set in the Instructor call parameters.

✓ Fix

Add a valid response_model parameter specifying the expected output schema or Pydantic model to the Instructor call.

2

Typo or incorrect field name used instead of response_model.

✓ Fix

Correct the parameter name to exactly 'response_model' with proper casing in the Instructor call.

3

Using an outdated version of the Instructor SDK that requires explicit response_model but it was omitted.

✓ Fix

Upgrade to the latest Instructor SDK version and ensure response_model is provided as per the updated API.

Code: broken vs fixed

Broken - triggers the error
python
from instructor import Instructor

client = Instructor()

# Missing response_model causes error
result = client.call(prompt="Summarize this text")  # ValueError here
Fixed - works correctly
python
import os
from instructor import Instructor
from pydantic import BaseModel

os.environ['INSTRUCTOR_API_KEY'] = os.environ.get('INSTRUCTOR_API_KEY', '')

class SummaryModel(BaseModel):
    summary: str

client = Instructor()

# Added response_model to fix error
result = client.call(prompt="Summarize this text", response_model=SummaryModel)
print(result.summary)
Added the required response_model parameter with a Pydantic model to instruct the SDK how to parse the LLM output.
⚠

Workaround

Catch the ValueError exception, then manually parse the raw LLM output string using your own JSON or regex parsing logic as a fallback.

✓

Prevention

Always define and validate a response_model schema when calling Instructor to ensure output parsing is explicit and reliable.

Python 3.9+ · instructor >=0.1.0 · tested on 0.2.0
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.