Skip to content

Commit

Permalink
add postprocess function for batch inferernce jobArn
Browse files Browse the repository at this point in the history
Signed-off-by: Yaliang Wu <[email protected]>
  • Loading branch information
ylwu-amzn committed Sep 13, 2024
1 parent bdf36bb commit a060cfa
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class BedrockBatchJobArnPostProcessFunction extends ConnectorPostProcessFunction<List<Float>> {

@Override
public void validate(Object input) {
if (!(input instanceof List)) {
throw new IllegalArgumentException("Post process function input is not a List.");
if (!(input instanceof Map)) {
throw new IllegalArgumentException("Post process function input is not a Map.");
}

List<?> outerList = (List<?>) input;
Map<String, String> jobInfo = (Map<String, String>) input;

if (!outerList.isEmpty() && !(((List<?>) input).get(0) instanceof Number)) {
throw new IllegalArgumentException("The embedding should be a non-empty List containing Float values.");
if (!(jobInfo.containsKey("jobArn"))) {
throw new IllegalArgumentException("Bedrock batch job arn missing.");
}
}

Expand Down

0 comments on commit a060cfa

Please sign in to comment.