mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
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:
@@ -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"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user