[6.x]: AI tool-calling check fails with a 400 on Anthropic, so Ask AI can't use Claude models
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
失敗しているチェックは、src/Ai/Agents/ToolCallingProbe.php の34行目付近にある無名のツールです。このツールには name() メソッドがないため、laravel/ai は Anthropic が拒否する class_basename にフォールバックします。まずそのファイルを読み、name() を定義している他の Craft アシスタントツールと比較してください。プローブが get_verification_code などの name() を宣言し、claude-sonnet-5-5 に対してツール呼び出しチェックが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened?
Steps to reproduce
- Add an Anthropic provider to
config/ai.php(the stocklaravel/aiconfig has one) and setANTHROPIC_API_KEY. - In Settings → Extend → Connections, set the default text provider to
anthropicand the model toclaude-sonnet-5-5. - Save.
Expected behavior
Craft confirms the model supports tool calling, and the AI assistant task becomes available.
Actual behavior
The check fails, and the AI assistant task is reported as unavailable:
Craft couldn’t check whether the claude-sonnet-5-5 model on the anthropic provider supports tool calling, which AI assistant needs: HTTP request returned status code 400: {"type":"error","error":{"type":"invalid_request_error","message":"tools.0.custom.name: String should match pattern '^[a (truncated...)
Cause
The test tool in src/Ai/Agents/ToolCallingProbe.php:34 is an anonymous class without a name() method. laravel/ai's ToolNameResolver falls back to class_basename(), which for an anonymous class gives a name like ToolCallingProbe.php:34$398. Anthropic rejects the ., : and $. Craft's other assistant tools all define name(), so only this check is affected.
Suggested fix
- Add a
name()method to the anonymous tool, e.g. returningget_verification_code.
Notes
With that method added locally, the tool name resolves to get_verification_code and the check passes with claude-sonnet-5-5. config/ai.php is the stock laravel/ai config, so the config isn't involved.
Craft CMS version
6.x-dev (395aae2)
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
- 主要言語
- PHP
- スター
- 3.6k
- フォーク
- 712
- 平均マージ
- 12時間 40分
- マージ済み PR(30日)
- 344
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
craftcms/cms のほかの issue
-
bug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
craftcms/cms#20248 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
craftcms/cms#20205 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
craftcms/cms#20203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[5.x]: Moving an asset with “Replace it” throws TypeError: volumeUid must be of type string, null given対応中かも @i-just が 6 日前に担当しました。 オープンbug repo:cms
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
craftcms/cms#20128 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug repo:cms
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
craftcms/cms#20271 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
0. Needs triage 35-feedback bug
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
getgrav/grav-plugin-api#74 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
heroku/heroku-buildpack-php#1024 ·
メンテナーはふだん 1 日以内に返信