Commit b660081
committed
Feature: Reorder AI prompt components
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.1 parent 5801fba commit b660081
File tree
2 files changed
+13
-14
lines changed- app
- src/main/kotlin/com/google/ai/sample/feature/multimodal
2 files changed
+13
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
Lines changed: 12 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 93 | + | |
102 | 94 | | |
103 | 95 | | |
104 | 96 | | |
| |||
542 | 534 | | |
543 | 535 | | |
544 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
545 | 541 | | |
546 | 542 | | |
547 | 543 | | |
| |||
607 | 603 | | |
608 | 604 | | |
609 | 605 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
614 | 613 | | |
615 | 614 | | |
616 | 615 | | |
| |||
0 commit comments