Skip to content

feat(server-ai): stamp modelKey and modelVersion on AI usage events (AIC-2858)#1794

Open
atornsii wants to merge 1 commit into
mainfrom
atornsii/AIC-2858/add-support-for-model-key-version
Open

feat(server-ai): stamp modelKey and modelVersion on AI usage events (AIC-2858)#1794
atornsii wants to merge 1 commit into
mainfrom
atornsii/AIC-2858/add-support-for-model-key-version

Conversation

@atornsii

@atornsii atornsii commented Jul 8, 2026

Copy link
Copy Markdown

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

  • AIC-2858 — Make Changes to Node.js
  • Parent: AIC-2849 — Add modelKey and modelVersion as fields to be read by SDK
  • Depends on backend payload work: AIC-2876
  • Mirrors Go: AIC-2850 / Python: PR #208

Describe the solution you've provided

Read modelKey and modelVersion from the AI Config variation payload (variation.model) and stamp them on all LDAIConfigTracker metric event payloads, alongside existing modelName/providerName fields.

  • Add optional modelKey/modelVersion to LDModelConfig
  • Pass the new fields into LDAIConfigTrackerImpl from LDAIClientImpl._evaluate
  • Include modelVersion (always) and modelKey (when present) in getTrackData()
  • Default modelVersion to 1 when absent; exclude both fields from the resumption token
  • Additive/backward compatible — older payloads without the new fields continue to work

Describe alternatives you've considered

None — this mirrors the established pattern from the Go and Python SDK implementations.

Additional context

Tech spec: Models Primitive Improvements

Test plan

  • yarn workspace @launchdarkly/server-sdk-ai test (241 passed)
  • yarn workspace @launchdarkly/server-sdk-ai lint
  • yarn workspaces foreach -pR --topological-dev --from '@launchdarkly/server-sdk-ai' run build
  • Verify against a staging environment once AIC-2876 payload is available
Open in Web Open in Cursor 

…AIC-2858)

Read modelKey and modelVersion from the AI Config variation payload and
stamp them on emitted metric events alongside existing modelName and
providerName fields. Default modelVersion to 1 when absent and exclude
both fields from the resumption token. Additive and backward compatible.

Co-authored-by: Anthony Torns II <atornsii@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

@jsonbailey

Copy link
Copy Markdown
Contributor

Holding based on our conversation today and we will follow up on slack before reviewing.

@atornsii atornsii marked this pull request as ready for review July 9, 2026 20:32
@atornsii atornsii requested a review from a team as a code owner July 9, 2026 20:32
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.

3 participants