Tracing Providers

OpenInference Integration

Export OpenInference traces to the Judgment platform.

OpenInference integration sends traces from your OpenInference-instrumented applications to Judgment. If you're already using OpenInference for observability, this integration forwards those traces to Judgment without requiring additional instrumentation.

Quickstart

Install Dependencies

uv add openinference-instrumentation-openai judgeval openai
pip install openinference-instrumentation-openai judgeval openai

Initialize Integration

setup.py
from judgeval import Tracer
from openinference.instrumentation.openai import OpenAIInstrumentor

Tracer.init(project_name="openinference_project")
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())

Add to Existing Code

Add these lines to your existing OpenInference-instrumented application:

from openai import OpenAI
from judgeval import Tracer  
from openinference.instrumentation.openai import OpenAIInstrumentor  

Tracer.init(project_name="openinference_project")  
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())  

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-5.2",
    messages=[{"role": "user", "content": "Hello, world!"}]
)

print(response.choices[0].message.content)

All OpenInference traces are exported to the Judgment platform.

Example: Multi-Workflow Application

Tracking Non-Instrumented Operations: Use @Tracer.observe() to track any function or method that's not automatically captured by OpenInference instrumentors. The multi-workflow example below shows how @Tracer.observe() (highlighted) can be used to monitor custom logic and operations that happen outside your OpenInference-instrumented workflows.

multi_workflow_example.py
from judgeval import Tracer
from openinference.instrumentation.openai import OpenAIInstrumentor
from openai import OpenAI

Tracer.init(project_name="openinference_project")
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())

client = OpenAI()

def analyze_sentiment(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a sentiment analysis expert."},
            {"role": "user", "content": f"Analyze the sentiment of: {text}"}
        ]
    )
    return response.choices[0].message.content

def extract_entities(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are an entity extraction expert."},
            {"role": "user", "content": f"Extract entities from: {text}"}
        ]
    )
    return response.choices[0].message.content

def summarize_text(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a summarization expert."},
            {"role": "user", "content": f"Summarize: {text}"}
        ]
    )
    return response.choices[0].message.content

@Tracer.observe(span_type="function")  
def main():
    text = "Apple Inc. announced today that their new iPhone will be released next month. The market reacted positively to this news."

    sentiment = analyze_sentiment(text)
    entities = extract_entities(text)
    summary = summarize_text(text)

    print(f"Sentiment: {sentiment}")
    print(f"Entities: {entities}")
    print(f"Summary: {summary}")

if __name__ == "__main__":
    main()

Available Instrumentors

OpenInference provides instrumentors for various frameworks and libraries:

OpenAI

from openinference.instrumentation.openai import OpenAIInstrumentor
Tracer.registerOTELInstrumentation(OpenAIInstrumentor())

Anthropic

from openinference.instrumentation.anthropic import AnthropicInstrumentor
Tracer.registerOTELInstrumentation(AnthropicInstrumentor())

OpenAI Agents SDK

from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor
Tracer.registerOTELInstrumentation(OpenAIAgentsInstrumentor())

PydanticAI

from openinference.instrumentation.pydanticai import PydanticAIInstrumentor
Tracer.registerOTELInstrumentation(PydanticAIInstrumentor())

Other

For a complete list of available instrumentors, visit the OpenInference GitHub repository.

Next Steps