Setup
Install Instructor alongside the Braintrust SDK and OpenAI client:Trace with Instructor
When using Instructor with Braintrust, wrap the OpenAI client withwrap_openai before patching with Instructor. This ensures Braintrust captures the low-level metrics and headers from OpenAI.
trace-instructor.py
The order matters:
instructor.patch(wrap_openai(OpenAI())) ensures Braintrust captures complete metrics.