Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 1 addition & 91 deletions packages/sdk/server-ai/__tests__/LDAIConfigTrackerImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ it('tracks success', () => {
);
tracker.trackSuccess();

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -167,13 +160,6 @@ it('tracks OpenAI usage', async () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -234,13 +220,6 @@ it('tracks error when OpenAI metrics function throws', async () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down Expand Up @@ -281,13 +260,6 @@ it('tracks Bedrock conversation with successful response', () => {

tracker.trackBedrockConverseMetrics(response);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -346,13 +318,7 @@ it('tracks Bedrock conversation with error response', () => {

tracker.trackBedrockConverseMetrics(response);

expect(mockTrack).toHaveBeenCalledTimes(2);
expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);
expect(mockTrack).toHaveBeenCalledTimes(1);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
Expand Down Expand Up @@ -399,13 +365,6 @@ describe('Vercel AI SDK generateText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -466,13 +425,6 @@ describe('Vercel AI SDK generateText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down Expand Up @@ -532,13 +484,6 @@ describe('Vercel AI SDK streamText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -599,13 +544,6 @@ describe('Vercel AI SDK streamText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down Expand Up @@ -644,13 +582,6 @@ describe('Vercel AI SDK streamText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down Expand Up @@ -689,13 +620,6 @@ describe('Vercel AI SDK streamText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down Expand Up @@ -735,13 +659,6 @@ describe('Vercel AI SDK streamText', () => {
1000,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:success',
testContext,
Expand Down Expand Up @@ -926,13 +843,6 @@ it('tracks error', () => {
);
tracker.trackError();

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation',
testContext,
{ configKey, variationKey, version },
1,
);

expect(mockTrack).toHaveBeenCalledWith(
'$ld:ai:generation:error',
testContext,
Expand Down
2 changes: 0 additions & 2 deletions packages/sdk/server-ai/src/LDAIConfigTrackerImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ export class LDAIConfigTrackerImpl implements LDAIConfigTracker {

trackSuccess(): void {
this._trackedMetrics.success = true;
this._ldClient.track('$ld:ai:generation', this._context, this._getTrackData(), 1);
this._ldClient.track('$ld:ai:generation:success', this._context, this._getTrackData(), 1);
}

trackError(): void {
this._trackedMetrics.success = false;
this._ldClient.track('$ld:ai:generation', this._context, this._getTrackData(), 1);
this._ldClient.track('$ld:ai:generation:error', this._context, this._getTrackData(), 1);
}

Expand Down