Problem/Motivation
I've setup AI with with LMStudio and a local LMM-Service. The connections seems to be fine in the first place, as the different models can be selected via the backend, and I also managed to use it create embeddings into a Vector DB.
But as soon as it comes to chat generation, I receive this strange error message (either by using the admin/config/ai/explorers/chat-generation or by actually adding a chatbot block ) :
TypeError: array_map(): Argument #2 ($array) must be of type array, null given in array_map() (line 51 of /var/www/html/vendor/openai-php/client/src/Responses/Chat/CreateResponse.php).
OpenAI\Responses\Chat\CreateResponse::from(Array, Object) (Line: 35)
OpenAI\Resources\Chat->create(Array) (Line: 225)
Drupal\provider_lmstudio\Plugin\AiProvider\LmStudioProvider->chat(Object, 'multilingual-e5-large', Array)
ReflectionMethod->invokeArgs(Object, Array) (Line: 153)
Drupal\ai\Plugin\ProviderProxy->wrapperCall(Object, Array) (Line: 81)
Drupal\ai\Plugin\ProviderProxy->__call('chat', Array) (Line: 319)
Drupal\ai_api_explorer\Form\ChatGenerationForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('ai_api_chat_generation', Array, Object) (Line: 146)
Drupal\autosave_form\Form\AutosaveFormBuilder->processForm('ai_api_chat_generation', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 97)
Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 43)
Drupal\nrw_general\Middleware\Redirect->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
I'm using the latest Alpha 8 release right now.
Proposed resolution
I could imagine the problem beeing timeout related, as the the local network service takes quite a while to answer.
I've tried to raise the timeouts in LmStudioControlApi.php, which did not work yet.
$options['connect_timeout'] = 120;
$options['read_timeout'] = 120;
$options['timeout'] = 120;
However, having a backend config form to change these would be a good idea anyway, maybe.
Any ideas according to the issue and the debugging/ catching the exception?