The chat function signature accepts array|string|ChatInput $input but then calls method_exists on it

Created on 11 June 2025, 4 months ago

Problem/Motivation

The chat method signature accepts strings arrays and ChatInput objects, but it calls method_exists on it which fails on arrays.
[error] TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, array given in method_exists() (line 359 of /var/www/html/web/modules/contrib/ai_provider_openai/src/Plugin/AiProvider/OpenAiProvider.php)

Steps to reproduce

Pass an array to chat.

Proposed resolution

check if the input is an object.

Remaining tasks

PR

User interface changes

none

API changes

none

Data model changes

none

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇨🇭Switzerland bircher 🇨🇿

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024