Skip to content

Conversation

jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Oct 3, 2025

Note

Introduces a new chat API with provider factory, adds generic metrics tracking, and exposes an initChat entrypoint with logger support.

  • Chat API:
    • Add TrackedChat with conversation management (invoke, appendMessages, getMessages).
    • Add TrackedChatFactory to instantiate chats based on provider (tries LangChain fallback).
    • Define ChatResponse and re-export from api/chat.
  • Providers:
    • Introduce abstract AIProvider base class and export via api/providers.
  • Metrics/Tracking:
    • Add LDAIMetrics and LDAIConfigTracker.trackMetricsOf for generic success/usage tracking.
    • Implement trackMetricsOf in LDAIConfigTrackerImpl alongside existing trackers.
  • Client:
    • Enhance LDAIClientImpl with logger and new initChat(...) that tracks usage and returns TrackedChat | undefined when disabled.
    • Extend LDAIClient interface to include initChat and import TrackedChat.
    • Update LDClientMin to expose optional logger.
  • Exports/Config:
    • Re-export new chat and provider modules; add metrics export for LDAIMetrics.
    • Adjust tsconfig.eslint.json includes/excludes.
  • Tests:
    • Add tests for TrackedChat behaviors and for trackMetricsOf success/error/token cases.

Written by Cursor Bugbot for commit 0b9f894. 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

@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
@jsonbailey jsonbailey requested a review from keelerm84 October 10, 2025 14:56
@jsonbailey jsonbailey merged commit a7ad0ea into main Oct 10, 2025
29 checks passed
@jsonbailey jsonbailey deleted the jb/sdk-1454/ai-sdk-tracked-chat branch October 10, 2025 15:39
@github-actions github-actions bot mentioned this pull request Oct 10, 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.

3 participants