Skip to content

feat(client): add support for openai responses.parse #1179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jerryjrxie
Copy link

@jerryjrxie jerryjrxie commented May 4, 2025

https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses


Important

Add support for parsing OpenAI responses using parse method in both sync and async contexts, with tests verifying functionality.

  • Behavior:
    • Add support for openai.resources.responses.Responses.parse and openai.resources.responses.AsyncResponses.parse in langfuse/openai.py.
    • Handles synchronous and asynchronous parsing of OpenAI responses.
  • Tests:
    • Add test_responses_parse() in tests/test_openai.py to verify parsing functionality, including checking the parsed output and Langfuse tracking.
  • Misc:
    • Update OpenAiDefinition list in langfuse/openai.py to include new parse methods.

This description was created by Ellipsis for 31f2c3a. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Added support for OpenAI's responses.parse functionality in the Python SDK, enabling structured output parsing with integrated Langfuse tracking.

  • Added OpenAiDefinition entries for responses.parse and AsyncResponses.parse methods with OpenAI SDK v1.66.0+ requirement in langfuse/openai.py
  • Implemented response handling logic in langfuse/openai.py to extract and process parsed outputs while maintaining existing tracking patterns
  • Added comprehensive test case test_responses_parse() in tests/test_openai.py to validate structured output parsing into Pydantic models
  • Preserved backward compatibility and consistent error handling with existing OpenAI integration features

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

@CLAassistant
Copy link

CLAassistant commented May 4, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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.

2 participants