Skip to content

feat!: Remove deprecated LDAIClient method aliases#1370

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

feat!: Remove deprecated LDAIClient method aliases#1370
jsonbailey merged 5 commits into
mainfrom
jb/remove-deprecated-methods

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented May 7, 2026

Tracking internally: AIC-1663

Summary

feat!: Remove LDAIClient.config — use LDAIClient.completionConfig instead
feat!: Remove LDAIClient.agent — use LDAIClient.agentConfig instead
feat!: Remove LDAIClient.agents — use LDAIClient.agentConfigs instead
feat!: Remove LDAIClient.createChat — use LDAIClient.createModel instead
feat!: Remove LDAIClient.initChat — use LDAIClient.createModel instead
feat!: Remove ChatResponse type and the api/chat module — use RunnerResult from api/model instead
feat!: Change Judge.evaluateMessages parameter type from ChatResponse to RunnerResult (method retained per AI SDK spec Requirement 1.1.3)
feat!: Remove evaluationMetricKeys (plural) field from LDAIJudgeConfig and LDAIJudgeConfigDefault — use evaluationMetricKey (singular) instead; the wire-read fallback still accepts the plural in flag variations for backward compatibility
feat!: Remove LDAIConfigTracker.trackOpenAIMetrics — use tracker.trackMetricsOf(getAIMetricsFromResponse, fn) from @launchdarkly/server-sdk-ai-openai instead
feat!: Remove LDAIConfigTracker.trackVercelAISDKGenerateTextMetrics — use tracker.trackMetricsOf(getAIMetricsFromResponse, fn) from @launchdarkly/server-sdk-ai-vercel instead
feat!: Remove createOpenAiUsage helper — no longer needed; trackMetricsOf extracts usage
feat!: Remove createVercelAISDKTokenUsage helper — no longer needed; trackMetricsOf extracts usage

Removes five deprecated method aliases from the LDAIClient interface and LDAIClientImpl. The non-deprecated replacements have been available for some time and there are no remaining callers in source, tests, or examples.

Removed Replacement
LDAIClient.config completionConfig
LDAIClient.agent agentConfig
LDAIClient.agents agentConfigs
LDAIClient.createChat createModel
LDAIClient.initChat createModel

Note: this PR was originally targeted at feat/next-ai-release, but that branch was merged into main and removed from the remote. Retargeted to main.

The TRACK_USAGE_CREATE_CHAT analytics event key ($ld:ai:usage:create-chat) is intentionally retained — it is a wire-format identifier emitted by createModel and is out of scope for this PR.

The deprecated evaluationMetricKeys (plural) field has been removed from LDAIJudgeConfig and LDAIJudgeConfigDefault. The wire-read fallback in LDAIConfigUtils still accepts the plural in flag variations so older LD-side configs continue to resolve a metric key — the SDK normalises to the singular evaluationMetricKey before exposing it.

LDAIConfigTracker.trackBedrockConverseMetrics and createBedrockTokenUsage are kept because there is no Bedrock provider package yet. They will be removed once a Bedrock provider lands.

BREAKING CHANGE

Callers of the removed LDAIClient methods must migrate to the replacements listed above.

Test plan

  • yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/server-sdk-ai' run build succeeds
  • yarn workspace @launchdarkly/server-sdk-ai test — 14 suites / 236 tests passing
  • yarn workspace @launchdarkly/server-sdk-ai lint — clean

Note

Medium Risk
Medium risk because this is a breaking public API change: multiple deprecated LDAIClient/tracker methods and types are removed and callers must migrate to the newer APIs. Runtime logic changes are mostly deletions, but any downstream usage will fail to compile or run if not updated.

Overview
Removes several deprecated public API surfaces from the server AI SDK: LDAIClient.config, agent, agents, createChat, and initChat are deleted from both the interface and LDAIClientImpl, leaving completionConfig, agentConfig, agentConfigs, and createModel as the supported entry points.

Eliminates the api/chat module and ChatResponse type, updating Judge.evaluateMessages to accept a RunnerResult and read response.content instead.

