Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ private static float[] meanPool(float[][] vectors) {
}

private float[] weightedAverage(List<float[]> embeddings, List<Integer> weights) {
if (embeddings.isEmpty()) {
throw new RuntimeException("Embeddings list cannot be empty");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I suggest using more specific IllegalArgumentException?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new RuntimeException("Embeddings list cannot be empty");
throw new IllegalArgumentException("Embeddings list cannot be empty");

}

if (embeddings.size() == 1) {
return embeddings.get(0);
}
Expand Down