diff --git a/README.md b/README.md index 47bf2f2a..59aaf25d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ OpenRAG is a comprehensive Retrieval-Augmented Generation platform that enables intelligent document search and AI-powered conversations. Users can upload, process, and query documents through a chat interface backed by large language models and semantic search capabilities. The system utilizes Langflow for document ingestion, retrieval workflows, and intelligent nudges, providing a seamless RAG experience. Built with [Starlette](https://github.com/Kludex/starlette) and [Next.js](https://github.com/vercel/next.js). Powered by [OpenSearch](https://github.com/opensearch-project/OpenSearch), [Langflow](https://github.com/langflow-ai/langflow), and [Docling](https://github.com/docling-project/docling). -Ask DeepWiki +Ask DeepWiki
diff --git a/src/services/models_service.py b/src/services/models_service.py index cbbc7c74..35f1043f 100644 --- a/src/services/models_service.py +++ b/src/services/models_service.py @@ -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 @@ -9,18 +10,6 @@ logger = get_logger(__name__) class ModelsService: """Service for fetching available models from different AI providers""" - OLLAMA_EMBEDDING_MODELS = [ - "nomic-embed-text", - "mxbai-embed-large", - "snowflake-arctic-embed", - "all-minilm", - "bge-m3", - "bge-large", - "paraphrase-multilingual", - "granite-embedding", - "jina-embeddings-v2-base-en", - ] - OPENAI_TOOL_CALLING_MODELS = [ "gpt-5", "gpt-5-mini", @@ -171,10 +160,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