Skip to content

Commit ab1637d

Browse files
committed
fix
Signed-off-by: yuluo-yx <[email protected]>
1 parent eab0f35 commit ab1637d

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/semantic-router/pkg/utils/entropy/entropy.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ func getTopCategories(probabilities []float32, categoryNames []string, topN int)
214214
})
215215

216216
// Return top N
217-
n := minInt(topN, len(pairs))
218-
return pairs[:n]
217+
return pairs[:int(math.Min(float64(topN), float64(len(pairs))))]
219218
}
220219

221220
// Helper function to make weighted decision from top categories
@@ -249,11 +248,3 @@ func makeWeightedDecision(topCategories []CategoryProbability, categoryReasoning
249248
TopCategories: topCategories,
250249
}
251250
}
252-
253-
// Helper function to get minimum of two integers
254-
func minInt(a, b int) int {
255-
if a < b {
256-
return a
257-
}
258-
return b
259-
}

0 commit comments

Comments
 (0)