@@ -2479,4 +2479,145 @@ describe("ProviderTransform.variants", () => {
24792479 expect ( result ) . toEqual ( { } )
24802480 } )
24812481 } )
2482+
2483+ describe ( "@jerome-benoit/sap-ai-provider-v2" , ( ) => {
2484+ test ( "anthropic models return thinking variants" , ( ) => {
2485+ const model = createMockModel ( {
2486+ id : "sap-ai-core/anthropic--claude-sonnet-4" ,
2487+ providerID : "sap-ai-core" ,
2488+ api : {
2489+ id : "anthropic--claude-sonnet-4" ,
2490+ url : "https://api.ai.sap" ,
2491+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2492+ } ,
2493+ } )
2494+ const result = ProviderTransform . variants ( model )
2495+ expect ( Object . keys ( result ) ) . toEqual ( [ "high" , "max" ] )
2496+ expect ( result . high ) . toEqual ( {
2497+ thinking : {
2498+ type : "enabled" ,
2499+ budgetTokens : 16000 ,
2500+ } ,
2501+ } )
2502+ expect ( result . max ) . toEqual ( {
2503+ thinking : {
2504+ type : "enabled" ,
2505+ budgetTokens : 31999 ,
2506+ } ,
2507+ } )
2508+ } )
2509+
2510+ test ( "anthropic 4.6 models return adaptive thinking variants" , ( ) => {
2511+ const model = createMockModel ( {
2512+ id : "sap-ai-core/anthropic--claude-sonnet-4-6" ,
2513+ providerID : "sap-ai-core" ,
2514+ api : {
2515+ id : "anthropic--claude-sonnet-4-6" ,
2516+ url : "https://api.ai.sap" ,
2517+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2518+ } ,
2519+ } )
2520+ const result = ProviderTransform . variants ( model )
2521+ expect ( Object . keys ( result ) ) . toEqual ( [ "low" , "medium" , "high" , "max" ] )
2522+ expect ( result . low ) . toEqual ( {
2523+ thinking : {
2524+ type : "adaptive" ,
2525+ } ,
2526+ effort : "low" ,
2527+ } )
2528+ expect ( result . max ) . toEqual ( {
2529+ thinking : {
2530+ type : "adaptive" ,
2531+ } ,
2532+ effort : "max" ,
2533+ } )
2534+ } )
2535+
2536+ test ( "gemini 2.5 models return thinkingConfig variants" , ( ) => {
2537+ const model = createMockModel ( {
2538+ id : "sap-ai-core/gcp--gemini-2.5-pro" ,
2539+ providerID : "sap-ai-core" ,
2540+ api : {
2541+ id : "gcp--gemini-2.5-pro" ,
2542+ url : "https://api.ai.sap" ,
2543+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2544+ } ,
2545+ } )
2546+ const result = ProviderTransform . variants ( model )
2547+ expect ( Object . keys ( result ) ) . toEqual ( [ "high" , "max" ] )
2548+ expect ( result . high ) . toEqual ( {
2549+ thinkingConfig : {
2550+ includeThoughts : true ,
2551+ thinkingBudget : 16000 ,
2552+ } ,
2553+ } )
2554+ expect ( result . max ) . toEqual ( {
2555+ thinkingConfig : {
2556+ includeThoughts : true ,
2557+ thinkingBudget : 24576 ,
2558+ } ,
2559+ } )
2560+ } )
2561+
2562+ test ( "gpt models return reasoningEffort variants" , ( ) => {
2563+ const model = createMockModel ( {
2564+ id : "sap-ai-core/azure-openai--gpt-4o" ,
2565+ providerID : "sap-ai-core" ,
2566+ api : {
2567+ id : "azure-openai--gpt-4o" ,
2568+ url : "https://api.ai.sap" ,
2569+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2570+ } ,
2571+ } )
2572+ const result = ProviderTransform . variants ( model )
2573+ expect ( Object . keys ( result ) ) . toEqual ( [ "low" , "medium" , "high" ] )
2574+ expect ( result . low ) . toEqual ( { reasoningEffort : "low" } )
2575+ expect ( result . high ) . toEqual ( { reasoningEffort : "high" } )
2576+ } )
2577+
2578+ test ( "o-series models return reasoningEffort variants" , ( ) => {
2579+ const model = createMockModel ( {
2580+ id : "sap-ai-core/azure-openai--o3-mini" ,
2581+ providerID : "sap-ai-core" ,
2582+ api : {
2583+ id : "azure-openai--o3-mini" ,
2584+ url : "https://api.ai.sap" ,
2585+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2586+ } ,
2587+ } )
2588+ const result = ProviderTransform . variants ( model )
2589+ expect ( Object . keys ( result ) ) . toEqual ( [ "low" , "medium" , "high" ] )
2590+ expect ( result . low ) . toEqual ( { reasoningEffort : "low" } )
2591+ expect ( result . high ) . toEqual ( { reasoningEffort : "high" } )
2592+ } )
2593+
2594+
2595+ test ( "sonar models return empty object" , ( ) => {
2596+ const model = createMockModel ( {
2597+ id : "sap-ai-core/perplexity--sonar-pro" ,
2598+ providerID : "sap-ai-core" ,
2599+ api : {
2600+ id : "perplexity--sonar-pro" ,
2601+ url : "https://api.ai.sap" ,
2602+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2603+ } ,
2604+ } )
2605+ const result = ProviderTransform . variants ( model )
2606+ expect ( result ) . toEqual ( { } )
2607+ } )
2608+
2609+ test ( "mistral models return empty object" , ( ) => {
2610+ const model = createMockModel ( {
2611+ id : "sap-ai-core/mistral--mistral-large" ,
2612+ providerID : "sap-ai-core" ,
2613+ api : {
2614+ id : "mistral--mistral-large" ,
2615+ url : "https://api.ai.sap" ,
2616+ npm : "@jerome-benoit/sap-ai-provider-v2" ,
2617+ } ,
2618+ } )
2619+ const result = ProviderTransform . variants ( model )
2620+ expect ( result ) . toEqual ( { } )
2621+ } )
2622+ } )
24822623} )
0 commit comments