Skip to content

Commit 7f54e02

Browse files
Update orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringChatDelta.java
Co-authored-by: Alexander Dümont <[email protected]>
1 parent 4493074 commit 7f54e02

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringChatDelta.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,12 @@ static Generation toGeneration(@Nonnull final LLMChoice choice) {
5151

5252
// will be fixed once the generated code add a discriminator which will allow this class to extend
5353
// CompletionPostResponseStreaming
54-
@SuppressWarnings("unchecked")
54+
@Nonnull
5555
private static String getContent(@Nonnull final LLMChoice choice) {
56-
val message = (Map<String, Object>) choice.getCustomField("delta");
57-
if (message != null && message.get("content") != null) {
58-
return message.get("content").toString();
59-
}
60-
return "";
56+
return choice.getCustomField("delta") instanceof Map<?, ?> delta
57+
&& delta.get("content") instanceof String content
58+
? content
59+
: "";
6160
}
6261

6362
@Nonnull

0 commit comments

Comments
 (0)