fix(spring-ai-azure-openai): last chat completions can have null deltas
Signed-off-by: ogirardot <olivier.girardot@arkhn.com>
This commit is contained in:
committed by
Ilayaperumal Gopinathan
parent
12729b0900
commit
dd9e574092
@@ -353,7 +353,11 @@ public class AzureOpenAiChatModel extends AbstractToolCallSupport implements Cha
|
||||
|| chatCompletions.getUsage() != null)
|
||||
.map(chatCompletions -> {
|
||||
if (!chatCompletions.getChoices().isEmpty()) {
|
||||
final var toolCalls = chatCompletions.getChoices().get(0).getDelta().getToolCalls();
|
||||
ChatChoice chatChoice = chatCompletions.getChoices().get(0);
|
||||
List<ChatCompletionsToolCall> toolCalls = null;
|
||||
if (chatChoice.getDelta() != null) {
|
||||
toolCalls = chatChoice.getDelta().getToolCalls();
|
||||
}
|
||||
isFunctionCall.set(toolCalls != null && !toolCalls.isEmpty());
|
||||
}
|
||||
return chatCompletions;
|
||||
|
||||
Reference in New Issue
Block a user