@@ -258,6 +258,68 @@ describe("OpenAiNativeHandler", () => {
258
258
} )
259
259
} )
260
260
261
+ it ( "should not include verbosity parameter for models that don't support it" , async ( ) => {
262
+ // Test with gpt-4.1 which does NOT support verbosity
263
+ handler = new OpenAiNativeHandler ( {
264
+ ...mockOptions ,
265
+ apiModelId : "gpt-4.1" ,
266
+ verbosity : "high" , // Set verbosity but it should be ignored
267
+ } )
268
+
269
+ const stream = handler . createMessage ( systemPrompt , messages )
270
+ const chunks : any [ ] = [ ]
271
+ for await ( const chunk of stream ) {
272
+ chunks . push ( chunk )
273
+ }
274
+
275
+ // Verify that verbosity is NOT included in the request
276
+ const callArgs = mockCreate . mock . calls [ 0 ] [ 0 ]
277
+ expect ( callArgs ) . not . toHaveProperty ( "verbosity" )
278
+ expect ( callArgs . model ) . toBe ( "gpt-4.1" )
279
+ expect ( callArgs . temperature ) . toBe ( 0 )
280
+ expect ( callArgs . stream ) . toBe ( true )
281
+ } )
282
+
283
+ it ( "should not include verbosity for gpt-4o models" , async ( ) => {
284
+ // Test with gpt-4o which does NOT support verbosity
285
+ handler = new OpenAiNativeHandler ( {
286
+ ...mockOptions ,
287
+ apiModelId : "gpt-4o" ,
288
+ verbosity : "medium" , // Set verbosity but it should be ignored
289
+ } )
290
+
291
+ const stream = handler . createMessage ( systemPrompt , messages )
292
+ const chunks : any [ ] = [ ]
293
+ for await ( const chunk of stream ) {
294
+ chunks . push ( chunk )
295
+ }
296
+
297
+ // Verify that verbosity is NOT included in the request
298
+ const callArgs = mockCreate . mock . calls [ 0 ] [ 0 ]
299
+ expect ( callArgs ) . not . toHaveProperty ( "verbosity" )
300
+ expect ( callArgs . model ) . toBe ( "gpt-4o" )
301
+ } )
302
+
303
+ it ( "should not include verbosity for gpt-4.1-mini models" , async ( ) => {
304
+ // Test with gpt-4.1-mini which does NOT support verbosity
305
+ handler = new OpenAiNativeHandler ( {
306
+ ...mockOptions ,
307
+ apiModelId : "gpt-4.1-mini" ,
308
+ verbosity : "low" , // Set verbosity but it should be ignored
309
+ } )
310
+
311
+ const stream = handler . createMessage ( systemPrompt , messages )
312
+ const chunks : any [ ] = [ ]
313
+ for await ( const chunk of stream ) {
314
+ chunks . push ( chunk )
315
+ }
316
+
317
+ // Verify that verbosity is NOT included in the request
318
+ const callArgs = mockCreate . mock . calls [ 0 ] [ 0 ]
319
+ expect ( callArgs ) . not . toHaveProperty ( "verbosity" )
320
+ expect ( callArgs . model ) . toBe ( "gpt-4.1-mini" )
321
+ } )
322
+
261
323
it ( "should handle empty delta content" , async ( ) => {
262
324
const mockStream = [
263
325
{ choices : [ { delta : { } } ] , usage : null } ,
0 commit comments