respan-instrumentation-instructor
Respan instrumentation plugin for Instructor. This package instruments Instructor's native patch() and Instructor.create() paths directly and emits Respan-compatible chat spans without using openinference-instrumentation-instructor.
Configuration
1. Install
pip install respan-instrumentation-instructor
2. Set Environment Variables
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Your Respan API key. Authenticates both proxy and tracing. |
RESPAN_BASE_URL |
No | Defaults to https://api.respan.ai/api. |
Quickstart
3. Run Script
import os
import instructor
from dotenv import load_dotenv
from openai import OpenAI
from pydantic import BaseModel
from respan import Respan
from respan_instrumentation_instructor import InstructorInstrumentor
load_dotenv()
respan_api_key = os.environ["RESPAN_API_KEY"]
respan_base_url = os.getenv("RESPAN_BASE_URL", "https://api.respan.ai/api")
# Route OpenAI traffic through the Respan gateway.
os.environ["OPENAI_API_KEY"] = respan_api_key
os.environ["OPENAI_BASE_URL"] = respan_base_url
class UserInfo(BaseModel):
name: str
age: int
respan = Respan(
api_key=respan_api_key,
base_url=respan_base_url,
app_name="instructor-quickstart",
instrumentations=[InstructorInstrumentor()],
)
client = instructor.from_openai(OpenAI())
user_info = client.create(
response_model=UserInfo,
messages=[{"role": "user", "content": "Ada Lovelace is 36 years old."}],
model="gpt-4o-mini",
)
print(user_info.model_dump())
respan.flush()
4. View Dashboard
After running the script, traces appear on your Respan dashboard.
Further Reading
Runnable examples with full setup instructions:
- Python: python/tracing/instructor
Metadata
Release files for respan-instrumentation-instructor 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| respan_instrumentation_instructor-0.1.1.tar.gz | 9.4 kB | Without provenance | Details for respan_instrumentation_instructor-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| respan_instrumentation_instructor-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for respan_instrumentation_instructor-0.1.1-py3-none-any.whl |
Total release size: 19.2 kB
Release files / respan_instrumentation_instructor-0.1.1.tar.gz
| Download URL | respan_instrumentation_instructor-0.1.1.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eba7b1bffdd76d2271494af4363b037da23b0174ad17c1d1625cba9f17d36a07
|
|
BLAKE2b-256 checksum How to use checksums |
6000fe0eca37c432e7c63d19c7e17bcf78f90bfad9933b8c816f60a4eb4023b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_instructor-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_instructor-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a6365c1a88caaecce58b1901402da7ea3bb23647f49f32d1136e9a35fe900bb
|
|
BLAKE2b-256 checksum How to use checksums |
8bd69df4ebae89eb27f954f9624b1d30f94d9bf4f883fbba4e18e7fb42756a6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for respan-instrumentation-instructor 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.