Add tongyi gte-rerank-v2 (#14215)

https://bailian.console.aliyun.com/cn-beijing?tab=api#/api/?type=model&url=2780056

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change
- [x] Other (please describe): add gte-rerank-v2、qwen3-rerank
This commit is contained in:
rhinoceros.xn
2026-04-20 11:39:17 +08:00
committed by GitHub
parent d5c306de30
commit 4e992de91f
2 changed files with 26 additions and 2 deletions

View File

@@ -790,6 +790,18 @@
"max_tokens": 1000000,
"model_type": "chat",
"is_tools": true
},
{
"llm_name": "gte-rerank-v2",
"tags": "RE-RANK,4k",
"max_tokens": 4000,
"model_type": "rerank"
},
{
"llm_name": "qwen3-rerank",
"tags": "RE-RANK,4k",
"max_tokens": 4000,
"model_type": "rerank"
}
]
},

View File

@@ -375,7 +375,19 @@ class QWenRerank(Base):
import dashscope
resp = dashscope.TextReRank.call(api_key=self.api_key, model=self.model_name, query=query, documents=texts, top_n=len(texts), return_documents=False)
# qwen3-rerank does not support return_documents parameter
if self.model_name.startswith("qwen3-rerank"):
resp = dashscope.TextReRank.call(
api_key=self.api_key, model=self.model_name,
query=query, documents=texts, top_n=len(texts)
)
else:
resp = dashscope.TextReRank.call(
api_key=self.api_key, model=self.model_name,
query=query, documents=texts,
top_n=len(texts), return_documents=False
)
rank = np.zeros(len(texts), dtype=float)
if resp.status_code == HTTPStatus.OK:
try:
@@ -549,4 +561,4 @@ class RAGconRerank(Base):
rank = Base._normalize_rank(rank)
return rank, token_count
return rank, token_count