Skip to content

fix(streaming): replace null delta.role with \"assistant\" in chat completion chunks - #3440

Open
anditherobot wants to merge 2 commits into
lemonade-sdk:mainfrom
anditherobot:fix/350-sse-null-role
Open

fix(streaming): replace null delta.role with \"assistant\" in chat completion chunks#3440
anditherobot wants to merge 2 commits into
lemonade-sdk:mainfrom
anditherobot:fix/350-sse-null-role

Conversation

@anditherobot

Copy link
Copy Markdown
Contributor

Summary

Fixes #350.

Replaces role: null with "assistant" in chat stream chunks so client libraries do not crash during streaming.

Scope

  • Rewrite null delta.role values to "assistant" in chat streams (src/cpp/server/streaming_proxy.cpp).
  • Turn on role normalization for chat stream endpoints (src/cpp/server/wrapped_server.cpp).
  • Test valid roles, null roles, thinking-block chunks, and raw stream passthrough (test/cpp/test_streaming_role_normalization.cpp).

Testing

  • Ran ctest -R StreamingRoleNormalizationTest (all 8 tests pass).

Documentation

  • No documentation changes needed.

Breaking Changes

  • None.

AI-Assisted Contribution

  • This contribution was created with the assistance of AI tools.
  • I have reviewed the changes and take full responsibility for the code.
  • I have tested the changes and verified that they work as expected.

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request labels Aug 31, 2026
@anditherobot
anditherobot marked this pull request as ready for review August 31, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add role to choice[0].delta.role in response

1 participant