From 048ec2fc5c3baa70809746b1c6bee0da5e45ab7a Mon Sep 17 00:00:00 2001 From: Jin Hai Date: Sat, 9 May 2026 20:45:53 +0800 Subject: [PATCH] Go: fix siliconflow rerank issue (#14743) ### What problem does this PR solve? As title. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) Signed-off-by: Jin Hai --- internal/entity/models/siliconflow.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/entity/models/siliconflow.go b/internal/entity/models/siliconflow.go index f3c658662c..bb72d234bf 100644 --- a/internal/entity/models/siliconflow.go +++ b/internal/entity/models/siliconflow.go @@ -657,11 +657,16 @@ func (s *SiliconflowModel) Rerank(modelName *string, query string, documents []s apiKey = *apiConfig.ApiKey } + var topN = rerankConfig.TopN + if rerankConfig.TopN == 0 { + topN = len(documents) + } + reqBody := SiliconflowRerankRequest{ Model: *modelName, Query: query, Documents: documents, - TopN: rerankConfig.TopN, + TopN: topN, ReturnDocuments: false, MaxChunksPerDoc: 1024, OverlapTokens: 80,