@@ -404,35 +404,29 @@ describe("getLiteLLMModels", () => {
404404 expect ( result ) . toEqual ( { } )
405405 } )
406406
407- it ( "uses fallback computer use detection when supports_computer_use is not available" , async ( ) => {
407+ it ( "uses image support as fallback for computer use when supports_computer_use is not available" , async ( ) => {
408408 const mockResponse = {
409409 data : {
410410 data : [
411411 {
412- model_name : "claude-3-5-sonnet-latest " ,
412+ model_name : "model-with-vision " ,
413413 model_info : {
414414 max_tokens : 4096 ,
415415 max_input_tokens : 200000 ,
416416 supports_vision : true ,
417417 supports_prompt_caching : false ,
418418 // Note: no supports_computer_use field
419419 } ,
420- litellm_params : {
421- model : "anthropic/claude-3-5-sonnet-latest" , // This should match the fallback list
422- } ,
423420 } ,
424421 {
425- model_name : "gpt-4-turbo " ,
422+ model_name : "model-without-vision " ,
426423 model_info : {
427424 max_tokens : 8192 ,
428425 max_input_tokens : 128000 ,
429426 supports_vision : false ,
430427 supports_prompt_caching : false ,
431428 // Note: no supports_computer_use field
432429 } ,
433- litellm_params : {
434- model : "openai/gpt-4-turbo" , // This should NOT match the fallback list
435- } ,
436430 } ,
437431 ] ,
438432 } ,
@@ -442,71 +436,62 @@ describe("getLiteLLMModels", () => {
442436
443437 const result = await getLiteLLMModels ( "test-api-key" , "http://localhost:4000" )
444438
445- expect ( result [ "claude-3-5-sonnet-latest " ] ) . toEqual ( {
439+ expect ( result [ "model-with-vision " ] ) . toEqual ( {
446440 maxTokens : 4096 ,
447441 contextWindow : 200000 ,
448442 supportsImages : true ,
449- supportsComputerUse : true , // Should be true due to fallback
443+ supportsComputerUse : true , // Should be true because supports_vision is true
450444 supportsPromptCache : false ,
451445 inputPrice : undefined ,
452446 outputPrice : undefined ,
453- description : "claude-3-5-sonnet-latest via LiteLLM proxy" ,
447+ description : "model-with-vision via LiteLLM proxy" ,
454448 } )
455449
456- expect ( result [ "gpt-4-turbo " ] ) . toEqual ( {
450+ expect ( result [ "model-without-vision " ] ) . toEqual ( {
457451 maxTokens : 8192 ,
458452 contextWindow : 128000 ,
459453 supportsImages : false ,
460- supportsComputerUse : false , // Should be false as it's not in fallback list
454+ supportsComputerUse : false , // Should be false because supports_vision is false
461455 supportsPromptCache : false ,
462456 inputPrice : undefined ,
463457 outputPrice : undefined ,
464- description : "gpt-4-turbo via LiteLLM proxy" ,
458+ description : "model-without-vision via LiteLLM proxy" ,
465459 } )
466460 } )
467461
468- it ( "prioritizes explicit supports_computer_use over fallback detection " , async ( ) => {
462+ it ( "prioritizes explicit supports_computer_use over image-based fallback " , async ( ) => {
469463 const mockResponse = {
470464 data : {
471465 data : [
472466 {
473- model_name : "claude-3-5-sonnet-latest " ,
467+ model_name : "model-with-vision-but-no-computer " ,
474468 model_info : {
475469 max_tokens : 4096 ,
476470 max_input_tokens : 200000 ,
477471 supports_vision : true ,
478472 supports_prompt_caching : false ,
479- supports_computer_use : false , // Explicitly set to false
480- } ,
481- litellm_params : {
482- model : "anthropic/claude-3-5-sonnet-latest" , // This matches fallback list but should be ignored
473+ supports_computer_use : false , // Explicitly set to false despite vision support
483474 } ,
484475 } ,
485476 {
486- model_name : "custom- model" ,
477+ model_name : "model-without-vision-but-computer " ,
487478 model_info : {
488479 max_tokens : 8192 ,
489480 max_input_tokens : 128000 ,
490481 supports_vision : false ,
491482 supports_prompt_caching : false ,
492- supports_computer_use : true , // Explicitly set to true
493- } ,
494- litellm_params : {
495- model : "custom/custom-model" , // This would NOT match fallback list
483+ supports_computer_use : true , // Explicitly set to true despite no vision support
496484 } ,
497485 } ,
498486 {
499- model_name : "another-custom-model " ,
487+ model_name : "model-with-both-false " ,
500488 model_info : {
501489 max_tokens : 8192 ,
502490 max_input_tokens : 128000 ,
503491 supports_vision : false ,
504492 supports_prompt_caching : false ,
505493 supports_computer_use : false , // Explicitly set to false
506494 } ,
507- litellm_params : {
508- model : "custom/another-custom-model" , // This would NOT match fallback list
509- } ,
510495 } ,
511496 ] ,
512497 } ,
@@ -516,79 +501,70 @@ describe("getLiteLLMModels", () => {
516501
517502 const result = await getLiteLLMModels ( "test-api-key" , "http://localhost:4000" )
518503
519- expect ( result [ "claude-3-5-sonnet-latest " ] ) . toEqual ( {
504+ expect ( result [ "model-with-vision-but-no-computer " ] ) . toEqual ( {
520505 maxTokens : 4096 ,
521506 contextWindow : 200000 ,
522507 supportsImages : true ,
523- supportsComputerUse : false , // False because explicitly set to false (fallback ignored)
508+ supportsComputerUse : false , // False because explicitly set to false (image fallback ignored)
524509 supportsPromptCache : false ,
525510 inputPrice : undefined ,
526511 outputPrice : undefined ,
527- description : "claude-3-5-sonnet-latest via LiteLLM proxy" ,
512+ description : "model-with-vision-but-no-computer via LiteLLM proxy" ,
528513 } )
529514
530- expect ( result [ "custom- model" ] ) . toEqual ( {
515+ expect ( result [ "model-without-vision-but-computer " ] ) . toEqual ( {
531516 maxTokens : 8192 ,
532517 contextWindow : 128000 ,
533518 supportsImages : false ,
534519 supportsComputerUse : true , // True because explicitly set to true
535520 supportsPromptCache : false ,
536521 inputPrice : undefined ,
537522 outputPrice : undefined ,
538- description : "custom- model via LiteLLM proxy" ,
523+ description : "model-without-vision-but-computer via LiteLLM proxy" ,
539524 } )
540525
541- expect ( result [ "another-custom-model " ] ) . toEqual ( {
526+ expect ( result [ "model-with-both-false " ] ) . toEqual ( {
542527 maxTokens : 8192 ,
543528 contextWindow : 128000 ,
544529 supportsImages : false ,
545530 supportsComputerUse : false , // False because explicitly set to false
546531 supportsPromptCache : false ,
547532 inputPrice : undefined ,
548533 outputPrice : undefined ,
549- description : "another-custom-model via LiteLLM proxy" ,
534+ description : "model-with-both-false via LiteLLM proxy" ,
550535 } )
551536 } )
552537
553- it ( "handles fallback detection with various model name formats " , async ( ) => {
538+ it ( "handles image-based computer use detection for various models " , async ( ) => {
554539 const mockResponse = {
555540 data : {
556541 data : [
557542 {
558- model_name : "vertex-claude " ,
543+ model_name : "vertex-model " ,
559544 model_info : {
560545 max_tokens : 4096 ,
561546 max_input_tokens : 200000 ,
562547 supports_vision : true ,
563548 supports_prompt_caching : false ,
564549 } ,
565- litellm_params : {
566- model : "vertex_ai/claude-3-5-sonnet" , // Should match fallback list
567- } ,
568550 } ,
569551 {
570- model_name : "openrouter-claude " ,
552+ model_name : "openrouter-model " ,
571553 model_info : {
572554 max_tokens : 4096 ,
573555 max_input_tokens : 200000 ,
574556 supports_vision : true ,
575557 supports_prompt_caching : false ,
576558 } ,
577- litellm_params : {
578- model : "openrouter/anthropic/claude-3.5-sonnet" , // Should match fallback list
579- } ,
580559 } ,
581560 {
582- model_name : "bedrock-claude " ,
561+ model_name : "bedrock-model " ,
583562 model_info : {
584563 max_tokens : 4096 ,
585564 max_input_tokens : 200000 ,
586- supports_vision : true ,
565+ supports_vision : false ,
587566 supports_prompt_caching : false ,
588567 } ,
589- litellm_params : {
590- model : "anthropic.claude-3-5-sonnet-20241022-v2:0" , // Should match fallback list
591- } ,
592568 } ,
593569 ] ,
594570 } ,
@@ -598,8 +574,10 @@ describe("getLiteLLMModels", () => {
598574
599575 const result = await getLiteLLMModels ( "test-api-key" , "http://localhost:4000" )
600576
601- expect ( result [ "vertex-claude" ] . supportsComputerUse ) . toBe ( true )
602- expect ( result [ "openrouter-claude" ] . supportsComputerUse ) . toBe ( true )
603- expect ( result [ "bedrock-claude" ] . supportsComputerUse ) . toBe ( true )
577+ // Models with vision support should have computer use enabled
578+ expect ( result [ "vertex-model" ] . supportsComputerUse ) . toBe ( true )
579+ expect ( result [ "openrouter-model" ] . supportsComputerUse ) . toBe ( true )
580+ // Model without vision support should not have computer use enabled
581+ expect ( result [ "bedrock-model" ] . supportsComputerUse ) . toBe ( false )
604582 } )
605583} )
0 commit comments