Skip to content

Commit

Permalink
fix null values validation
Browse files Browse the repository at this point in the history
  • Loading branch information
czelabueno committed Jan 3, 2025
1 parent 3a9229c commit 22baa45
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ private static <T extends AbstractStatefulBean> Flux<String> streamingFunction(
StreamingChatLanguageModel streamingChatLanguageModel) {
Sinks.Many<String> sink = Sinks.many().unicast().onBackpressureBuffer();
CompletableFuture<AiMessage> futureResponse = new CompletableFuture<>();
messages = getOrDefault(
messages,
doUserMessage != null
? Arrays.asList(doUserMessage.apply(statefulBean))
: Arrays.asList(UserMessage.from(statefulBean.getQuestion()))
);
if (messages == null || messages.isEmpty()) {
messages = doUserMessage != null ?
List.of(doUserMessage.apply(statefulBean)) :
List.of(UserMessage.from(getOrDefault(statefulBean.getQuestion(),"No question provided.")));
}

streamingChatLanguageModel.generate(
messages,
Expand Down

0 comments on commit 22baa45

Please sign in to comment.