WSOD when saving an assistant with an invalid model

Created on 6 February 2025, 16 days ago

Problem/Motivation

I've got a site with the AWS Bedrock provider where my key doesn't have access to list models, so I get not list of models (probably should have a separate issue for handling that were models can be configured without that permission...).

Saving the AI Assistant form results in a WSOD:

TypeError: Cannot assign null to property Drupal\ai_assistant_api\Entity\AiAssistant::$llm_model of type string in Drupal\Core\Config\Entity\ConfigEntityBase->set() (line 173 of core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

AI Assistants API

Created by

🇬🇧United Kingdom andrewbelcher

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @andrewbelcher
  • 🇬🇧United Kingdom MrDaleSmith

    The easiest fix for this would be to allow the model to be a null value, but it feels like this would lead to more issues further down the line. Rather than this being a separate issue to how we handle keys that can't access model lists, I think that's the issue we need to focus on: if we decide that these keys can't be used, this specific issue goes away.

    I think we need a discussion here about whether there are circumstances under which a key that can't list models can still be used by the AI modules, and if not block them from being used. If we decide they can be used, that's going to need a bit of thought about how we handle the fact that we might not know which model can be used.

  • 🇩🇪Germany marcus_johansson

    In this case its actually that AWS have such detailed permission layers, that its possible to create a user that can use a model, but not list the models available.

    I have created this in the AWS module, since third party modules might run into it:
    https://www.drupal.org/project/ai_provider_aws_bedrock/issues/3504540 📌 ListFoundation is not always available (step 1) Active
    https://www.drupal.org/project/ai_provider_aws_bedrock/issues/3504541 📌 ListFoundation is not always available (step 2) Active

    Ollama has something similar, where you might have turned of your server where Ollama is running, so it handles this case.

    I'm not sure if there is a more general solution to it - but for AWS it is anyway good that you can override and set models manually if you don't have access to the models listing endpoint.

Production build 0.71.5 2024