Skip to content

Feature: Reorder AI prompt components#25

Merged
Android-PowerUser merged 1 commit intoDatabase3from
fix/parcelable-systemmessageentry
Jun 3, 2025
Merged

Feature: Reorder AI prompt components#25
Android-PowerUser merged 1 commit intoDatabase3from
fix/parcelable-systemmessageentry

Conversation

@Android-PowerUser
Copy link
Owner

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.

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.
@Android-PowerUser Android-PowerUser merged commit f75f8e0 into Database3 Jun 3, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant