RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(model_meta): discover TEI reranker models (#19210)
dawn70601910ef24
diff --git a/rag/llm/model_meta.py b/rag/llm/model_meta.pyindex f4eb955122..aafa5dad9b 100644--- a/rag/llm/model_meta.py+++ b/rag/llm/model_meta.py@@ -1063,7 +1063,7 @@ class HuggingFace(Base):if isinstance(model_type, dict):if "embedding" in model_type:return [LLMType.EMBEDDING.value]- if "rerank" in model_type:+ if "reranker" in model_type:return [LLMType.RERANK.value]return []# TGI format: "text-generation" / "text2text-generation"diff --git a/test/unit_test/rag/llm/test_model_meta_huggingface.py b/test/unit_test/rag/llm/test_model_meta_huggingface.pynew file mode 100644index 0000000000..7d3101b3e7--- /dev/null+++ b/test/unit_test/rag/llm/test_model_meta_huggingface.py@@ -0,0 +1,77 @@+#+# Copyright 2026 The InfiniFlow Authors. All Rights Reserved.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+#++import pytest++from common.constants import LLMType+from rag.llm.model_meta import HuggingFace++pytestmark = pytest.mark.p2+++ ("model_info", "expected_type", "expected_max_tokens"),+ [+ pytest.param(+ {+ "model_id": "/data/gte-rerank-int8",+ "model_type": {+ "reranker": {+ "id2label": {"0": "LABEL_0"},+ "label2id": {"LABEL_0": 0},+ }+ },+ "max_input_length": 2048,+ "version": "1.9.3",+ },+ LLMType.RERANK.value,+ 2048,+ id="tei-reranker",+ ),+ pytest.param(+ {+ "model_id": "/data/qwen3-embed-int8",+ "model_type": {"embedding": {"pooling": "last_token"}},+ "max_input_length": 2048,+ "version": "1.9.3",+ },+ LLMType.EMBEDDING.value,+ 2048,+ id="tei-embedding",+ ),+ pytest.param(+ {+ "model_id": "meta-llama/Llama-2-7b-chat-hf",+ "model_type": "text-generation",+ "max_total_tokens": 4096,+ },+ LLMType.CHAT.value,+ 4096,+ id="tgi-text-generation",+ ),+ ],+)+def test_huggingface_formats_discovered_model(model_info, expected_type, expected_max_tokens):+ provider = HuggingFace(api_key="", base_url="http://inference-server")++ assert provider._format_model_list(model_info) == [+ {+ "name": model_info["model_id"],+ "model_types": [expected_type],+ "features": [],+ "max_tokens": expected_max_tokens,+ }+ ]