Explorar el Código

bug: fixed bedrock rerank bug (#12774)

Co-authored-by: hobo.l <hobo.l@binance.com>
luckylhb90 hace 3 meses
padre
commit
3d1ce4c53f

+ 1 - 1
api/core/model_runtime/model_providers/bedrock/rerank/rerank.py

@@ -70,7 +70,7 @@ class BedrockRerankModel(RerankModel):
         rerankingConfiguration = {
             "type": "BEDROCK_RERANKING_MODEL",
             "bedrockRerankingConfiguration": {
-                "numberOfResults": top_n,
+                "numberOfResults": min(top_n, len(text_sources)),
                 "modelConfiguration": {
                     "modelArn": model_package_arn,
                 },