Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

OpenLit Trace Export

Export OpenLit traces to the Judgment platform.

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

Quickstart

Install Dependencies

uv add openlit judgeval openai
pip install openlit judgeval openai

Initialize Integration

from judgeval import Tracer
from judgeval.integrations.openlit import Openlit

Tracer.init(project_name="openlit_project")
Openlit.initialize()

Add to Existing Code

Add these lines to your existing OpenLit-instrumented application:

from openai import OpenAI
from judgeval import Tracer  
from judgeval.integrations.openlit import Openlit  

Tracer.init(project_name="openlit_project")  
Openlit.initialize()  

client = OpenAI()

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

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

All OpenLit traces are exported to the Judgment platform.

Example: Multi-Workflow Application

from judgeval import Tracer
from judgeval.integrations.openlit import Openlit
from openai import OpenAI

Tracer.init(project_name="openlit_project")
Openlit.initialize()

client = OpenAI()

def analyze_text(text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a helpful AI assistant."},
            {"role": "user", "content": f"Analyze: {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 helpful AI assistant."},
            {"role": "user", "content": f"Summarize: {text}"}
        ]
    )
    return response.choices[0].message.content

def generate_content(prompt: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.2",
        messages=[
            {"role": "system", "content": "You are a creative AI assistant."},
            {"role": "user", "content": prompt}
        ]
    )
    return response.choices[0].message.content

@Tracer.observe(span_type="function")  
def main():
    text = "The future of artificial intelligence is bright and full of possibilities."

    analysis = analyze_text(text)
    summary = summarize_text(text)
    story = generate_content(f"Create a story about: {text}")

    print(f"Analysis: {analysis}")
    print(f"Summary: {summary}")
    print(f"Story: {story}")

if __name__ == "__main__":
    main()

Was this page helpful?