Skip to content

fix(closes OPEN-10593): openAI parse responses not getting patched#632

Open
gustavocidornelas wants to merge 1 commit intomainfrom
gustavo/open-10593-openai-parse-responses-not-getting-patched
Open

fix(closes OPEN-10593): openAI parse responses not getting patched#632
gustavocidornelas wants to merge 1 commit intomainfrom
gustavo/open-10593-openai-parse-responses-not-getting-patched

Conversation

@gustavocidornelas
Copy link
Copy Markdown
Contributor

Pull Request

Summary

Extends trace_openai to also patch client.responses.parse, which was previously invisible to tracing. Any call to responses.parse (used for structured output via Pydantic models) now produces a chat_completion step in the active trace, consistent with how responses.create is already handled.

Changes

  • Added patching of client.responses.parse in trace_openai() inside openai_tracer.py, reusing the existing handle_responses_non_streaming_create handler
  • Guard with hasattr(client.responses, "parse") to maintain compatibility with older SDK versions that may not expose the method

Context

OPEN-10593: OpenAI parse responses not getting patched

Testing

  • Manual testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant