diff --git a/README.md b/README.md index 9121fa2b..f0d078e4 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![REUSE status](https://api.reuse.software/badge/git.fsfe.org/reuse/api)](https://api.reuse.software/info/git.fsfe.org/reuse/api) [![Fosstars security rating](https://github.com/SAP/cloud-sdk-java/blob/fosstars-report/fosstars_badge.svg)](https://github.com/SAP/cloud-sdk-java/blob/fosstars-report/fosstars_report.md) -# AI SDK for Java +# SAP Cloud SDK for AI (for Java) # ⚠️ This is a pre-alpha version of the AI SDK for Java. The APIs are subject to change ⚠️ diff --git a/e2e-test-app/src/test/java/com/sap/ai/sdk/app/controllers/OpenAiTest.java b/e2e-test-app/src/test/java/com/sap/ai/sdk/app/controllers/OpenAiTest.java index c37aff53..2973239a 100644 --- a/e2e-test-app/src/test/java/com/sap/ai/sdk/app/controllers/OpenAiTest.java +++ b/e2e-test-app/src/test/java/com/sap/ai/sdk/app/controllers/OpenAiTest.java @@ -39,7 +39,7 @@ void streamChatCompletion() { .setMessages(List.of(new OpenAiChatUserMessage().addText("Who is the prettiest?"))); final var totalOutput = new OpenAiChatCompletionOutput(); - final var emptyDeltaCount = new AtomicInteger(0); + final var filledDeltaCount = new AtomicInteger(0); OpenAiClient.forModel(GPT_35_TURBO) .streamChatCompletionDeltas(request) .peek(totalOutput::addDelta) @@ -47,15 +47,15 @@ void streamChatCompletion() { .forEach( delta -> { final String deltaContent = delta.getDeltaContent(); - log.info("deltaContent: {}", deltaContent); - if (deltaContent.isEmpty()) { - emptyDeltaCount.incrementAndGet(); + log.info("delta: {}", delta); + if (!deltaContent.isEmpty()) { + filledDeltaCount.incrementAndGet(); } }); // the first two and the last delta don't have any content // see OpenAiChatCompletionDelta#getDeltaContent - assertThat(emptyDeltaCount.get()).isLessThanOrEqualTo(3); + assertThat(filledDeltaCount.get()).isGreaterThan(0); assertThat(totalOutput.getChoices()).isNotEmpty(); assertThat(totalOutput.getChoices().get(0).getMessage().getContent()).isNotEmpty(); diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/StreamedDelta.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/StreamedDelta.java index ac790901..f426bf34 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/StreamedDelta.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/StreamedDelta.java @@ -17,7 +17,7 @@ public interface StreamedDelta { * *
Note: If there are multiple choices only the first one is returned * - *
Note: The first two and the last delta do not contain any content + *
Note: Some deltas do not contain any content * * @return the message content or empty string. */