Skip to content

Conversation

windschi3f
Copy link

Description

Fixes a NullPointerException that occurs in AzureOpenAiStreamingChatModel when Azure OpenAI sends streaming chunks without delta content.

Problem

Azure OpenAI streaming responses sometimes include chunks without a delta field. The current code assumes delta is always present, causing NPE at line 237: Cannot invoke "dev.langchain4j.model.openai.internal.chat.Delta.content()" because "delta" is null

Solution

Added null check for delta object before accessing its content

Testing

Tested with streaming requests that previously crashed

Azure OpenAI sends streaming chunks without delta content for
end-of-stream markers and content filter responses. Added null
check to prevent NullPointerException in streaming handler.
@windschi3f windschi3f requested a review from a team as a code owner August 26, 2025 15:39
Copy link
Collaborator

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@geoand geoand added the triage/backport-1.1 Label to be added to PRs that should be considered for backporting to 1.1 label Aug 26, 2025

This comment has been minimized.

Copy link

quarkus-bot bot commented Aug 26, 2025

Status for workflow Build (on pull request)

This is the status report for running Build (on pull request) on commit 5ae0475.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@geoand geoand merged commit b859a39 into quarkiverse:main Aug 26, 2025
154 of 155 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/backport-1.1 Label to be added to PRs that should be considered for backporting to 1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants