Skip to content

Commit 18e8141

Browse files
committed
Merge branch 'feat/svelte-sdk' into feat/svelte-sdk-example
2 parents a3711fc + fb4f9c4 commit 18e8141

14 files changed

+68
-53
lines changed

.release-please-manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages/shared/common": "2.12.0",
33
"packages/shared/sdk-server": "2.10.0",
44
"packages/sdk/server-node": "9.7.2",
5-
"packages/sdk/cloudflare": "2.6.2",
5+
"packages/sdk/cloudflare": "2.6.3",
66
"packages/shared/sdk-server-edge": "2.5.2",
77
"packages/sdk/vercel": "1.3.21",
88
"packages/sdk/akamai-base": "2.1.20",
@@ -14,5 +14,5 @@
1414
"packages/sdk/react-native": "10.9.3",
1515
"packages/telemetry/node-server-sdk-otel": "1.1.2",
1616
"packages/sdk/browser": "0.3.3",
17-
"packages/sdk/server-ai": "0.5.0"
17+
"packages/sdk/server-ai": "0.6.0"
1818
}

packages/sdk/cloudflare/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ All notable changes to the LaunchDarkly SDK for Cloudflare Workers will be docum
2121
* devDependencies
2222
* @launchdarkly/js-server-sdk-common-edge bumped from 2.2.1 to 2.2.2
2323

