@@ -12,6 +12,12 @@ describe("getApiProtocol", () => {
1212 expect ( getApiProtocol ( "claude-code" ) ) . toBe ( "anthropic" )
1313 expect ( getApiProtocol ( "claude-code" , "some-model" ) ) . toBe ( "anthropic" )
1414 } )
15+
16+ it ( "should return 'anthropic' for bedrock provider" , ( ) => {
17+ expect ( getApiProtocol ( "bedrock" ) ) . toBe ( "anthropic" )
18+ expect ( getApiProtocol ( "bedrock" , "gpt-4" ) ) . toBe ( "anthropic" )
19+ expect ( getApiProtocol ( "bedrock" , "claude-3-opus" ) ) . toBe ( "anthropic" )
20+ } )
1521 } )
1622
1723 describe ( "Vertex provider with Claude models" , ( ) => {
@@ -27,25 +33,14 @@ describe("getApiProtocol", () => {
2733 expect ( getApiProtocol ( "vertex" , "gemini-pro" ) ) . toBe ( "openai" )
2834 expect ( getApiProtocol ( "vertex" , "llama-2" ) ) . toBe ( "openai" )
2935 } )
30- } )
31-
32- describe ( "Bedrock provider with Claude models" , ( ) => {
33- it ( "should return 'anthropic' for bedrock provider with claude models" , ( ) => {
34- expect ( getApiProtocol ( "bedrock" , "claude-3-opus" ) ) . toBe ( "anthropic" )
35- expect ( getApiProtocol ( "bedrock" , "Claude-3-Sonnet" ) ) . toBe ( "anthropic" )
36- expect ( getApiProtocol ( "bedrock" , "CLAUDE-instant" ) ) . toBe ( "anthropic" )
37- expect ( getApiProtocol ( "bedrock" , "anthropic.claude-v2" ) ) . toBe ( "anthropic" )
38- } )
3936
40- it ( "should return 'openai' for bedrock provider with non-claude models" , ( ) => {
41- expect ( getApiProtocol ( "bedrock" , "gpt-4" ) ) . toBe ( "openai" )
42- expect ( getApiProtocol ( "bedrock" , "titan-text" ) ) . toBe ( "openai" )
43- expect ( getApiProtocol ( "bedrock" , "llama-2" ) ) . toBe ( "openai" )
37+ it ( "should return 'openai' for vertex provider without model" , ( ) => {
38+ expect ( getApiProtocol ( "vertex" ) ) . toBe ( "openai" )
4439 } )
4540 } )
4641
47- describe ( "Other providers with Claude models " , ( ) => {
48- it ( "should return 'openai' for non-vertex/bedrock providers with claude models " , ( ) => {
42+ describe ( "Other providers" , ( ) => {
43+ it ( "should return 'openai' for non-anthropic providers regardless of model " , ( ) => {
4944 expect ( getApiProtocol ( "openrouter" , "claude-3-opus" ) ) . toBe ( "openai" )
5045 expect ( getApiProtocol ( "openai" , "claude-3-sonnet" ) ) . toBe ( "openai" )
5146 expect ( getApiProtocol ( "litellm" , "claude-instant" ) ) . toBe ( "openai" )
@@ -59,20 +54,13 @@ describe("getApiProtocol", () => {
5954 expect ( getApiProtocol ( undefined , "claude-3-opus" ) ) . toBe ( "openai" )
6055 } )
6156
62- it ( "should return 'openai' when model is undefined" , ( ) => {
63- expect ( getApiProtocol ( "openai" ) ) . toBe ( "openai" )
64- expect ( getApiProtocol ( "vertex" ) ) . toBe ( "openai" )
65- expect ( getApiProtocol ( "bedrock" ) ) . toBe ( "openai" )
66- } )
67-
6857 it ( "should handle empty strings" , ( ) => {
6958 expect ( getApiProtocol ( "vertex" , "" ) ) . toBe ( "openai" )
70- expect ( getApiProtocol ( "bedrock" , "" ) ) . toBe ( "openai" )
7159 } )
7260
7361 it ( "should be case-insensitive for claude detection" , ( ) => {
7462 expect ( getApiProtocol ( "vertex" , "CLAUDE-3-OPUS" ) ) . toBe ( "anthropic" )
75- expect ( getApiProtocol ( "bedrock " , "claude-3-opus" ) ) . toBe ( "anthropic" )
63+ expect ( getApiProtocol ( "vertex " , "claude-3-opus" ) ) . toBe ( "anthropic" )
7664 expect ( getApiProtocol ( "vertex" , "ClAuDe-InStAnT" ) ) . toBe ( "anthropic" )
7765 } )
7866 } )
0 commit comments