Skip to content

feat(anthropic): add provider tool support for sturctured mode#969

Merged
sixlive merged 1 commit intomainfrom
anthropic-structured-provider-tools
Mar 20, 2026
Merged

feat(anthropic): add provider tool support for sturctured mode#969
sixlive merged 1 commit intomainfrom
anthropic-structured-provider-tools

Conversation

@sixlive
Copy link
Contributor

@sixlive sixlive commented Mar 20, 2026

Description

Adds support for provider tools (e.g., web_search, web_fetch, code_execution) in the Anthropic Structured handler. Previously, provider tools only worked with Text and Stream handlers because the Structured handler's payload didn't include tools or tool_choice.

Changes

  • Structured.php: Added buildTools() method (mirroring Text::buildTools()) and included tools/tool_choice in the base HTTP payload
  • ToolStructuredStrategy.php: Uses base payload's tools array instead of rebuilding it, preserving provider tools; explicitly unsets tool_choice when null (thinking mode) to prevent base value leakage
  • StructuredWithToolsTest.php: Renamed stale "JSON mode" test to "native output format"; added 4 new tests covering provider tools in both native and tool-calling modes (integration + payload verification)

@sixlive sixlive self-assigned this Mar 20, 2026
@sixlive sixlive force-pushed the anthropic-structured-provider-tools branch from c3e6b5d to e191ad5 Compare March 20, 2026 15:33
@kinsta
Copy link

kinsta bot commented Mar 20, 2026

Preview deployments for prism ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: c3e6b5d16a98ad437d93e39e747a52e2516df254

Deployment ID: 888ee471-4bb6-412f-96f8-2516d9801bc3

Static site name: prism-97nz9

@kinsta
Copy link

kinsta bot commented Mar 20, 2026

Preview deployments for prism ⚡️

Status Branch preview Commit preview
🔁 Deploying... N/A N/A

Commit: e191ad570f11557210c56aeb549306a9b7668585

Deployment ID: 0c95703b-4a7f-4c91-9f31-f3e3f9341800

Static site name: prism-97nz9

@sixlive sixlive merged commit efa3276 into main Mar 20, 2026
18 checks passed
@sixlive sixlive deleted the anthropic-structured-provider-tools branch March 20, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant