11import { ANTHROPIC_API_PROTOCOL , getApiProtocol , OPENAI_API_PROTOCOL , providerIdentifiers } from "../index.js"
22
33describe ( "getApiProtocol" , ( ) => {
4- describe ( "Anthropic-style providers" , ( ) => {
5- it ( "should return 'anthropic' for anthropic provider" , ( ) => {
6- expect ( getApiProtocol ( providerIdentifiers . anthropic ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
7- expect ( getApiProtocol ( providerIdentifiers . anthropic , "gpt-4" ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
8- } )
4+ it ( "preserves API protocol wire values" , ( ) => {
5+ expect ( ANTHROPIC_API_PROTOCOL ) . toBe ( "anthropic" )
6+ expect ( OPENAI_API_PROTOCOL ) . toBe ( "openai" )
7+ } )
98
10- it ( "should return 'anthropic' for bedrock provider" , ( ) => {
11- expect ( getApiProtocol ( providerIdentifiers . bedrock ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
12- expect ( getApiProtocol ( providerIdentifiers . bedrock , "gpt-4" ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
13- expect ( getApiProtocol ( providerIdentifiers . bedrock , "claude-3-opus" ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
14- } )
9+ describe ( "Anthropic-style providers" , ( ) => {
10+ it . each ( [ providerIdentifiers . anthropic , providerIdentifiers . bedrock , providerIdentifiers . minimax ] ) (
11+ "should return 'anthropic' for %s provider" ,
12+ ( provider ) => {
13+ expect ( getApiProtocol ( provider ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
14+ expect ( getApiProtocol ( provider , "gpt-4" ) ) . toBe ( ANTHROPIC_API_PROTOCOL )
15+ } ,
16+ )
1517 } )
1618
1719 describe ( "Vertex provider with Claude models" , ( ) => {
@@ -33,11 +35,8 @@ describe("getApiProtocol", () => {
3335 } )
3436 } )
3537
36- describe ( "Vercel AI Gateway provider" , ( ) => {
37- it ( "uses canonical gateway identifiers for Anthropic model protocol selection" , ( ) => {
38- expect ( getApiProtocol ( providerIdentifiers . vercelAiGateway , "anthropic/claude-3-opus" ) ) . toBe (
39- ANTHROPIC_API_PROTOCOL ,
40- )
38+ describe ( "Gateway providers" , ( ) => {
39+ it ( "uses the canonical Zoo Gateway identifier for Anthropic model protocol selection" , ( ) => {
4140 expect ( getApiProtocol ( providerIdentifiers . zooGateway , "anthropic/claude-3-opus" ) ) . toBe (
4241 ANTHROPIC_API_PROTOCOL ,
4342 )
0 commit comments