Skip to content

Conversation

jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Oct 3, 2025

Note

Adds a provider-based TrackedChat with initChat entrypoint, generic metrics tracking via trackMetricsOf, and logger-enabled client/provider wiring.

  • Chat API:
    • Add TrackedChat, TrackedChatFactory, and abstract AIProvider with invokeModel and static create.
    • Define ChatResponse and export new chat modules (src/api/chat/*).
  • Client:
    • Add initChat(key, context, defaultValue, variables?) to LDAIClient/LDAIClientImpl; emits '$ld:ai:config:function:initChat' and returns TrackedChat | undefined.
    • Wire LDLogger into LDAIClientImpl and expose logger? on LDClientMin.
  • Metrics/Tracker:
    • Introduce LDAIMetrics and export via api/metrics.
    • Implement LDAIConfigTracker.trackMetricsOf to record duration, success/error, and optional token usage; use in TrackedChat.invoke.
  • Tests:
    • Add TrackedChat tests for message history and invoke integration.
    • Extend LDAIConfigTrackerImpl tests to cover trackMetricsOf success/failure and token usage.
  • Misc:
    • Export new provider API and chat modules in api/index.ts.
    • Update tsconfig.eslint.json includes/excludes.

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

Copy link
Contributor

github-actions bot commented Oct 3, 2025

@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

Copy link
Contributor

github-actions bot commented Oct 3, 2025

@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

Copy link
Contributor

github-actions bot commented Oct 3, 2025

@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

Copy link
Contributor

github-actions bot commented Oct 3, 2025

@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

Comment on lines 21 to 31
// Try specific implementations for the provider
switch (providerName) {
case 'openai':
trackedChat = undefined;
break;
case 'bedrock':
trackedChat = undefined;
break;
default:
trackedChat = undefined;
}
Copy link
Member

Choose a reason for hiding this comment

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

I assume the plan is to fill this out later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we will add support for additional providers

// Track chat initialization
this._ldClient.track('$ld:ai:config:function:initChat', context, key, 1);

const config = await this.config(key, context, defaultValue, variables);
Copy link
Member

Choose a reason for hiding this comment

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

I do not care for this line. Can we rename one of these configs to disambiguate them?

@jsonbailey jsonbailey marked this pull request as ready for review October 7, 2025 17:36
@jsonbailey jsonbailey requested a review from a team as a code owner October 7, 2025 17:36
cursor[bot]

This comment was marked as outdated.

@jsonbailey jsonbailey requested a review from ctawiah October 7, 2025 20:55
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