check if model is embedding by testing it (#332)
This commit is contained in:
parent
3ae13285e8
commit
cece8a91d5
1 changed files with 7 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import httpx
|
||||
from typing import Dict, List
|
||||
from api.provider_validation import test_embedding
|
||||
from utils.container_utils import transform_localhost_url
|
||||
from utils.logging_config import get_logger
|
||||
|
||||
|
|
@ -171,10 +172,12 @@ class ModelsService:
|
|||
has_tools = TOOL_CALLING_CAPABILITY in capabilities
|
||||
|
||||
# Check if it's an embedding model
|
||||
is_embedding = any(
|
||||
embed_model in model_name.lower()
|
||||
for embed_model in self.OLLAMA_EMBEDDING_MODELS
|
||||
)
|
||||
try:
|
||||
await test_embedding("ollama", endpoint=endpoint, embedding_model=model_name)
|
||||
is_embedding = True
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to test embedding for model {model_name}: {str(e)}")
|
||||
is_embedding = False
|
||||
|
||||
if is_embedding:
|
||||
# Embedding models only need completion capability
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue