Skip to content

Commit e80c80a

Browse files
committed
Wip
1 parent 301a72d commit e80c80a

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationChatCompletionDelta.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.sap.ai.sdk.orchestration;
22

33
import com.sap.ai.sdk.core.common.StreamedDelta;
4+
import com.sap.ai.sdk.orchestration.model.ChatDelta;
45
import com.sap.ai.sdk.orchestration.model.CompletionPostResponseStreaming;
56
import java.util.Map;
67
import javax.annotation.Nonnull;
@@ -24,7 +25,7 @@ public String getDeltaContent() {
2425
// A delta only contains one choice with a variable index
2526
&& choices.get(0).getIndex() == 0) {
2627

27-
final var message = (Map<String, Object>) choices.get(0).toMap().get("delta");
28+
final var message = (Map<String, Object>) ((ChatDelta) choices.get(0).toMap().get("delta")).toMap();
2829
// Avoid the second delta: "choices":[{"delta":{"content":"","role":"assistant"}}]
2930
if (message != null && message.get("content") != null) {
3031
return message.get("content").toString();

orchestration/src/test/java/com/sap/ai/sdk/orchestration/OrchestrationUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ void streamChatCompletionDeltas() throws IOException {
704704
assertThat(choices0.getFinishReason()).isEmpty();
705705
assertThat(choices0.toMap().get("delta")).isNotNull();
706706
// this should be getDelta(), only when the result is of type LLMModuleResultStreaming
707-
final var message0 = (Map<String, Object>) choices0.toMap().get("delta");
707+
final var message0 = (Map<String, Object>) ((ChatDelta) choices0.toMap().get("delta")).toMap();
708708
assertThat(message0.get("role")).isEqualTo("");
709709
assertThat(message0.get("content")).isEqualTo("");
710710
final var templating = deltaList.get(0).getModuleResults().getTemplating();

orchestration/src/test/resources/filteringLooseRequest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"Hate": 4,
3636
"SelfHarm": 4,
3737
"Sexual": 4,
38-
"Violence": 4
38+
"Violence": 4,
39+
"PromptShield" : false
3940
}
4041
},
4142
{

0 commit comments

Comments
 (0)