add max_version for deprecated imports #1227
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
toOpenAiDefinition
and updatesregister_tracing
to prevent deprecated imports post version 1.91.0.max_version
attribute toOpenAiDefinition
class inopenai.py
.register_tracing()
to skip imports withmax_version
less than currentopenai
version.max_version
to1.91.0
foropenai.resources.beta.chat.completions
inOPENAI_METHODS_V1
.openai.resources.chat.completions
withmin_version
1.92.0
.This description was created by
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.
max_version
field toOpenAiDefinition
class inlangfuse/openai.py
to handle version-specific importsregister_tracing
to prevent usage of deprecated beta paths after v1.92.0