Repository navigation
feat(gemini): Migrate to google-genai SDK and update dependencies - #805
Merged
Merged
Conversation
- Upgrades core dependencies (Jackson, KotlinX, Jsoup, POI) to latest stable versions across the project. - Refactors Gemini model factory to use the modern GoogleGenAI client structure, resolving API deprecations. - Adds `GeneratedImageHelper` to centralize image generation logic within chat streams. - Increments project version to 1.5.5 to reflect dependency updates and fixes.
There was a problem hiding this comment.
🟡 Changes recommended
Active moderate issues remain in image extraction, custom endpoint propagation, executor cleanup, and request timeouts, including risks of silently dropped images, misrouted requests, resource leaks, and indefinite model creation blocking.
4 open issues
What changed in this PR
This pull request migrates the Gemini integration to LangChain4j’s Google GenAI SDK while updating dependencies, license metadata, third-party notices, and the project version.
Changes:
- Replaces legacy Gemini chat, streaming, image, and embedding implementations.
- Adds centralized generated-image extraction and updates streaming image handling.
- Updates dependency versions, license allow-list entries, third-party notices, and version to 1.5.5.
| File | Description |
|---|---|
THIRD-PARTY-NOTICES.txt |
Updates dependency versions, licenses, and transitive dependency notices. |
shared-jvm/src/main/kotlin/io/askimo/core/providers/GeneratedImageHelper.kt |
Adds shared generated-image extraction and detection utilities. |
shared-jvm/src/main/kotlin/io/askimo/core/providers/gemini/GeminiModelFactory.kt |
Migrates Gemini model construction and thinking configuration to Google GenAI. |
shared-jvm/src/main/kotlin/io/askimo/core/providers/ChatClientExtensions.kt |
Uses the generated-image helper during streaming responses. |
gradle/libs.versions.toml |
Updates dependency versions and replaces the Gemini integration artifact. |
gradle/allowed-licenses.json |
Allows licenses introduced by updated dependencies. |
gradle.properties |
Increments the project version to 1.5.5. |
This pull request requires changes.
Review effort: Lite
Comment on lines
+23
to
+38
| fun getGeneratedImages(aiMessage: AiMessage?): MutableList<Image?> { | ||
| if (aiMessage?.attributes() == null) { | ||
| return mutableListOf() | ||
| } | ||
|
|
||
| val images = aiMessage.attributes().get(GENERATED_IMAGES_KEY) | ||
| if (images is MutableList<*>) { | ||
| return try { | ||
| images as MutableList<Image?> | ||
| } catch (e: ClassCastException) { | ||
| mutableListOf() | ||
| } | ||
| } | ||
|
|
||
| return mutableListOf() | ||
| } |
Comment on lines
+162
to
+165
| val executor = Executors.newVirtualThreadPerTaskExecutor() | ||
| val testModel = GoogleGenAiStreamingChatModel | ||
| .builder() | ||
| .httpClientBuilder(createJdkHttpClientBuilder()) | ||
| .executor(executor) |
| val testModel = GoogleGenAiStreamingChatModel | ||
| .builder() | ||
| .httpClientBuilder(createJdkHttpClientBuilder()) | ||
| .executor(executor) |
Comment on lines
+186
to
188
| ): ImageModel = GoogleGenAiImageModel.builder() | ||
| .apiKey(safeApiKey(settings.apiKey)) | ||
| .httpClientBuilder(createJdkHttpClientBuilder()) | ||
| .baseUrl(settings.baseUrl) | ||
| .modelName(settings.imageModel) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
GeneratedImageHelperto centralize image generation logic within chat streams.Related Issue(s)
Type of Change
What Changed & Why
How to Test
./gradlew testScreenshots / Recordings (if applicable)
Checklist
main./gradlew spotlessApplyand./gradlew detektlocally./gradlew testand all tests passgit commit -sAdditional Notes