Registry /
observability / openinference-instrumentation-instructor
Install & Compatibility
Where this runs
tested against v0.1.17 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.478s · 24.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.9s · import 0.416s · 25MB
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
InstructorInstrumentor
✓ from openinference.instrumentation.instructor import InstructorInstrumentor
✗ from openinference_instrumentation_instructor import InstructorInstrumentor
Incorrect import path with hyphens in module name; use dots.
Instrument instructor to trace LLM calls and structured extraction. Ensure instructor and openai are installed.
import instructor
from openinference.instrumentation.instructor import InstructorInstrumentor
# Instrument before using instructor
InstructorInstrumentor().instrument()
# Now use instructor normally
client = instructor.from_openai(openai.OpenAI(api_key=os.environ.get('OPENAI_API_KEY', '')))
# Example: extract structured data
import pydantic
class User(pydantic.BaseModel):
name: str
age: int
user = client.chat.completions.create(model="gpt-4o", response_model=User, messages=[{"role": "user", "content": "John Doe is 30"}])
print(user.name, user.age)
Errors
Common errors & fixes
ImportError: cannot import name 'InstructorInstrumentor' from 'openinference_instrumentation_instructor'
Using hyphens in module path (incorrect import path).
fixUse: from openinference.instrumentation.instructor import InstructorInstrumentor
ModuleNotFoundError: No module named 'openinference_instrumentation_instructor'
Package not installed or using incorrect import name (should be dotted).
fixInstall: pip install openinference-instrumentation-instructor. Then import: from openinference.instrumentation.instructor import InstructorInstrumentor
Opentelemetry span not created for instructor calls
Instrumentation was called after creating the instructor client, or the OpenTelemetry exporter not configured.
fixCall InstructorInstrumentor().instrument() before any instructor usage, and configure an OTLP exporter (e.g., phoenix).
Upgrade
Version history
0.1.17latest on PyPI · released May 18, 2026
Audit
Dependencies
instructorrequiredInstruments the instructor library
openinference-instrumentationoptionalCore OpenInference instrumentation package