@@ -543,4 +543,106 @@ describe("getRooModels", () => {
543543
544544 expect ( models [ "test/model-no-temp" ] . defaultTemperature ) . toBeUndefined ( )
545545 } )
546+
547+ it ( "should set defaultToolProtocol to native when default-native-tools tag is present" , async ( ) => {
548+ const mockResponse = {
549+ object : "list" ,
550+ data : [
551+ {
552+ id : "test/native-tools-model" ,
553+ object : "model" ,
554+ created : 1234567890 ,
555+ owned_by : "test" ,
556+ name : "Native Tools Model" ,
557+ description : "Model with native tool calling default" ,
558+ context_window : 128000 ,
559+ max_tokens : 8192 ,
560+ type : "language" ,
561+ tags : [ "tool-use" , "default-native-tools" ] ,
562+ pricing : {
563+ input : "0.0001" ,
564+ output : "0.0002" ,
565+ } ,
566+ } ,
567+ ] ,
568+ }
569+
570+ mockFetch . mockResolvedValueOnce ( {
571+ ok : true ,
572+ json : async ( ) => mockResponse ,
573+ } )
574+
575+ const models = await getRooModels ( baseUrl , apiKey )
576+
577+ expect ( models [ "test/native-tools-model" ] . supportsNativeTools ) . toBe ( true )
578+ expect ( models [ "test/native-tools-model" ] . defaultToolProtocol ) . toBe ( "native" )
579+ } )
580+
581+ it ( "should imply supportsNativeTools when default-native-tools tag is present without tool-use tag" , async ( ) => {
582+ const mockResponse = {
583+ object : "list" ,
584+ data : [
585+ {
586+ id : "test/implicit-native-tools" ,
587+ object : "model" ,
588+ created : 1234567890 ,
589+ owned_by : "test" ,
590+ name : "Implicit Native Tools Model" ,
591+ description : "Model with default-native-tools but no tool-use tag" ,
592+ context_window : 128000 ,
593+ max_tokens : 8192 ,
594+ type : "language" ,
595+ tags : [ "default-native-tools" ] , // Only default-native-tools, no tool-use
596+ pricing : {
597+ input : "0.0001" ,
598+ output : "0.0002" ,
599+ } ,
600+ } ,
601+ ] ,
602+ }
603+
604+ mockFetch . mockResolvedValueOnce ( {
605+ ok : true ,
606+ json : async ( ) => mockResponse ,
607+ } )
608+
609+ const models = await getRooModels ( baseUrl , apiKey )
610+
611+ expect ( models [ "test/implicit-native-tools" ] . supportsNativeTools ) . toBe ( true )
612+ expect ( models [ "test/implicit-native-tools" ] . defaultToolProtocol ) . toBe ( "native" )
613+ } )
614+
615+ it ( "should not set defaultToolProtocol when default-native-tools tag is not present" , async ( ) => {
616+ const mockResponse = {
617+ object : "list" ,
618+ data : [
619+ {
620+ id : "test/non-native-model" ,
621+ object : "model" ,
622+ created : 1234567890 ,
623+ owned_by : "test" ,
624+ name : "Non-Native Tools Model" ,
625+ description : "Model without native tool calling default" ,
626+ context_window : 128000 ,
627+ max_tokens : 8192 ,
628+ type : "language" ,
629+ tags : [ "tool-use" ] ,
630+ pricing : {
631+ input : "0.0001" ,
632+ output : "0.0002" ,
633+ } ,
634+ } ,
635+ ] ,
636+ }
637+
638+ mockFetch . mockResolvedValueOnce ( {
639+ ok : true ,
640+ json : async ( ) => mockResponse ,
641+ } )
642+
643+ const models = await getRooModels ( baseUrl , apiKey )
644+
645+ expect ( models [ "test/non-native-model" ] . supportsNativeTools ) . toBe ( true )
646+ expect ( models [ "test/non-native-model" ] . defaultToolProtocol ) . toBeUndefined ( )
647+ } )
546648} )
0 commit comments