Skip to content

feat!: remove deprecated client method aliases and type aliases#179

Merged
jsonbailey merged 2 commits into
mainfrom
jb/remove-deprecated-methods
May 12, 2026
Merged

feat!: remove deprecated client method aliases and type aliases#179
jsonbailey merged 2 commits into
mainfrom
jb/remove-deprecated-methods

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented May 7, 2026

Summary

feat!: remove LDAIClient.config — use LDAIClient.completion_config instead
feat!: remove LDAIClient.create_chat — use LDAIClient.create_model instead
feat!: remove LDAIClient.agent — use LDAIClient.agent_config instead
feat!: remove LDAIClient.agents — use LDAIClient.agent_configs instead
feat!: remove LDAIConfigTracker.track_openai_metrics — use tracker.track_metrics_of(get_ai_metrics_from_response, fn) from launchdarkly-server-sdk-ai-openai instead
feat!: remove LDAIMetricSummary.duration — use LDAIMetricSummary.duration_ms instead
feat!: remove Chat class and the ldai.chat module — use the managed-runner / provider model runners instead
feat!: remove LDAIAgent alias — use AIAgentConfig instead
feat!: remove LDAIAgentConfig alias — use AIAgentConfig instead
feat!: remove LDAIAgentDefaults alias — use AIAgentConfigDefault instead
feat!: remove public AIConfig re-export — internal-only; use AICompletionConfig / AIAgentConfig / AIJudgeConfig instead
feat!: remove evaluation_metric_keys (plural) field from AIJudgeConfigDefault and AIJudgeConfig — use evaluation_metric_key (singular) instead; the read path still accepts the plural in flag variations for backward compatibility

Removes the following deprecated symbols from the launchdarkly-server-sdk-ai package ahead of the next release. Each replacement has existed and been recommended for some time; this PR drops the back-compat shims.

Removed Replacement
LDAIClient.config() LDAIClient.completion_config()
LDAIClient.create_chat() LDAIClient.create_model()
LDAIClient.agent() LDAIClient.agent_config()
LDAIClient.agents() LDAIClient.agent_configs()
LDAIConfigTracker.track_openai_metrics() LDAIConfigTracker.track_metrics_of with get_ai_metrics_from_response from ldai_openai
LDAIMetricSummary.duration LDAIMetricSummary.duration_ms
Chat class + ldai/chat/ shim package managed-runner / provider model runners
LDAIAgent type alias AIAgentConfig
LDAIAgentConfig type alias AIAgentConfig
LDAIAgentDefaults type alias AIAgentConfigDefault
Public re-export of AIConfig from ldai AIConfig is now internal-only (still defined as the base class in ldai.models)
evaluation_metric_keys (plural) field on AIJudgeConfig / AIJudgeConfigDefault evaluation_metric_key (singular)

The corresponding tests have been updated to call the replacement APIs. The two dedicated track_openai_metrics tests were removed (their behavior is covered by track_metrics_of tests).

BREAKING CHANGE

This is a breaking release. Callers using any of the removed names must migrate to the replacements listed above. The ldai.chat import path is gone entirely — from ldai.chat import Chat will now fail.

Note on evaluation_metric_keys

The plural-form evaluation_metric_keys field is removed from both AIJudgeConfig and AIJudgeConfigDefault. to_dict() now only emits the singular evaluationMetricKey. To preserve backward compatibility with older LD-side judge flag variations that still set the plural, the read path in client.py (_extract_evaluation_metric_key, lines 219–232) falls back to evaluationMetricKeys[0] when only the plural is present. New configs cannot set the plural in code, but existing flag values continue to resolve correctly to the singular evaluation_metric_key.

Test plan

  • make test — full unit test suite (server-ai, langchain, openai) passes (328 tests)
  • make lint — mypy, isort, pycodestyle pass for all three packages

Note

Medium Risk
This is a breaking change that removes previously deprecated public APIs and re-exports, so downstream consumers will fail at import/runtime until migrated. Behavior is largely unchanged, but the surface-area reduction could impact integrations that relied on the deprecated names.

Overview
Removes multiple deprecated, backward-compatibility shims from launchdarkly-server-sdk-ai, tightening the public API surface.

Public exports and aliases were dropped, including ldai.chat.Chat, LDAIClient.config/create_chat/agent/agents, LDAIConfigTracker.track_openai_metrics, LDAIMetricSummary.duration, and legacy type aliases like LDAIAgent* plus the AIConfig re-export.

Unit tests were updated accordingly to use completion_config, create_model, agent_config/agent_configs, and duration_ms, and the dedicated track_openai_metrics tests were removed.

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

Remove the following deprecated symbols ahead of the next release:

- LDAIClient.config() -> use completion_config()
- LDAIClient.create_chat() -> use create_model()
- LDAIClient.agent() -> use agent_config()
- LDAIClient.agents() -> use agent_configs()
- LDAIConfigTracker.track_openai_metrics() -> use track_metrics_of with
  get_ai_metrics_from_response from ldai_openai
