Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Oct 29, 2025

feat: Added judgeConfig method to AI SDK to retrieve an AI Judge Config
feat: Added createJudge method to create a Judge based on the judge key provided
feat: Added trackEvalScores method to config tracker
feat: Chat will evaluate responses with configured judges
fix!: AI Config defaults require the "enabled" attribute
fix!: Renamed LDAIAgentConfig to LDAIAgentConfigRequest for improved clarity
fix!: Renamed LDAIAgent to LDAIAgentConfig *note the previous use of this name
fix!: Renamed LDAIAgentDefault to LDAIAgentConfigDefault for improved clarity
fix!: Renamed LDAIDefaults to LDAICompletionConfigDefault for improved clarity


Note

Introduces Judge evaluations (judgeConfig/createJudge) with structured outputs and automatic chat scoring, refactors config types/modes, updates tracking, and deprecates older APIs.

  • Judging & Evaluation:
    • Add Judge with structured output (invokeStructuredModel) and schema builder; new judgeConfig and createJudge APIs.
    • TrackedChat can attach judges and asynchronously evaluate responses; results tracked via trackEvalScores.
  • Core Client/API:
    • New completionConfig, agentConfig, judgeConfig, agentConfigs, createChat, createJudge methods; legacy config, agent, agents, initChat deprecated (now wrappers).
    • Mode-aware evaluation with LDAIConfigUtils and disabled-return on mode mismatch.
  • Types & Structure:
    • Consolidate config types in api/config/types with modes: completion | agent | judge and new defaults (LDAICompletionConfigDefault, LDAIAgentConfigDefault, LDAIJudgeConfigDefault).
    • Replace old LDAIConfig/agent types; remove api/agents module; add judge attachment (LDJudgeConfiguration).
  • Providers:
    • Extend AIProvider with default invokeModel and new invokeStructuredModel; update AIProviderFactory to accept union config kinds.
  • Tracking:
    • Expose getTrackData; add trackEvalScores; new tracking event keys; minor tracker refactors.
  • Docs/Examples/Tests:
    • README and examples updated (createChat, enabled checks); comprehensive tests for Judge, client config APIs, and TrackedChat.

Written by Cursor Bugbot for commit a187fcc. This will update automatically on new commits. Configure here.

@jsonbailey jsonbailey requested a review from a team as a code owner October 29, 2025 19:04
@github-actions
Copy link
Contributor

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

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 24988 bytes
Compressed size limit: 26000
Uncompressed size: 122411 bytes

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 21721 bytes
Compressed size limit: 25000
Uncompressed size: 74698 bytes

@github-actions
Copy link
Contributor

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

@tanderson-ld
Copy link
Contributor

Will feat! cause it to release a non-alpha version?

@kinyoklion
Copy link
Member

Will feat! cause it to release a non-alpha version?

If this is set:
"bump-minor-pre-major": true,

Then it will only be a minor.

@jsonbailey
Copy link
Contributor Author

Will feat! cause it to release a non-alpha version?

If this is set: "bump-minor-pre-major": true,

Then it will only be a minor.

I only want it to be a minor, but I want the proper change logs to show breaking even for the minor bump.

@tanderson-ld tanderson-ld self-requested a review November 3, 2025 15:22
this._ldClient.track(TRACK_CONFIG_SINGLE, context, key, 1);

const config = await this._evaluate(key, context, defaultValue, 'completion', variables);
return this._addVercelAISDKSupport(config as LDAICompletionConfig);
Copy link

Choose a reason for hiding this comment

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

Bug

When completionConfig receives a disabled config from _evaluate (due to mode mismatch), it still calls _addVercelAISDKSupport on it. However, the disabled config returned by LDAIConfigUtils.createDisabledConfig is cast to LDAICompletionConfig but doesn't actually have the proper structure. The _addVercelAISDKSupport method will try to access config.messages which will be undefined for disabled configs, and create a mapper with undefined messages. While this may not crash, it's inconsistent behavior - disabled configs shouldn't have the toVercelAISDK method added since they can't be used anyway. The test at line 127 in the diff expects toVercelAISDK to be present even for disabled configs, but this creates a misleading API where a disabled config appears to have functionality it shouldn't use.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method is deprecated and will be removed in a separate PR.

@jsonbailey jsonbailey merged commit 6ecd9ab into main Nov 5, 2025
32 checks passed
@jsonbailey jsonbailey deleted the jb/sdk-1500/implement-ai-judges branch November 5, 2025 18:30
@github-actions github-actions bot mentioned this pull request Nov 5, 2025
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.

4 participants