11import { LDContext } from '@launchdarkly/js-server-sdk-common' ;
22
33import { 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' ;
105import { LDAIClientImpl } from '../src/LDAIClientImpl' ;
116import { LDClientMin } from '../src/LDClientMin' ;
127
@@ -17,7 +12,7 @@ const mockLdClient: jest.Mocked<LDClientMin> = {
1712
1813const 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 = {
@@ -156,21 +151,6 @@ it('returns single agent config with interpolated instructions', async () => {
156151 model : { name : 'test' , parameters : { name : 'test-model' } } ,
157152 instructions : 'You are a helpful assistant.' ,
158153 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- } ,
174154 } ;
175155
176156 const mockVariation = {
@@ -205,7 +185,6 @@ it('returns single agent config with interpolated instructions', async () => {
205185 instructions : 'You are a helpful assistant. Your name is John and your score is 42' ,
206186 tracker : expect . any ( Object ) ,
207187 enabled : true ,
208- toVercelAISDK : expect . any ( Function ) ,
209188 } ) ;
210189
211190 // Verify tracking was called
@@ -224,21 +203,6 @@ it('includes context in variables for agent instructions interpolation', async (
224203 model : { name : 'test' , parameters : { name : 'test-model' } } ,
225204 instructions : 'You are a helpful assistant.' ,
226205 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- } ,
242206 } ;
243207
244208 const mockVariation = {
@@ -260,21 +224,6 @@ it('handles missing metadata in agent variation', async () => {
260224 model : { name : 'test' , parameters : { name : 'test-model' } } ,
261225 instructions : 'You are a helpful assistant.' ,
262226 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- } ,
278227 } ;
279228
280229 const mockVariation = {
@@ -291,7 +240,6 @@ it('handles missing metadata in agent variation', async () => {
291240 instructions : 'Hello.' ,
292241 tracker : expect . any ( Object ) ,
293242 enabled : false ,
294- toVercelAISDK : expect . any ( Function ) ,
295243 } ) ;
296244} ) ;
297245
@@ -303,22 +251,6 @@ it('passes the default value to the underlying client for single agent', async (
303251 provider : { name : 'default-provider' } ,
304252 instructions : 'Default instructions' ,
305253 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- } ,
322254 } ;
323255
324256 mockLdClient . variation . mockResolvedValue ( defaultValue ) ;
@@ -331,7 +263,6 @@ it('passes the default value to the underlying client for single agent', async (
331263 provider : defaultValue . provider ,
332264 tracker : expect . any ( Object ) ,
333265 enabled : false ,
334- toVercelAISDK : expect . any ( Function ) ,
335266 } ) ;
336267
337268 expect ( mockLdClient . variation ) . toHaveBeenCalledWith ( key , testContext , defaultValue ) ;
@@ -347,21 +278,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
347278 model : { name : 'test' , parameters : { name : 'test-model' } } ,
348279 instructions : 'You are a research assistant.' ,
349280 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- } ,
365281 } ,
366282 variables : { topic : 'climate change' } ,
367283 } ,
@@ -371,21 +287,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
371287 model : { name : 'test' , parameters : { name : 'test-model' } } ,
372288 instructions : 'You are a writing assistant.' ,
373289 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- } ,
389290 } ,
390291 variables : { style : 'academic' } ,
391292 } ,
@@ -428,7 +329,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
428329 instructions : 'You are a research assistant specializing in climate change.' ,
429330 tracker : expect . any ( Object ) ,
430331 enabled : true ,
431- toVercelAISDK : expect . any ( Function ) ,
432332 } ,
433333 'writing-agent' : {
434334 model : {
@@ -439,7 +339,6 @@ it('returns multiple agents config with interpolated instructions', async () =>
439339 instructions : 'You are a writing assistant with academic style.' ,
440340 tracker : expect . any ( Object ) ,
441341 enabled : true ,
442- toVercelAISDK : expect . any ( Function ) ,
443342 } ,
444343 } ) ;
445344
0 commit comments