Skip to content

Conversation

@viniciusdsmello
Copy link
Contributor

Pull Request

Summary

Adds comprehensive tracing support for OpenAI Chat Completions parse method, enabling monitoring of structured outputs (Pydantic models, JSON Schema).

Changes

  • Implemented tracing for synchronous client.chat.completions.parse calls.
  • Implemented tracing for asynchronous client.chat.completions.parse calls.
  • Added parse_structured_output_data to correctly extract and serialize structured outputs.
  • Updated README.md with examples for parse method tracing.
  • Created a new example notebook (examples/tracing/openai/openai_parse_tracing.ipynb) demonstrating usage.
  • Added dedicated unit tests for parse method tracing.

Context

OpenAI's parse method is designed for generating structured outputs, which differs from the unstructured text returned by the create method. This PR ensures that applications leveraging the parse method for structured data extraction can also benefit from Openlayer's tracing capabilities, capturing the structured output and relevant metadata for monitoring and debugging.

Testing

  • Unit tests
  • Manual testing (via examples/tracing/openai/openai_parse_tracing.ipynb)

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Oct 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@viniciusdsmello viniciusdsmello changed the title Add tracing for openai chat completions parse [OPEN-7544] Adds support to OpenAI Chat Completions Parse call Oct 15, 2025
@viniciusdsmello viniciusdsmello force-pushed the cursor/add-tracing-for-openai-chat-completions-parse-93b9 branch from 79002a8 to b707641 Compare October 17, 2025 20:02
@viniciusdsmello viniciusdsmello marked this pull request as ready for review November 4, 2025 21:34
@viniciusdsmello viniciusdsmello self-assigned this Nov 4, 2025
@viniciusdsmello viniciusdsmello added the enhancement New feature or request label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants