Undefined array key "text" in BedrockProvider->chat() line 409

Created on 7 April 2025, 7 days ago

Problem/Motivation

It seems that tools are not getting set in provider as I am getting error Warning: Undefined array key "text" in Drupal\ai_provider_aws_bedrock\Plugin\AiProvider\BedrockProvider->chat() (line 409 of modules/contrib/ai_provider_aws_bedrock/src/Plugin/AiProvider/BedrockProvider.php). as
$response['output']['message']['content'][0] does not have text key.
$response = $this->client->converse($payload); results in below output:

$response = {Aws\Result} 
 data = {array[5]} 
  output = {array[1]} 
   message = {array[2]} 
    role = "assistant"
    content = {array[1]} 
     0 = {array[1]} 
      toolUse = {array[3]} 
       toolUseId = "tooluse_PXMU86kwQ5ycPxam-XXXXX"
       name = "ai_agent_get_js_component"
       input = {array[1]} 
        component_name = "custom_components"
  stopReason = "tool_use"

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇮🇳India narendraR Jaipur, India

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