search embeding model support for watsonx models
This commit is contained in:
parent
0fc0be855c
commit
0a2a991519
1 changed files with 4 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import copy
|
import copy
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
from agentd.tool_decorator import tool
|
from agentd.tool_decorator import tool
|
||||||
from config.settings import EMBED_MODEL, clients, INDEX_NAME, get_embedding_model
|
from config.settings import EMBED_MODEL, clients, INDEX_NAME, get_embedding_model, WATSONX_EMBEDDING_DIMENSIONS
|
||||||
from auth_context import get_auth_context
|
from auth_context import get_auth_context
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
|
|
@ -155,18 +155,15 @@ class SearchService:
|
||||||
if not any(model_name.startswith(prefix + "/") for prefix in ["openai", "ollama", "watsonx", "anthropic"]):
|
if not any(model_name.startswith(prefix + "/") for prefix in ["openai", "ollama", "watsonx", "anthropic"]):
|
||||||
# Detect provider from model name characteristics:
|
# Detect provider from model name characteristics:
|
||||||
# - Ollama: contains ":" (e.g., "nomic-embed-text:latest")
|
# - Ollama: contains ":" (e.g., "nomic-embed-text:latest")
|
||||||
# - WatsonX: starts with "ibm/" or known third-party models
|
# - WatsonX: check against known IBM embedding models
|
||||||
# - OpenAI: everything else (no prefix needed)
|
# - OpenAI: everything else (no prefix needed)
|
||||||
|
|
||||||
if ":" in model_name:
|
if ":" in model_name:
|
||||||
# Ollama models use tags with colons
|
# Ollama models use tags with colons
|
||||||
formatted_model = f"ollama/{model_name}"
|
formatted_model = f"ollama/{model_name}"
|
||||||
logger.debug(f"Formatted Ollama model: {model_name} -> {formatted_model}")
|
logger.debug(f"Formatted Ollama model: {model_name} -> {formatted_model}")
|
||||||
elif model_name.startswith("ibm/") or model_name in [
|
elif model_name in WATSONX_EMBEDDING_DIMENSIONS:
|
||||||
"intfloat/multilingual-e5-large",
|
# WatsonX embedding models - use hardcoded list from settings
|
||||||
"sentence-transformers/all-minilm-l6-v2"
|
|
||||||
]:
|
|
||||||
# WatsonX embedding models
|
|
||||||
formatted_model = f"watsonx/{model_name}"
|
formatted_model = f"watsonx/{model_name}"
|
||||||
logger.debug(f"Formatted WatsonX model: {model_name} -> {formatted_model}")
|
logger.debug(f"Formatted WatsonX model: {model_name} -> {formatted_model}")
|
||||||
# else: OpenAI models don't need a prefix
|
# else: OpenAI models don't need a prefix
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue