Problem/Motivation

If you have a tool call with no input (or all input is forced+hidden), you get an error back from the AWS API that toolConfig.tools[0].inputSchema.json is invalid.

Currently that ends up as null as docroot/modules/contrib/ai_provider_aws_bedrock/src/Plugin/AiProvider/BedrockProvider.php:396 is run with no $parameters.

Steps to reproduce

Call an agent with a function call with no exposed parameters.

Proposed resolution

Explored:

  • Completely removing inputSchema: AWS error due to missing required property
  • Making inputSchema.json.properties an empty array: AWS error due to array when expecting object
  • Making inputSchema.json.properties an empty object: AWS SDK error due to expecting an array :P
  • Always setting parameters to {"type":"object"} in \Drupal\ai\OperationType\Chat\Tools\ToolsFunctionInput::renderFunctionArray: OpenAI error due to peroprties being required.

So propose this is handled as a special case where we do 4, but in the AWS Bedrock provider (we already have custom code there anyway).

Remaining tasks

Implement the fix.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Command icon 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

andrewbelcher created an issue. See original summary.

andrewbelcher’s picture

Assigned: andrewbelcher » Unassigned
Status: Active » Needs review
marcus_johansson’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

  • andrewbelcher committed 648774c5 on 1.1.x
    Issue #3529365 by andrewbelcher: Tool calls with no properties causes a...
andrewbelcher’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.