[PR #5751] feat: native tool calling on by default, add PROVIDER_DISABLE_NATIVE_TOOL_CALLING #5555

Open
opened 2026-06-05 15:21:43 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5751
Author: @angelplusultra
Created: 6/3/2026
Status: 🔄 Open

Base: masterHead: feat-disable-native-tool-calling-env-var


📝 Commits (2)

  • 3803c9a change opt in native tooling to opt out
  • f2894e9 Merge branch 'master' into feat-disable-native-tool-calling-env-var

📊 Changes

11 files changed (+87 additions, -95 deletions)

View changed files

📝 docker/.env.example (+4 -4)
📝 server/.env.example (+4 -4)
📝 server/utils/AiProviders/genericOpenAi/index.js (+20 -5)
📝 server/utils/agents/aibitat/providers/ai-provider.js (+5 -6)
📝 server/utils/agents/aibitat/providers/bedrock.js (+7 -8)
📝 server/utils/agents/aibitat/providers/groq.js (+9 -10)
📝 server/utils/agents/aibitat/providers/lemonade.js (+10 -20)
📝 server/utils/agents/aibitat/providers/litellm.js (+9 -12)
📝 server/utils/agents/aibitat/providers/localai.js (+9 -12)
📝 server/utils/agents/aibitat/providers/openrouter.js (+9 -13)
📝 server/utils/helpers/updateENV.js (+1 -1)

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #5640

Description

Native tool calling used to be opt-in per provider via PROVIDER_SUPPORTS_NATIVE_TOOL_CALLING. This flips that: native tool calling is now always enabled by default, and a new PROVIDER_DISABLE_NATIVE_TOOL_CALLING flag lets you force a provider back to UnTooled (prompt-based) tool calling.

Affected providers (the ones that leaned on the old flag): bedrock, groq, lemonade, litellm, localai, openrouter, and generic-openai.

Changes:

  • Renamed the base helper Provider.supportsNativeToolCallingViaEnv() to optsOutOfNativeToolCallingViaEnv() in ai-provider.js, now keyed off PROVIDER_DISABLE_NATIVE_TOOL_CALLING.
  • Each provider's supportsNativeToolCalling() now returns true unless the provider tag is listed in the disable flag. This keeps it as the single source of truth, so the stream/complete paths and all external consumers (Workspace.supportsNativeToolCalling, isAgentCommandAvailable, agent handlers, telegram bot) keep working.
  • Lemonade: dropped its label/capability fallback for enabling tools, since native is now on by default unless explicitly disabled.
  • generic-openai: its tools capability in getModelCapabilities() now defaults to enabled unless disabled via the new flag. The other capabilities (reasoning, vision, image generation) keep their existing PROVIDER_SUPPORTS_* opt-in behavior.
  • Updated the env allow-list in updateENV.js and both .env.example files to the new flag + semantics.

Behavior change to be aware of

Because native tool calling is now on by default, workspaces in automatic chat mode will auto-run the agent for these providers without needing @agent. Setting PROVIDER_DISABLE_NATIVE_TOOL_CALLING for a provider reverts it to the previous default, where the agent runs only when @agent is explicitly invoked.

Additional Information

No frontend or DB changes. The PROVIDER_DISABLE_NATIVE_TOOL_CALLING value is a comma-separated list of provider tags, e.g. PROVIDER_DISABLE_NATIVE_TOOL_CALLING="openrouter,groq".

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (if applicable)
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5751 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 6/3/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feat-disable-native-tool-calling-env-var` --- ### 📝 Commits (2) - [`3803c9a`](https://github.com/Mintplex-Labs/anything-llm/commit/3803c9a420e03fd6c1cc974ef2f9738035d28744) change opt in native tooling to opt out - [`f2894e9`](https://github.com/Mintplex-Labs/anything-llm/commit/f2894e9254d5ca1e4300641ce7f98178ba3acfc2) Merge branch 'master' into feat-disable-native-tool-calling-env-var ### 📊 Changes **11 files changed** (+87 additions, -95 deletions) <details> <summary>View changed files</summary> 📝 `docker/.env.example` (+4 -4) 📝 `server/.env.example` (+4 -4) 📝 `server/utils/AiProviders/genericOpenAi/index.js` (+20 -5) 📝 `server/utils/agents/aibitat/providers/ai-provider.js` (+5 -6) 📝 `server/utils/agents/aibitat/providers/bedrock.js` (+7 -8) 📝 `server/utils/agents/aibitat/providers/groq.js` (+9 -10) 📝 `server/utils/agents/aibitat/providers/lemonade.js` (+10 -20) 📝 `server/utils/agents/aibitat/providers/litellm.js` (+9 -12) 📝 `server/utils/agents/aibitat/providers/localai.js` (+9 -12) 📝 `server/utils/agents/aibitat/providers/openrouter.js` (+9 -13) 📝 `server/utils/helpers/updateENV.js` (+1 -1) </details> ### 📄 Description ### Pull Request Type - [x] ✨ feat (New feature) - [ ] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [ ] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues resolves #5640 ### Description Native tool calling used to be opt-in per provider via `PROVIDER_SUPPORTS_NATIVE_TOOL_CALLING`. This flips that: native tool calling is now always enabled by default, and a new `PROVIDER_DISABLE_NATIVE_TOOL_CALLING` flag lets you force a provider back to UnTooled (prompt-based) tool calling. Affected providers (the ones that leaned on the old flag): bedrock, groq, lemonade, litellm, localai, openrouter, and generic-openai. Changes: - Renamed the base helper `Provider.supportsNativeToolCallingViaEnv()` to `optsOutOfNativeToolCallingViaEnv()` in `ai-provider.js`, now keyed off `PROVIDER_DISABLE_NATIVE_TOOL_CALLING`. - Each provider's `supportsNativeToolCalling()` now returns `true` unless the provider tag is listed in the disable flag. This keeps it as the single source of truth, so the `stream`/`complete` paths and all external consumers (`Workspace.supportsNativeToolCalling`, `isAgentCommandAvailable`, agent handlers, telegram bot) keep working. - Lemonade: dropped its label/capability fallback for enabling tools, since native is now on by default unless explicitly disabled. - generic-openai: its `tools` capability in `getModelCapabilities()` now defaults to enabled unless disabled via the new flag. The other capabilities (reasoning, vision, image generation) keep their existing `PROVIDER_SUPPORTS_*` opt-in behavior. - Updated the env allow-list in `updateENV.js` and both `.env.example` files to the new flag + semantics. ### Behavior change to be aware of Because native tool calling is now on by default, workspaces in **automatic** chat mode will auto-run the agent for these providers without needing `@agent`. Setting `PROVIDER_DISABLE_NATIVE_TOOL_CALLING` for a provider reverts it to the previous default, where the agent runs only when `@agent` is explicitly invoked. ### Additional Information No frontend or DB changes. The `PROVIDER_DISABLE_NATIVE_TOOL_CALLING` value is a comma-separated list of provider tags, e.g. `PROVIDER_DISABLE_NATIVE_TOOL_CALLING="openrouter,groq"`. ### Developer Validations - [x] I ran `yarn lint` from the root of the repo & committed changes - [ ] Relevant documentation has been updated (if applicable) - [x] I have tested my code functionality - [ ] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:21:43 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5555