Skip to content

add max_version for deprecated imports #1227

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

bewestphal
Copy link

@bewestphal bewestphal commented Jun 27, 2025

In OpenAI 1.92.0 some paths for imports were migrated. This change implements a max_version to prevent deprecated beta imports which have migrated from being referenced on versions after.

See issue: langfuse/langfuse#7533

Testing

I hacked changed lines on my end in the 2.60.8 SDK. Seeing traces successfully populate in Langfuse and no more import errors on application start.


Important

Adds max_version to OpenAiDefinition and updates register_tracing to prevent deprecated imports post version 1.91.0.

  • Behavior:
    • Adds max_version attribute to OpenAiDefinition class in openai.py.
    • Updates register_tracing() to skip imports with max_version less than current openai version.
  • Definitions:
    • Sets max_version to 1.91.0 for openai.resources.beta.chat.completions in OPENAI_METHODS_V1.
    • Adds new definitions for openai.resources.chat.completions with min_version 1.92.0.

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

Greptile Summary

Disclaimer: Experimental PR review

Adds version control for OpenAI SDK path migrations in version 1.92.0, ensuring compatibility with the new module structure while maintaining support for older versions.

  • Added max_version field to OpenAiDefinition class in langfuse/openai.py to handle version-specific imports
  • Implemented version check logic in register_tracing to prevent usage of deprecated beta paths after v1.92.0
  • Added new definitions for parse method in non-beta chat completions path for v1.92.0+

In OpenAI 1.92.0 some paths for imports were migrated. This change implements a max_version to prevent deprecated `beta` imports which have migrated from being referenced on versions after.

See issue: langfuse/langfuse#7533
@CLAassistant
Copy link

CLAassistant commented Jun 27, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@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

1 file reviewed, no comments
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