Skip to main content

OpenInference Instructor Instrumentation

pypi

Python auto-instrumentation library for the Instructor library.

These traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.

Installation

pip install openinference-instrumentation-instructor

Quickstart

This quickstart shows you how to instrument Instructor

Install required packages.

pip install instructor arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp

Start Phoenix in the background as a collector. By default, it listens on http://localhost:6006. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)

python -m phoenix.server.main serve

Set up InstructorInstrumentor to trace your application and send the traces to Phoenix at the endpoint defined below.

from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
from openinference.instrumentation.instructor import InstructorInstrumentor
from openinference.instrumentation.openai import OpenAIInstrumentor

InstructorInstrumentor().instrument(tracer_provider=tracer_provider)

# Optionally instrument the OpenAI SDK to get additional observability
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)

Simple Instructor example

import instructor
from pydantic import BaseModel
from openai import OpenAI


# Define your desired output structure
class UserInfo(BaseModel):
    name: str
    age: int


# Patch the OpenAI client
client = instructor.from_openai(OpenAI())

# Extract structured data from natural language
user_info = client.chat.completions.create(
    model="gpt-3.5-turbo",
    response_model=UserInfo,
    messages=[{"role": "user", "content": "John Doe is 30 years old."}],
)

More Info

Metadata

Release files for openinference-instrumentation-instructor 0.1.27

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openinference-instrumentation-instructor 0.1.27
File Size Uploaded
openinference_instrumentation_instructor-0.1.27.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openinference-instrumentation-instructor 0.1.27
File Interpreter ABI Platform
openinference_instrumentation_instructor-0.1.27-py3-none-any.whl Python 3 none any Details

Total release size: 32.0 kB

Release files / openinference_instrumentation_instructor-0.1.27.tar.gz

Download URL openinference_instrumentation_instructor-0.1.27.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0dc2986bfa54c7db14bb027da4c6b4cba9b545b98150baa686345a8268c925fa
BLAKE2b-256 checksum
How to use checksums
b24b71b93d30b3d3875b9957e52d69f4968557f49b00a1faae5a4b9fb93f382f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release files / openinference_instrumentation_instructor-0.1.27-py3-none-any.whl

Download URL openinference_instrumentation_instructor-0.1.27-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dac6a814701423b1c58102fc2f532d2d1f4a8a02054043683d956b12912c4144
BLAKE2b-256 checksum
How to use checksums
d6c4b0e5d752340930f2dc0ac18f14204971e34382b31f3e6342badc28e2ed93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.27 This release

2 release files

0.1.26

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page