-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Refactor model field parsing in AnthropicChatCompletionStreamingProcessor #137926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DonalEvans
merged 6 commits into
elastic:main
from
Jan-Kazlouski-elastic:google-model-garden-anthropic-streaming-processor-fix
Nov 12, 2025
Merged
Refactor model field parsing in AnthropicChatCompletionStreamingProcessor #137926
DonalEvans
merged 6 commits into
elastic:main
from
Jan-Kazlouski-elastic:google-model-garden-anthropic-streaming-processor-fix
Nov 12, 2025
+293
−76
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
Author
|
After discussion in slack I updated the solution. Improved parsing logic, type checks, documentation and test coverage. Testing results: Completion Non-Streaming (regression)RQRS Completion Streaming (regression)RQRS Basic Chat Completion (fixed)RQRS Complex Chat Completion (fixed)RQRS |
DonalEvans
approved these changes
Nov 12, 2025
…nthropic-streaming-processor-fix
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
Collaborator
💚 Backport successful
|
DonalEvans
pushed a commit
to DonalEvans/elasticsearch
that referenced
this pull request
Nov 12, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Nov 12, 2025
…Processor (#137926) (#137991) Co-authored-by: Jan-Kazlouski-elastic <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-backport
Automatically create backport pull requests when merged
>bug
external-contributor
Pull request authored by a developer outside the Elasticsearch team
:ml
Machine learning
Team:ML
Meta label for the ML team
v9.2.2
v9.3.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is needed to fix Google Model Garden Anthropic
message_startevent parsing.During demo call, it was observed that PERFORM CHAT COMPLETION INFERENCE call returns parsing error when parsing provider's
message_startevent.Investigation has shown that during initial testing of Google Model Garden support
message_startevent was being returned like this:Now
message_startevent is being returned like this:Anthropic changed the order of the fields movig
modelfield to the top ofmessagedictionary. That is causing current implementation to fail during events parsing. In order to provide the fix for this behavior - order of field parsing is changed so model field is parsed first.For future proof, fix can be achieved by complex refactoring of whole AnthropicChatCompletionStreamingProcessor class, but that is likely to be a complex task that may take a lot of resources and time. Because during GMG support implementation usage of ConstructingObjectParser was not proven to be optimal for this task. For now - I'm proposing quick fixing this by changing the parsing order and discuss the possibility of further refactoring later.
Testing result:
gradle check?