Simplifies observability/metrics tracking by removing LDAIConfigTracker.trackOpenAIMetrics, trackVercelAISDKGenerateTextMetrics, and the createOpenAiUsage/createVercelAISDKTokenUsage helpers, pushing usage extraction to provider-specific trackMetricsOf extractors; tests and docs are updated accordingly.

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

Removes five deprecated method aliases from LDAIClient and its
implementation. None had any callers in source, tests, or examples.

- config -> use completionConfig
- agent -> use agentConfig
- agents -> use agentConfigs
- createChat -> use createModel
- initChat -> use createModel

BREAKING CHANGE: The LDAIClient methods config, agent, agents,
createChat, and initChat have been removed. Callers must migrate to
completionConfig, agentConfig, agentConfigs, and createModel
respectively.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey force-pushed the jb/remove-deprecated-methods branch from 61f7502 to f00e054 Compare May 11, 2026 14:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26208 bytes
Compressed size limit: 29000
Uncompressed size: 128789 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31906 bytes
Compressed size limit: 34000
Uncompressed size: 113658 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179498 bytes
Compressed size limit: 200000
Uncompressed size: 830837 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38487 bytes
Compressed size limit: 39000
Uncompressed size: 211236 bytes

jsonbailey and others added 3 commits May 11, 2026 14:30
… RunnerResult

Delete the unused `chat` API surface (`ChatResponse` type and the
`api/chat/` directory) and its barrel re-export. `Judge.evaluateMessages`
remains (per the AI online evals spec) but now takes a `RunnerResult`
parameter, reading the model output from `response.content` rather than
`response.message.content`. Test fixtures are updated to match.

BREAKING CHANGE: The `ChatResponse` type is removed from the public API.
`Judge.evaluateMessages(messages, response, samplingRatio?)` now accepts
a `RunnerResult` instead of a `ChatResponse`. Callers should pass the
result returned by a `Runner` (or the runner-shaped portion of a
`ManagedResult`) directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the provider-specific tracker entry points
`LDAIConfigTracker.trackOpenAIMetrics` and
`LDAIConfigTracker.trackVercelAISDKGenerateTextMetrics`, along with the
`createOpenAiUsage` and `createVercelAISDKTokenUsage` helpers and their
barrel re-exports. Customers using these providers should use the
dedicated provider packages (`@launchdarkly/server-sdk-ai-openai`,
`@launchdarkly/server-sdk-ai-vercel`) and let the SDK track metrics
through `Runner` / `trackMetricsOf`. Tests that covered the removed
surface are removed.

`trackBedrockConverseMetrics` and `createBedrockTokenUsage` are
retained: there is no dedicated Bedrock provider package yet, so the
manual helper is still the only path for Bedrock users.

BREAKING CHANGE: `LDAIConfigTracker.trackOpenAIMetrics` and
`LDAIConfigTracker.trackVercelAISDKGenerateTextMetrics` are removed.
The `createOpenAiUsage` and `createVercelAISDKTokenUsage` exports are
also removed. Migrate to the OpenAI / Vercel provider packages, or use
`trackMetricsOf` with a custom metrics extractor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The openai-observability example README listed
`trackVercelAISDKGenerateTextMetrics` as an available tracker method.
That API has been removed, so drop the row from the methods table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey marked this pull request as ready for review May 12, 2026 13:28
@jsonbailey jsonbailey requested a review from a team as a code owner May 12, 2026 13:28
…and LDAIJudgeConfigDefault

BREAKING CHANGE: the deprecated `evaluationMetricKeys` (plural) field is no longer present on `LDAIJudgeConfigDefault` or `LDAIJudgeConfig`. Developers must use the singular `evaluationMetricKey`. The wire-read fallback in `LDAIConfigUtils` still accepts the plural in flag variations so old LD-side configs continue to resolve a metric key, but the SDK normalises to the singular before exposing it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey changed the title feat!: remove deprecated LDAIClient method aliases feat!: Remove deprecated LDAIClient method aliases May 12, 2026
@jsonbailey jsonbailey merged commit 86951b0 into main May 12, 2026
43 of 44 checks passed
@jsonbailey jsonbailey deleted the jb/remove-deprecated-methods branch May 12, 2026 15:09
@github-actions github-actions Bot mentioned this pull request May 12, 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