-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Which version of integration_openai are you using?
3.7.1
Which version of Nextcloud are you using?
32
Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.
No response
Describe the Bug
When the encoding of the arguments happens it can cause a problem when the argument is an empty object {} it can be reencoded as []
integration_openai/lib/Service/OpenAiAPIService.php
Lines 476 to 494 in 63da2f6
| if ($history !== null) { | |
| foreach ($history as $i => $historyEntry) { | |
| $message = json_decode($historyEntry, true); | |
| if ($message['role'] === 'human') { | |
| $message['role'] = 'user'; | |
| } | |
| if (isset($message['tool_calls']) && is_array($message['tool_calls'])) { | |
| $message['tool_calls'] = array_map(static function ($toolCall) { | |
| $formattedToolCall = [ | |
| 'id' => $toolCall['id'], | |
| 'type' => 'function', | |
| 'function' => $toolCall, | |
| ]; | |
| $formattedToolCall['function']['arguments'] = json_encode($toolCall['args']); | |
| unset($formattedToolCall['function']['id']); | |
| unset($formattedToolCall['function']['args']); | |
| unset($formattedToolCall['function']['type']); | |
| return $formattedToolCall; | |
| }, $message['tool_calls']); |
I did make a draft pr, but it has unintended side effects at: #243
Expected Behavior
^
To Reproduce
Get tool call that has no arguments. Ex: list current user information
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working