Mark OpenAI direct clients as deprecated in V2 SDK#845
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Marks the OpenAI-compatible "direct client" classes (chat, audio, embedding, live transcription) as deprecated across the C#, JavaScript, and Python V2 SDKs, steering users toward the new Session API. The web-server OpenAI endpoints are unchanged; only the in-process direct clients are deprecated, with internal SDK self-references silenced so the build stays warning-clean.
Changes:
- Adds language-native deprecation markers (
[Obsolete],@deprecated,typing_extensions.deprecated+DeprecationWarning) to the OpenAI client classes and the model factory accessors. - Suppresses the resulting warnings at internal self-use sites (C#
#pragma warning disable CS0618) soTreatWarningsAsErrorskeeps passing. - Updates docstrings/JSDoc to recommend
ChatSession/AudioSession/EmbeddingsSession.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk_v2/python/.../openai/live_audio_session.py | @deprecated class + warnings.warn in ctor + docstring |
| sdk_v2/python/.../openai/embedding_client.py | @deprecated class + ctor warning |
| sdk_v2/python/.../openai/chat_client.py | @deprecated class + ctor warning |
| sdk_v2/python/.../openai/audio_client.py | @deprecated class + ctor warning |
| sdk_v2/python/.../imodel.py | Deprecated factory accessors + docstrings |
| sdk_v2/js/src/openai/*.ts | @deprecated JSDoc on client classes |
| sdk_v2/js/src/model.ts | @deprecated on create*Client factories |
| sdk_v2/js/src/index.ts | @deprecated re-exports |
| sdk_v2/cs/src/OpenAI/*.cs | [Obsolete] on clients + pragma at self-use |
| sdk_v2/cs/src/IModel.cs, Detail/Model.cs | [Obsolete] factory methods + pragmas |
| $"Error removing model {Id} from cache", _logger, ct).ConfigureAwait(false); | ||
| } | ||
|
|
||
| [System.Obsolete("Use new ChatSession(model) instead.", error: false)] |
There was a problem hiding this comment.
Should we add a timeframe for when these will be ultimately removed as part of the deprecation notice? I fear people will disregard the note on its own unless we present a timeframe
Users should move to the new Session API for direct requests.
The web service OpenAI endpoints are unchanged.