Skip to content

Commit 44b97a5

Browse files
committed
[REL-9248] Update tests to not include mapper
1 parent f4af733 commit 44b97a5

File tree

1 file changed

+2
-104
lines changed

1 file changed

+2
-104
lines changed

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

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { LDContext } from '@launchdarkly/js-server-sdk-common';
22

33
import { LDAIAgentDefaults } from '../src/api/agents';
4-
import {
5-
LDAIDefaults,
6-
VercelAISDKConfig,
7-
VercelAISDKMapOptions,
8-
VercelAISDKProvider,
9-
} from '../src/api/config';
4+
import { LDAIDefaults } from '../src/api/config';
105
import { LDAIClientImpl } from '../src/LDAIClientImpl';
116
import { LDClientMin } from '../src/LDClientMin';
127

@@ -17,7 +12,7 @@ const mockLdClient: jest.Mocked<LDClientMin> = {
1712

1813
const testContext: LDContext = { kind: 'user', key: 'test-user' };
1914

20-
it('returns config with interpolated messagess', async () => {
15+
it('returns config with interpolated messages', async () => {
2116
const client = new LDAIClientImpl(mockLdClient);
2217
const key = 'test-flag';
2318
const defaultValue: LDAIDefaults = {
@@ -93,7 +88,6 @@ it('includes context in variables for messages interpolation', async () => {
9388
const result = await client.config(key, testContext, defaultValue);
9489

9590
expect(result.messages?.[0].content).toBe('User key: test-user');
96-
expect(result.toVercelAISDK).toEqual(expect.any(Function));
9791
});
9892

9993
it('handles missing metadata in variation', async () => {
@@ -156,21 +150,6 @@ it('returns single agent config with interpolated instructions', async () => {
156150
model: { name: 'test', parameters: { name: 'test-model' } },
157151
instructions: 'You are a helpful assistant.',
158152
enabled: true,
159-
toVercelAISDK: <TMod>(
160-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
161-
options?: VercelAISDKMapOptions,
162-
): VercelAISDKConfig<TMod> => {
163-
const modelProvider = typeof provider === 'function' ? provider : provider.test;
164-
return {
165-
model: modelProvider('test-model'),
166-
messages: [],
167-
...(options?.nonInterpolatedMessages
168-
? {
169-
messages: options.nonInterpolatedMessages,
170-
}
171-
: {}),
172-
};
173-
},
174153
};
175154

176155
const mockVariation = {
@@ -205,7 +184,6 @@ it('returns single agent config with interpolated instructions', async () => {
205184
instructions: 'You are a helpful assistant. Your name is John and your score is 42',
206185
tracker: expect.any(Object),
207186
enabled: true,
208-
toVercelAISDK: expect.any(Function),
209187
});
210188

211189
// Verify tracking was called
@@ -224,21 +202,6 @@ it('includes context in variables for agent instructions interpolation', async (
224202
model: { name: 'test', parameters: { name: 'test-model' } },
225203
instructions: 'You are a helpful assistant.',
226204
enabled: true,
227-
toVercelAISDK: <TMod>(
228-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
229-
options?: VercelAISDKMapOptions,
230-
): VercelAISDKConfig<TMod> => {
231-
const modelProvider = typeof provider === 'function' ? provider : provider.test;
232-
return {
233-
model: modelProvider('test-model'),
234-
messages: [],
235-
...(options?.nonInterpolatedMessages
236-
? {
237-
messages: options.nonInterpolatedMessages,
238-
}
239-
: {}),
240-
};
241-
},
242205
};
243206

244207
const mockVariation = {
@@ -260,21 +223,6 @@ it('handles missing metadata in agent variation', async () => {
260223
model: { name: 'test', parameters: { name: 'test-model' } },
261224
instructions: 'You are a helpful assistant.',
262225
enabled: true,
263-
toVercelAISDK: <TMod>(
264-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
265-
options?: VercelAISDKMapOptions,
266-
): VercelAISDKConfig<TMod> => {
267-
const modelProvider = typeof provider === 'function' ? provider : provider.test;
268-
return {
269-
model: modelProvider('test-model'),
270-
messages: [],
271-
...(options?.nonInterpolatedMessages
272-
? {
273-
messages: options.nonInterpolatedMessages,
274-
}
275-
: {}),
276-
};
277-
},
278226
};
279227

280228
const mockVariation = {
@@ -291,7 +239,6 @@ it('handles missing metadata in agent variation', async () => {
291239
instructions: 'Hello.',
292240
tracker: expect.any(Object),
293241
enabled: false,
294-
toVercelAISDK: expect.any(Function),
295242
});
296243
});
297244

@@ -303,22 +250,6 @@ it('passes the default value to the underlying client for single agent', async (
303250
provider: { name: 'default-provider' },
304251
instructions: 'Default instructions',
305252
enabled: true,
306-
toVercelAISDK: <TMod>(
307-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
308-
options?: VercelAISDKMapOptions,
309-
): VercelAISDKConfig<TMod> => {
310-
const modelProvider =
311-
typeof provider === 'function' ? provider : provider['default-provider'];
312-
return {
313-
model: modelProvider('default-model'),
314-
messages: [],
315-
...(options?.nonInterpolatedMessages
316-
? {
317-
messages: options.nonInterpolatedMessages,
318-
}
319-
: {}),
320-
};
321-
},
322253
};
323254

324255
mockLdClient.variation.mockResolvedValue(defaultValue);
@@ -331,7 +262,6 @@ it('passes the default value to the underlying client for single agent', async (
331262
provider: defaultValue.provider,
332263
tracker: expect.any(Object),
333264
enabled: false,
334-
toVercelAISDK: expect.any(Function),
335265
});
336266

337267
expect(mockLdClient.variation).toHaveBeenCalledWith(key, testContext, defaultValue);
@@ -347,21 +277,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
347277
model: { name: 'test', parameters: { name: 'test-model' } },
348278
instructions: 'You are a research assistant.',
349279
enabled: true,
350-
toVercelAISDK: <TMod>(
351-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
352-
options?: VercelAISDKMapOptions,
353-
): VercelAISDKConfig<TMod> => {
354-
const modelProvider = typeof provider === 'function' ? provider : provider.test;
355-
return {
356-
model: modelProvider('test-model'),
357-
messages: [],
358-
...(options?.nonInterpolatedMessages
359-
? {
360-
messages: options.nonInterpolatedMessages,
361-
}
362-
: {}),
363-
};
364-
},
365280
},
366281
variables: { topic: 'climate change' },
367282
},
@@ -371,21 +286,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
371286
model: { name: 'test', parameters: { name: 'test-model' } },
372287
instructions: 'You are a writing assistant.',
373288
enabled: true,
374-
toVercelAISDK: <TMod>(
375-
provider: VercelAISDKProvider<TMod> | Record<string, VercelAISDKProvider<TMod>>,
376-
options?: VercelAISDKMapOptions,
377-
): VercelAISDKConfig<TMod> => {
378-
const modelProvider = typeof provider === 'function' ? provider : provider.test;
379-
return {
380-
model: modelProvider('test-model'),
381-
messages: [],
382-
...(options?.nonInterpolatedMessages
383-
? {
384-
messages: options.nonInterpolatedMessages,
385-
}
386-
: {}),
387-
};
388-
},
389289
},
390290
variables: { style: 'academic' },
391291
},
@@ -428,7 +328,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
428328
instructions: 'You are a research assistant specializing in climate change.',
429329
tracker: expect.any(Object),
430330
enabled: true,
431-
toVercelAISDK: expect.any(Function),
432331
},
433332
'writing-agent': {
434333
model: {
@@ -439,7 +338,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
439338
instructions: 'You are a writing assistant with academic style.',
440339
tracker: expect.any(Object),
441340
enabled: true,
442-
toVercelAISDK: expect.any(Function),
443341
},
444342
});
445343

0 commit comments

Comments
 (0)