Skip to content

Commit

Permalink
bug fix: index out of bound
Browse files Browse the repository at this point in the history
Signed-off-by: yuye-aws <[email protected]>
  • Loading branch information
yuye-aws committed Aug 6, 2024
1 parent c2d3fb4 commit d48d455
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/opensearch/agent/tools/RCATool.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public <T> void runOption2(
.range(0, causes.size())
.boxed()
.collect(
Collectors.toMap(i -> causes.get(i).get("reason"), i -> responseVectors.get(i).dotProduct(expectedResponseVectors.get(i)))
Collectors.toMap(i -> causes.get(i).get("reason"), i -> responseVectors.get(0).dotProduct(expectedResponseVectors.get(i)))
);

Optional<Map.Entry<String, Double>> mapEntry = dotProductMap.entrySet().stream().max(Map.Entry.comparingByValue());
Expand Down Expand Up @@ -201,7 +201,7 @@ public <T> void run(Map<String, String> parameters, ActionListener<T> listener)
if (isLLMOption) {
runOption1(phenomenon, causes, apiToResponse, listener);
} else {
runOption1(phenomenon, causes, apiToResponse, listener);
runOption2(phenomenon, causes, apiToResponse, listener);
}
}, listener::onFailure),
apiList.size()
Expand Down

0 comments on commit d48d455

Please sign in to comment.