@@ -434,5 +434,78 @@ def match_json(
434434 model_spec : EmbeddingSpecV1 ,
435435 quantization : str ,
436436 ) -> bool :
437- # As default embedding engine, sentence-transformer support all models
438- return model_spec .model_format in ["pytorch" ]
437+ from ..match_result import MatchResult
438+
439+ result = cls .match_json_with_reason (model_family , model_spec , quantization )
440+ return result .is_match
441+
442+ @classmethod
443+ def match_json_with_reason (
444+ cls ,
445+ model_family : EmbeddingModelFamilyV2 ,
446+ model_spec : EmbeddingSpecV1 ,
447+ quantization : str ,
448+ ) -> "MatchResult" :
449+ from ..match_result import ErrorType , MatchResult
450+
451+ # Check library availability
452+ if not cls .check_lib ():
453+ return MatchResult .failure (
454+ reason = "Sentence Transformers library is not installed" ,
455+ error_type = ErrorType .DEPENDENCY_MISSING ,
456+ technical_details = "sentence_transformers package not found in Python environment" ,
457+ )
458+
459+ # Check model format compatibility
460+ if model_spec .model_format not in ["pytorch" ]:
461+ return MatchResult .failure (
462+ reason = f"Sentence Transformers only supports pytorch format, got: { model_spec .model_format } " ,
463+ error_type = ErrorType .MODEL_FORMAT ,
464+ technical_details = f"Unsupported format: { model_spec .model_format } , required: pytorch" ,
465+ )
466+
467+ # Check model dimensions compatibility
468+ model_dimensions = model_family .dimensions
469+ if model_dimensions > 1536 : # Very large embedding models
470+ return MatchResult .failure (
471+ reason = f"Large embedding model detected ({ model_dimensions } dimensions)" ,
472+ error_type = ErrorType .MODEL_COMPATIBILITY ,
473+ technical_details = f"Large embedding dimensions: { model_dimensions } " ,
474+ )
475+
476+ # Check token limits
477+ max_tokens = model_family .max_tokens
478+ if max_tokens > 8192 : # Very high token limits
479+ return MatchResult .failure (
480+ reason = f"High token limit model detected (max_tokens: { max_tokens } )" ,
481+ error_type = ErrorType .CONFIGURATION_ERROR ,
482+ technical_details = f"High max_tokens: { max_tokens } " ,
483+ )
484+
485+ # Check for special model requirements
486+ model_name = model_family .model_name .lower ()
487+
488+ # Check Qwen2 GTE models
489+ if "gte" in model_name and "qwen2" in model_name :
490+ # These models have specific requirements
491+ if not hasattr (cls , "_check_qwen_gte_requirements" ):
492+ return MatchResult .failure (
493+ reason = "Qwen2 GTE models require special handling" ,
494+ error_type = ErrorType .MODEL_COMPATIBILITY ,
495+ technical_details = "Qwen2 GTE model special requirements" ,
496+ )
497+
498+ # Check Qwen3 models
499+ if "qwen3" in model_name :
500+ # Qwen3 has flash attention requirements
501+ try :
502+ # This would be checked during actual loading
503+ pass
504+ except Exception :
505+ return MatchResult .failure (
506+ reason = "Qwen3 embedding model may have compatibility issues" ,
507+ error_type = ErrorType .VERSION_REQUIREMENT ,
508+ technical_details = "Qwen3 model compatibility check" ,
509+ )
510+
511+ return MatchResult .success ()
0 commit comments