- LDAIMetricSummary.duration -> use duration_ms
- Chat class and ldai/chat/ shim package -> use ManagedModel
- LDAIAgent type alias -> use AIAgentConfig
- LDAIAgentConfig type alias -> use AIAgentConfigRequest
- LDAIAgentDefaults type alias -> use AIAgentConfigDefault
- AIConfig public re-export -> internal base class only

BREAKING CHANGE: All deprecated method aliases, type aliases, and the
ldai.chat shim package are removed. Migrate to the documented
replacements listed above.

Note: The plural-form ``evaluation_metric_keys`` field on AIJudgeConfig
and AIJudgeConfigDefault is intentionally kept for wire-format
compatibility with existing LD-side judge configurations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey force-pushed the jb/remove-deprecated-methods branch from 37bd61e to d65f30c Compare May 11, 2026 14:19
@jsonbailey jsonbailey marked this pull request as ready for review May 11, 2026 14:51
@jsonbailey jsonbailey requested a review from a team as a code owner May 11, 2026 14:51
…and AIJudgeConfigDefault

The plural `evaluation_metric_keys` field is removed from both
`AIJudgeConfig` and `AIJudgeConfigDefault`. Defaults should only set
the singular `evaluation_metric_key`. The client read path still
accepts the plural `evaluationMetricKeys` from a variation payload and
falls back to its first element when the singular is not set, so older
flag values continue to resolve a metric key.

BREAKING CHANGE: `evaluation_metric_keys` is no longer a field on
`AIJudgeConfig` or `AIJudgeConfigDefault`. Construct these dataclasses
with `evaluation_metric_key` (singular) instead. The wire-format
`evaluationMetricKeys` plural is still read from variations for
backward compatibility with older AI configs and is mapped onto the
singular field on the returned `AIJudgeConfig`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e50041e. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/models.py
@jsonbailey jsonbailey merged commit 20df94b into main May 12, 2026
46 checks passed
@jsonbailey jsonbailey deleted the jb/remove-deprecated-methods branch May 12, 2026 14:40
@github-actions github-actions Bot mentioned this pull request May 12, 2026
jsonbailey pushed a commit that referenced this pull request May 14, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-server-sdk-ai: 0.20.0</summary>

##
[0.20.0](launchdarkly-server-sdk-ai-0.19.0...launchdarkly-server-sdk-ai-0.20.0)
(2026-05-13)


### ⚠ BREAKING CHANGES

* Remove deprecated client method aliases and type aliases
([#179](#179))
* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
* Strip legacy judge messages on direct judge_config() path
([#174](#174))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))
* Remove stale ManagedModel message management and AgentGraphResult type
([#170](#170))

### Features

* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
([cc7a0fe](cc7a0fe))
* Remove deprecated client method aliases and type aliases
([#179](#179))
([20df94b](20df94b))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))
([583939d](583939d))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
([d8c4a70](d8c4a70))


### Bug Fixes

* Remove stale ManagedModel message management and AgentGraphResult type
([#170](#170))
([7d6ad23](7d6ad23))
* Strip legacy judge messages on direct judge_config() path
([#174](#174))
([b7db754](b7db754))
</details>

<details><summary>launchdarkly-server-sdk-ai-langchain: 0.7.0</summary>

##
[0.7.0](launchdarkly-server-sdk-ai-langchain-0.6.0...launchdarkly-server-sdk-ai-langchain-0.7.0)
(2026-05-13)


### ⚠ BREAKING CHANGES

* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))

### Features

* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
([cc7a0fe](cc7a0fe))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))
([583939d](583939d))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
([d8c4a70](d8c4a70))
</details>

<details><summary>launchdarkly-server-sdk-ai-openai: 0.6.0</summary>

##
[0.6.0](launchdarkly-server-sdk-ai-openai-0.5.0...launchdarkly-server-sdk-ai-openai-0.6.0)
(2026-05-13)


### ⚠ BREAKING CHANGES

* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))

### Features

* Narrow AgentGraphRunner.run input from Any to str
([#177](#177))
([cc7a0fe](cc7a0fe))
* rename GraphMetrics/GraphMetricSummary to
AIGraphMetrics/AIGraphMetricSummary
([#173](#173))
([583939d](583939d))
* Rename LDAIMetrics.usage and AIGraphMetrics.usage to .tokens
([#175](#175))
([d8c4a70](d8c4a70))


### Bug Fixes

* Always return ModelSettings from _build_model_settings
([#169](#169))
([6d1ce4c](6d1ce4c))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk: this PR only updates release metadata
(versions/changelogs/provenance) with no functional code changes, though
it publishes breaking-change API notes for consumers.
> 
> **Overview**
> **Release-only update** bumping package versions:
`launchdarkly-server-sdk-ai` to `0.20.0`, LangChain provider to `0.7.0`,
and OpenAI provider to `0.6.0`.
> 
> Updates `.release-please-manifest.json`, `pyproject.toml` versions,
SDK `__version__`, provenance docs, and adds new changelog entries
documenting the breaking API renames/type tightenings included in these
releases.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
a15b48e. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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