Skip to content

Commit 69b49ea

Browse files
committed
Extend tests
1 parent 9062e3a commit 69b49ea

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public String getContent() {
7575
*/
7676
@Nonnull
7777
public OpenAiAssistantMessage getMessage() {
78-
var toolCalls = getChoice().getMessage().getToolCalls();
78+
final var toolCalls = getChoice().getMessage().getToolCalls();
7979

8080
if (toolCalls == null) {
8181
return OpenAiMessage.assistant(getContent());

foundation-models/openai/src/test/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientGeneratedTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,11 @@ void chatCompletionResponseGetMessage() {
593593

594594
assertThat(simpleMessage).isNotNull();
595595
assertThat(simpleMessage.toolCalls()).isEmpty();
596+
assertThat(simpleMessage.content().items()).hasSize(1);
597+
assertThat(simpleMessage.content().items().get(0)).isInstanceOf(OpenAiTextItem.class);
598+
assertThat(((OpenAiTextItem) simpleMessage.content().items().get(0)).text())
599+
.isEqualTo(
600+
"I'm an AI and cannot answer that question as beauty is subjective and varies from person to person.");
596601

597602
stubForChatCompletionTool();
598603

0 commit comments

Comments
 (0)