comet-ml / opik

Open-source end-to-end LLM Development Platform
Apache License 2.0
2.2k stars 135 forks source link

[Bug]: OpenAI structured output calls are not tracked #706

Closed jverre closed 15 hours ago

jverre commented 2 days ago

What component(s) are affected?

Opik version

Describe the problem

When using the openai client with the client.beta.chat.completions.parse, outputs are not logged to the platform

Reproduction steps

from opik.integrations.openai import opik_tracker from openai import OpenAI from pydantic import BaseModel

client = opik_tracker.track_openai(OpenAI())

class CalendarEvent(BaseModel): name: str date: str participants: list[str]

completion = client.beta.chat.completions.parse( model="gpt-4o-2024-08-06", messages=[ {"role": "system", "content": "Extract the event information."}, {"role": "user", "content": "Alice and Bob are going to a science fair on Friday."}, ], response_format=CalendarEvent, )

print(completion)