-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Add support for TrackedChats in the AI SDK #939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@launchdarkly/browser size report |
@launchdarkly/js-sdk-common size report |
@launchdarkly/js-client-sdk size report |
@launchdarkly/js-client-sdk-common size report |
// Try specific implementations for the provider | ||
switch (providerName) { | ||
case 'openai': | ||
trackedChat = undefined; | ||
break; | ||
case 'bedrock': | ||
trackedChat = undefined; | ||
break; | ||
default: | ||
trackedChat = undefined; | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Note
Introduces a new chat API with provider factory, adds generic metrics tracking, and exposes an initChat entrypoint with logger support.
TrackedChat
with conversation management (invoke
,appendMessages
,getMessages
).TrackedChatFactory
to instantiate chats based onprovider
(tries LangChain fallback).ChatResponse
and re-export fromapi/chat
.AIProvider
base class and export viaapi/providers
.LDAIMetrics
andLDAIConfigTracker.trackMetricsOf
for generic success/usage tracking.trackMetricsOf
inLDAIConfigTrackerImpl
alongside existing trackers.LDAIClientImpl
withlogger
and newinitChat(...)
that tracks usage and returnsTrackedChat | undefined
when disabled.LDAIClient
interface to includeinitChat
and importTrackedChat
.LDClientMin
to expose optionallogger
.LDAIMetrics
.tsconfig.eslint.json
includes/excludes.TrackedChat
behaviors and fortrackMetricsOf
success/error/token cases.Written by Cursor Bugbot for commit 0b9f894. This will update automatically on new commits. Configure here.