What problem do you want to solve?
Instrument https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat
Currently this records nothing even when exporters are configured:
import os
import openai
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
from pydantic import BaseModel
os.environ['OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT'] = 'true'
OpenAIInstrumentor().instrument()
class CalendarEvent(BaseModel):
name: str
date: str
participants: list[str]
completion = openai.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.choices[0].message.parsed)
Describe the solution you'd like
openai.beta.chat.completions.parse should be instrumented just like openai.chat.completions.create is.
Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
No
What problem do you want to solve?
Instrument https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat
Currently this records nothing even when exporters are configured:
Describe the solution you'd like
openai.beta.chat.completions.parseshould be instrumented just likeopenai.chat.completions.createis.Describe alternatives you've considered
No response
Additional Context
No response
Would you like to implement a fix?
No