Skip to content

Commit 6f2ea11

Browse files
committed
bug #98 fix: Gemini system prompt (valtzu)
This PR was merged into the main branch. Discussion ---------- fix: Gemini system prompt | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | | License | MIT Cherry picking php-llm/llm-chain#381 Commits ------- 88be4b3 fix: Gemini system prompt (#381)
2 parents fd775eb + 88be4b3 commit 6f2ea11

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/platform/src/Bridge/Google/Contract/MessageBagNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function supportsModel(Model $model): bool
4444
* role: 'model'|'user',
4545
* parts: array<int, mixed>
4646
* }>,
47-
* system_instruction?: array{parts: array{text: string}}
47+
* system_instruction?: array{parts: array{text: string}[]}
4848
* }
4949
*/
5050
public function normalize(mixed $data, ?string $format = null, array $context = []): array
@@ -53,7 +53,7 @@ public function normalize(mixed $data, ?string $format = null, array $context =
5353

5454
if (null !== $systemMessage = $data->getSystemMessage()) {
5555
$array['system_instruction'] = [
56-
'parts' => ['text' => $systemMessage->content],
56+
'parts' => [['text' => $systemMessage->content]],
5757
];
5858
}
5959

src/platform/tests/Bridge/Google/Contract/MessageBagNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static function provideMessageBagData(): iterable
149149
['role' => 'user', 'parts' => [['text' => 'Hello there']]],
150150
],
151151
'system_instruction' => [
152-
'parts' => ['text' => 'You are a cat. Your name is Neko.'],
152+
'parts' => [['text' => 'You are a cat. Your name is Neko.']],
153153
],
154154
],
155155
];

0 commit comments

Comments
 (0)