Updated the OpenAI integration to track openai_client.beta.chat.completions.parse calls:
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)
Issues
Resolves #706
Testing
Added a new end to end test and updated the examples/openai_integration_example.py method.
Details
Updated the OpenAI integration to track
openai_client.beta.chat.completions.parse
calls:Issues
Resolves #706
Testing
Added a new end to end test and updated the
examples/openai_integration_example.py
method.Documentation
OpenAI integration page was updated