Skip to content

Commit e495580

Browse files
authored
Align handling of empty choices. (#179)
Co-authored-by: Jonas Israel <[email protected]>
1 parent bf1f491 commit e495580

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionOutput.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ public class OpenAiChatCompletionOutput extends OpenAiCompletionOutput
4040
*/
4141
@Nonnull
4242
public String getContent() throws OpenAiClientException {
43-
if (getChoices().isEmpty()) {
44-
return "";
45-
}
43+
// We expect choices to be defined and never empty.
4644
if ("content_filter".equals(getChoices().get(0).getFinishReason())) {
4745
throw new OpenAiClientException("Content filter filtered the output.");
4846
}

0 commit comments

Comments
 (0)