Skip to content

fix: Add runtime DeprecationWarnings to deprecated methods#145

Merged
jsonbailey merged 1 commit intomainfrom
jb/aic-1663/deprecate-provider-methods
Apr 27, 2026
Merged

fix: Add runtime DeprecationWarnings to deprecated methods#145
jsonbailey merged 1 commit intomainfrom
jb/aic-1663/deprecate-provider-methods

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Apr 27, 2026

Summary

  • client.py: config(), create_chat(), agent(), and agents() were documented as deprecated in docstrings but emitted no runtime signal (create_chat used log.warning instead). All four now emit warnings.warn(..., DeprecationWarning, stacklevel=2).
  • tracker.py: track_openai_metrics() now emits a DeprecationWarning pointing callers to track_metrics_of with get_ai_metrics_from_response from ldai_openai.
  • All deprecated docstrings normalized to the consistent RST form: .. deprecated:: Use :meth:X instead. This method will be removed in a future version.

This is consistent with the pattern used in launchdarkly-server-sdk.

Test plan

  • test_tracker.py updated — both track_openai_metrics tests assert DeprecationWarning via pytest.warns
  • track_bedrock_converse_metrics intentionally left unchanged (bedrock package planned separately)

Closes AIC-1663

🤖 Generated with Claude Code


Note

Low Risk
Low risk: behavior is unchanged aside from emitting runtime DeprecationWarnings, which may surface in caller test output or warning-as-error environments.

Overview
Adds runtime DeprecationWarnings (with stacklevel=2) to previously docstring-only deprecated APIs in LDAIClient (e.g. config, create_chat, agent, agents) and to LDAIConfigTracker.track_openai_metrics, replacing the prior log-only signal.

Updates test_tracker.py to assert the new warning behavior via pytest.warns while keeping existing tracking semantics.

Reviewed by Cursor Bugbot for commit a018c17. Bugbot is set up for automated code reviews on this repo. Configure here.

Deprecated methods previously only noted their status in docstrings or
via log.warning. They now emit warnings.warn(DeprecationWarning) so
callers are notified at runtime, consistent with the parent
launchdarkly-server-sdk pattern.

Methods deprecated in client.py: config(), create_chat(), agent(),
agents(). Method deprecated in tracker.py: track_openai_metrics().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey changed the title feat: add runtime DeprecationWarnings to deprecated methods fix: Add runtime DeprecationWarnings to deprecated methods Apr 27, 2026
@jsonbailey jsonbailey force-pushed the jb/aic-1663/deprecate-provider-methods branch from 11d17f1 to a018c17 Compare April 27, 2026 21:29
@jsonbailey jsonbailey marked this pull request as ready for review April 27, 2026 21:30
@jsonbailey jsonbailey requested a review from a team as a code owner April 27, 2026 21:30
@jsonbailey jsonbailey merged commit 2189b81 into main Apr 27, 2026
47 checks passed
@jsonbailey jsonbailey deleted the jb/aic-1663/deprecate-provider-methods branch April 27, 2026 22:42
@github-actions github-actions Bot mentioned this pull request Apr 27, 2026
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