KG-487 Add handler for GooglePart.InlineData #1094
Merged
+83
−1
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.
YouTrack link: https://youtrack.jetbrains.com/issue/KG-487/GoogleLLMClient-does-not-support-InlineData-part-type
#954
Motivation and Context
Currently,
GoogleLLMClientthrows anIllegalStateException: Not supported part type: InlineDatawhen processing responses from Gemini models that return binary content, such as images (e.g., fromgemini-2.5-flash-image). This crash occurs because theprocessGoogleCandidatefunction lacks a handler for theGooglePart.InlineDatatype.This PR adds the necessary logic to correctly parse
InlineDataparts intoMessage.Assistantmessages containing eitherContentPart.ImageorContentPart.File, allowing the client to support multimodal responses from Google's API.>> Important Note <<
gemini-2.5-flash-imageis not in GoogleModels.kt and therefor nor officially supported yet. For that reason there are only unit tests for theInlineDatahandler in this PR. I would be open to add this Model but best to open a separate Issue for it and discuss.Breaking Changes
None. This change is a non-breaking bug fix that adds support for a previously unhandled response type. Existing functionality is unaffected.
Type of the changes
Checklist
developas the base branchAdditional steps for pull requests adding a new feature