Feature: Reorder AI prompt components#25
Merged
Android-PowerUser merged 1 commit intoDatabase3from Jun 3, 2025
Merged
Conversation
Modifies PhotoReasoningViewModel.kt to change the order in which information is sent to the Generative AI model. The new order is: 1. System Message (as the first message in the chat history with "user" role) 2. Chat History (previous user/model messages) 3. Current User Input Previously, the system message was prepended to the current user input. This change makes the system message a more distinct initial instruction for the AI model. Changes include: - Modified `rebuildChatHistory()` to prepend the system message. - Modified `clearChatHistory()` to initialize with the system message. - Removed system message prepending from the `reason()` method. Note: The `com.google.ai.client.generativeai` SDK (version 0.9.0) used in this application is deprecated. You should consider migrating to the recommended Firebase SDK for future development and potentially more robust support for system instructions. Automated testing of this change could not be completed due to persistent Android SDK configuration issues in the test environment.
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.
Modifies PhotoReasoningViewModel.kt to change the order in which information is sent to the Generative AI model. The new order is:
Previously, the system message was prepended to the current user input. This change makes the system message a more distinct initial instruction for the AI model.
Changes include:
rebuildChatHistory()to prepend the system message.clearChatHistory()to initialize with the system message.reason()method.Note: The
com.google.ai.client.generativeaiSDK (version 0.9.0) used in this application is deprecated. You should consider migrating to the recommended Firebase SDK for future development and potentially more robust support for system instructions.Automated testing of this change could not be completed due to persistent Android SDK configuration issues in the test environment.