Skip to content

Commit 0324fc6

Browse files
committed
Empty argument gets encoded as [] instead of {}
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
1 parent 3b9079d commit 0324fc6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/Service/OpenAiAPIService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,9 @@ public function createChatCompletion(
487487
'function' => $toolCall,
488488
];
489489
$formattedToolCall['function']['arguments'] = json_encode($toolCall['args']);
490+
if ($formattedToolCall === '[]') {
491+
$formattedToolCall = '{}';
492+
}
490493
unset($formattedToolCall['function']['id']);
491494
unset($formattedToolCall['function']['args']);
492495
unset($formattedToolCall['function']['type']);

0 commit comments

Comments
 (0)