Skip to content

Commit fb27767

Browse files
committed
Empty argument gets encoded as [] instead of {}
Signed-off-by: Lukas Schaefer <[email protected]>
1 parent 6918967 commit fb27767

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['function']['arguments'] === '[]') {
491+
$formattedToolCall['function']['arguments'] = '{}';
492+
}
490493
unset($formattedToolCall['function']['id']);
491494
unset($formattedToolCall['function']['args']);
492495
unset($formattedToolCall['function']['type']);

0 commit comments

Comments
 (0)