24+
## [2.6.3](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.6.2...cloudflare-server-sdk-v2.6.3) (2024-12-12)
25+
26+
27+
### Bug Fixes
28+
29+
* Remove bundled dependency from package.json. ([#711](https://github.com/launchdarkly/js-core/issues/711)) ([0fb5375](https://github.com/launchdarkly/js-core/commit/0fb5375443a5137c3588d454465794eb530cb982))
30+
2431
## [2.6.2](https://github.com/launchdarkly/js-core/compare/cloudflare-server-sdk-v2.6.1...cloudflare-server-sdk-v2.6.2) (2024-11-14)
2532

2633

packages/sdk/cloudflare/example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"module": "./dist/index.mjs",
66
"packageManager": "[email protected]",
77
"dependencies": {
8-
"@launchdarkly/cloudflare-server-sdk": "2.6.2"
8+
"@launchdarkly/cloudflare-server-sdk": "2.6.3"
99
},
1010
"devDependencies": {
1111
"@cloudflare/workers-types": "^4.20230321.0",

packages/sdk/cloudflare/jsr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@launchdarkly/cloudflare-server-sdk",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"exports": "./src/index.ts",
55
"publish": {
66
"include": [

packages/sdk/cloudflare/package.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@launchdarkly/cloudflare-server-sdk",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"description": "Cloudflare LaunchDarkly SDK",
55
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/cloudflare",
66
"repository": {
@@ -41,10 +41,10 @@
4141
},
4242
"dependencies": {
4343
"@cloudflare/workers-types": "^4.20230321.0",
44+
"@launchdarkly/js-server-sdk-common-edge": "2.5.2",
4445
"crypto-js": "^4.1.1"
4546
},
4647
"devDependencies": {
47-
"@launchdarkly/js-server-sdk-common-edge": "2.5.2",
4848
"@rollup/plugin-commonjs": "^25.0.4",
4949
"@rollup/plugin-json": "^6.0.0",
5050
"@rollup/plugin-node-resolve": "^15.2.1",
@@ -76,8 +76,5 @@
7676
"ts-jest": "^29.1.0",
7777
"typedoc": "0.25.0",
7878
"typescript": "5.1.6"
79-
},
80-
"bundledDependencies": [
81-
"@launchdarkly/js-server-sdk-common-edge"
82-
]
79+
}
8380
}

packages/sdk/cloudflare/src/createPlatformInfo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Info, PlatformData, SdkData } from '@launchdarkly/js-server-sdk-common-edge';
22

33
const name = '@launchdarkly/cloudflare-server-sdk';
4-
const version = '2.6.2'; // x-release-please-version
4+
const version = '2.6.3'; // x-release-please-version
55

66
class CloudflarePlatformInfo implements Info {
77
platformData(): PlatformData {

packages/sdk/server-ai/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [0.6.0](https://github.com/launchdarkly/js-core/compare/server-sdk-ai-v0.5.0...server-sdk-ai-v0.6.0) (2024-12-10)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* Change versionKey to variationKey. ([#709](https://github.com/launchdarkly/js-core/issues/709))
9+
10+
### Code Refactoring
11+
12+
* Change versionKey to variationKey. ([#709](https://github.com/launchdarkly/js-core/issues/709)) ([bfee298](https://github.com/launchdarkly/js-core/commit/bfee29843125c55be1b21e4f77c9d8c3c8698856))
13+
314
## [0.5.0](https://github.com/launchdarkly/js-core/compare/server-sdk-ai-v0.4.0...server-sdk-ai-v0.5.0) (2024-12-09)
415

516

packages/sdk/server-ai/__tests__/LDAIClientImpl.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ it('returns config with interpolated messagess', async () => {
3333
{ role: 'user', content: 'Score: {{score}}' },
3434
],
3535
_ldMeta: {
36-
versionKey: 'v1',
36+
variationKey: 'v1',
3737
enabled: true,
3838
},
3939
};
@@ -70,7 +70,7 @@ it('includes context in variables for messages interpolation', async () => {
7070

7171
const mockVariation = {
7272
messages: [{ role: 'system', content: 'User key: {{ldctx.key}}' }],
73-
_ldMeta: { versionKey: 'v1', enabled: true },
73+
_ldMeta: { variationKey: 'v1', enabled: true },
7474
};
7575

7676
mockLdClient.variation.mockResolvedValue(mockVariation);

packages/sdk/server-ai/__tests__/LDAIConfigTrackerImpl.test.ts

+32-32
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ const mockLdClient: LDClientMin = {
1313

1414
const testContext: LDContext = { kind: 'user', key: 'test-user' };
1515
const configKey = 'test-config';
16-
const versionKey = 'v1';
16+
const variationKey = 'v1';
1717

1818
beforeEach(() => {
1919
jest.clearAllMocks();
2020
});
2121

2222
it('tracks duration', () => {
23-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
23+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
2424
tracker.trackDuration(1000);
2525

2626
expect(mockTrack).toHaveBeenCalledWith(
2727
'$ld:ai:duration:total',
2828
testContext,
29-
{ configKey, versionKey },
29+
{ configKey, variationKey },
3030
1000,
3131
);
3232
});
3333

3434
it('tracks duration of async function', async () => {
35-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
35+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
3636
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
3737

3838
const result = await tracker.trackDurationOf(async () => 'test-result');
@@ -41,49 +41,49 @@ it('tracks duration of async function', async () => {
4141
expect(mockTrack).toHaveBeenCalledWith(
4242
'$ld:ai:duration:total',
4343
testContext,
44-
{ configKey, versionKey },
44+
{ configKey, variationKey },
4545
1000,
4646
);
4747
});
4848

4949
it('tracks positive feedback', () => {
50-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
50+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
5151
tracker.trackFeedback({ kind: LDFeedbackKind.Positive });
5252

5353
expect(mockTrack).toHaveBeenCalledWith(
5454
'$ld:ai:feedback:user:positive',
5555
testContext,
56-
{ configKey, versionKey },
56+
{ configKey, variationKey },
5757
1,
5858
);
5959
});
6060

6161
it('tracks negative feedback', () => {
62-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
62+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
6363
tracker.trackFeedback({ kind: LDFeedbackKind.Negative });
6464

6565
expect(mockTrack).toHaveBeenCalledWith(
6666
'$ld:ai:feedback:user:negative',
6767
testContext,
68-
{ configKey, versionKey },
68+
{ configKey, variationKey },
6969
1,
7070
);
7171
});
7272

7373
it('tracks success', () => {
74-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
74+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
7575
tracker.trackSuccess();
7676

7777
expect(mockTrack).toHaveBeenCalledWith(
7878
'$ld:ai:generation',
7979
testContext,
80-
{ configKey, versionKey },
80+
{ configKey, variationKey },
8181
1,
8282
);
8383
});
8484

8585
it('tracks OpenAI usage', async () => {
86-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
86+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
8787
jest.spyOn(global.Date, 'now').mockReturnValueOnce(1000).mockReturnValueOnce(2000);
8888

8989
const TOTAL_TOKENS = 100;
@@ -101,41 +101,41 @@ it('tracks OpenAI usage', async () => {
101101
expect(mockTrack).toHaveBeenCalledWith(
102102
'$ld:ai:duration:total',
103103
testContext,
104-
{ configKey, versionKey },
104+
{ configKey, variationKey },
105105
1000,
106106
);
107107

108108
expect(mockTrack).toHaveBeenCalledWith(
109109
'$ld:ai:generation',
110110
testContext,
111-
{ configKey, versionKey },
111+
{ configKey, variationKey },
112112
1,
113113
);
114114

115115
expect(mockTrack).toHaveBeenCalledWith(
116116
'$ld:ai:tokens:total',
117117
testContext,
118-
{ configKey, versionKey },
118+
{ configKey, variationKey },
119119
TOTAL_TOKENS,
120120
);
121121

122122
expect(mockTrack).toHaveBeenCalledWith(
123123
'$ld:ai:tokens:input',
124124
testContext,
125-
{ configKey, versionKey },
125+
{ configKey, variationKey },
126126
PROMPT_TOKENS,
127127
);
128128

129129
expect(mockTrack).toHaveBeenCalledWith(
130130
'$ld:ai:tokens:output',
131131
testContext,
132-
{ configKey, versionKey },
132+
{ configKey, variationKey },
133133
COMPLETION_TOKENS,
134134
);
135135
});
136136

137137
it('tracks Bedrock conversation with successful response', () => {
138-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
138+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
139139

140140
const TOTAL_TOKENS = 100;
141141
const PROMPT_TOKENS = 49;
@@ -156,41 +156,41 @@ it('tracks Bedrock conversation with successful response', () => {
156156
expect(mockTrack).toHaveBeenCalledWith(
157157
'$ld:ai:generation',
158158
testContext,
159-
{ configKey, versionKey },
159+
{ configKey, variationKey },
160160
1,
161161
);
162162

163163
expect(mockTrack).toHaveBeenCalledWith(
164164
'$ld:ai:duration:total',
165165
testContext,
166-
{ configKey, versionKey },
166+
{ configKey, variationKey },
167167
500,
168168
);
169169

170170
expect(mockTrack).toHaveBeenCalledWith(
171171
'$ld:ai:tokens:total',
172172
testContext,
173-
{ configKey, versionKey },
173+
{ configKey, variationKey },
174174
TOTAL_TOKENS,
175175
);
176176

177177
expect(mockTrack).toHaveBeenCalledWith(
178178
'$ld:ai:tokens:input',
179179
testContext,
180-
{ configKey, versionKey },
180+
{ configKey, variationKey },
181181
PROMPT_TOKENS,
182182
);
183183

184184
expect(mockTrack).toHaveBeenCalledWith(
185185
'$ld:ai:tokens:output',
186186
testContext,
187-
{ configKey, versionKey },
187+
{ configKey, variationKey },
188188
COMPLETION_TOKENS,
189189
);
190190
});
191191

192192
it('tracks Bedrock conversation with error response', () => {
193-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
193+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
194194

195195
const response = {
196196
$metadata: { httpStatusCode: 400 },
@@ -204,7 +204,7 @@ it('tracks Bedrock conversation with error response', () => {
204204
});
205205

206206
it('tracks tokens', () => {
207-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
207+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
208208

209209
const TOTAL_TOKENS = 100;
210210
const PROMPT_TOKENS = 49;
@@ -219,27 +219,27 @@ it('tracks tokens', () => {
219219
expect(mockTrack).toHaveBeenCalledWith(
220220
'$ld:ai:tokens:total',
221221
testContext,
222-
{ configKey, versionKey },
222+
{ configKey, variationKey },
223223
TOTAL_TOKENS,
224224
);
225225

226226
expect(mockTrack).toHaveBeenCalledWith(
227227
'$ld:ai:tokens:input',
228228
testContext,
229-
{ configKey, versionKey },
229+
{ configKey, variationKey },
230230
PROMPT_TOKENS,
231231
);
232232

233233
expect(mockTrack).toHaveBeenCalledWith(
234234
'$ld:ai:tokens:output',
235235
testContext,
236-
{ configKey, versionKey },
236+
{ configKey, variationKey },
237237
COMPLETION_TOKENS,
238238
);
239239
});
240240

241241
it('only tracks non-zero token counts', () => {
242-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
242+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
243243

244244
tracker.trackTokens({
245245
total: 0,
@@ -257,7 +257,7 @@ it('only tracks non-zero token counts', () => {
257257
expect(mockTrack).toHaveBeenCalledWith(
258258
'$ld:ai:tokens:input',
259259
testContext,
260-
{ configKey, versionKey },
260+
{ configKey, variationKey },
261261
50,
262262
);
263263

@@ -270,15 +270,15 @@ it('only tracks non-zero token counts', () => {
270270
});
271271

272272
it('returns empty summary when no metrics tracked', () => {
273-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
273+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
274274

275275
const summary = tracker.getSummary();
276276

277277
expect(summary).toEqual({});
278278
});
279279

280280
it('summarizes tracked metrics', () => {
281-
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, versionKey, testContext);
281+
const tracker = new LDAIConfigTrackerImpl(mockLdClient, configKey, variationKey, testContext);
282282

283283
tracker.trackDuration(1000);
284284
tracker.trackTokens({

packages/sdk/server-ai/examples/bedrock/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dependencies": {
2525
"@aws-sdk/client-bedrock-runtime": "^3.679.0",
2626
"@launchdarkly/node-server-sdk": "^9.7.1",
27-
"@launchdarkly/server-sdk-ai": "0.5.0"
27+
"@launchdarkly/server-sdk-ai": "0.6.0"
2828
},
2929
"devDependencies": {
3030
"@trivago/prettier-plugin-sort-imports": "^4.1.1",

packages/sdk/server-ai/examples/openai/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"license": "Apache-2.0",
2323
"dependencies": {
2424
"@launchdarkly/node-server-sdk": "^9.7.1",
25-
"@launchdarkly/server-sdk-ai": "0.5.0",
25+
"@launchdarkly/server-sdk-ai": "0.6.0",
2626
"openai": "^4.58.1"
2727
},
2828
"devDependencies": {

packages/sdk/server-ai/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@launchdarkly/server-sdk-ai",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "LaunchDarkly AI SDK for Server-Side JavaScript",
55
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-ai",
66
"repository": {

0 commit comments

Comments
 (0)