Cross posting from https://www.drupal.org/project/ai_image_alt_text/issues/3500084
When setting up AI Image Alt Text at /config/ai/ai_image_alt_text the field for AI provider/model has a default value that reads, "Use Default Image Vision Model."
On the AI Module settings page, where you set default models, config/ai/settings, there is nothing labeled Image Vision Model.
I tried a Chat with Image Vision model and that does appear in the dropdown list but that generates the following error in the logs.
PHP Error:
Error: Call to a member function chat() on null in Drupal\ai_image_alt_text\Controller\GenerateAltText->generate() (line 135 of /app/web/modules/contrib/ai_image_alt_text/src/Controller/GenerateAltText.php).
This leads me to believe the chat model is not what this module expects.
Does the module only work with some AI providers? I was trying Azure OpenAI ChatGPT-4o.
Thank you
Issue fork ai_provider_azure-3500170
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
themusician commentedI also get errors when trying to use the core AI module content suggestions, config/ai/suggestions.
This is what is returned when trying to analyze the page title for an improved title:
Error: Call to a member function setChatSystemRole() on null in Drupal\ai_content_suggestions\AiContentSuggestionsPluginBase->sendChat() (line 310 of /app/web/modules/contrib/ai/modules/ai_content_suggestions/src/AiContentSuggestionsPluginBase.php)
and this is from trying to analyze the body content for readability:
Error: Call to a member function setChatSystemRole() on null in Drupal\ai_content_suggestions\AiContentSuggestionsPluginBase->sendChat() (line 310 of /app/web/modules/contrib/ai/modules/ai_content_suggestions/src/AiContentSuggestionsPluginBase.php)
Comment #3
themusician commentedAfter upgrading to AI 1.0.3 this is now working on a local install.
Comment #4
marcus_johansson commentedCan this be closed, since it seems to work?
Comment #5
themusician commentedI tried it again today before closing this and it seems the Azure Provider is again falling down. The general help message that appears states,
Warning message
We could not create an Alt Text, please try again later.
When attempting to generate alt text I get the original error in the logs:
Error: Call to a member function chat() on null in Drupal\ai_image_alt_text\Controller\GenerateAltText->generate() (line 135 of /app/web/modules/contrib/ai_image_alt_text/src/Controller/GenerateAltText.php).
Backtrace:
Swapping to another provider and it works.
Comment #7
shasha821110 commentedsame issue happen in Azure OpenAI ChatGPT-4o.
Switch to OpenAI works good.
Comment #8
antonín slejška commentedI experience the same problem with "Azure - OpenAI GPT-4o Mini" model. (It does work with the Gemini provider.)
The problem is, that the method isUsable in the plugin AzureProvider returns FALSE. It returns FALSE, because $operation_type is NULL. The variable is null because it is called without parameters, see: https://git.drupalcode.org/project/ai/-/blob/1.0.5/src/AiProviderPluginM...
Comment #9
antonín slejška commentedThe following commit solves the issue described in the comment #8:
https://git.drupalcode.org/project/ai_provider_azure/-/commit/052496c055...
When I install "drupal/ai_provider_azure:1.0.x-dev@dev", then the provider works for me. It would be nice to create a new tag.
Comment #10
themusician commentedThanks for finding the issue. Your fix works on my end to get past the noted error. I think in the Azure AI portal I still need to work on allowing my dev box access to the API but it does now make the call.
Comment #11
shasha821110 commentedhmm, I am still get the error like the following in
drupal/ai_provider_azure:1.0.x-dev@dev